diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3d368fb46cca7d4da4f38dfde06585cbf6eccb1f..b4e43a7e83caba06e1b5130b762428285fea635a 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,284 +1,284 @@
-cmake_minimum_required(VERSION 3.0)
-project (dap_crypto)
-
-# fix implicit declaration warnings
-add_definitions ("-D_GNU_SOURCE")
-
-#set(CMAKE_C_FLAGS "-std=c11  -O2 -Wall -Wextra -fPIC -fno-pie -no-pie -fno-ident ")
-#set(CMAKE_ASM_FLAGS "-std=c11  -O2 -Wall -Wextra -fPIC -fno-pie -no-pie -fno-ident ")
-#set(CMAKE_C_FLAGS "-std=c11  -O3 -Wall -Wextra -fPIC -fno-pie -no-pie -fno-ident -ffast-math -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all")
-#set(CMAKE_ASM_FLAGS "-std=c11  -O3 -Wall -Wextra -fPIC -fno-pie -no-pie -fno-ident -ffast-math -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all")
-#set(CMAKE_C_FLAGS "-static -Wall -O3 -fno-ident -ffast-math -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all")
-#set(CMAKE_ASM_FLAGS "-static -Wall -O3 -fno-ident -ffast-math -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all")
-
-if(NOT (${SUBMODULES_NO_BUILD} MATCHES ON))
-
-  # Check whether we're on a 32-bit or 64-bit system
-  if(CMAKE_SIZEOF_VOID_P EQUAL "8")
-    set(DEFAULT_BUILD_64 ON)
-  else()
-    set(DEFAULT_BUILD_64 OFF)
-  endif()
-  option(BUILD_64 "Build for 64-bit? 'OFF' builds for 32-bit." ${DEFAULT_BUILD_64})
-
-  add_definitions ("-DDAP_SERVER")
-  add_definitions ("-DNODE_NETNAME=\"kelvin\"")
-
-  set(_CCOPT "-Wall -O2 -pg -fPIC -fno-pie -no-pie")
-  set(_LOPT "-pg")
-  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}")
-  set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} ${_LOPT}")
-
-  if (NOT (TARGET dap_core))
-    add_subdirectory(libdap)
-  endif()
-endif()
-
-file( GLOB CRYPTO_SRCS 
-      src/*.c 
-      src/rand/*.c 
-      src/iaes/*.c 
-      src/oaes/*.c 
-      src/sha3/*.c 
-      src/msrln/*.c 
-      src/defeo_scheme/*.c 
-      src/sig_bliss/*.c 
-      src/sig_tesla/*.c 
-      src/sig_picnic/*.c
-      src/sig_dilithium/*.c
-)
-
-file( GLOB CRYPTO_HEADERS 
-      src/*.h 
-      src/rand/*.h 
-      src/iaes/*.h 
-      src/oaes/*.h 
-      src/sha3/*.h 
-      src/msrln/*.h 
-      src/defeo_scheme/*.h 
-      src/sig_bliss/*.h 
-      src/sig_tesla/*.h 
-      src/sig_picnic/*.h 
-      src/sig_dilithium/*.h
-      include/*.h
-)
-
-enable_language(ASM)
-
-file( GLOB XKCP_SRCS 
-  src/XKCP/lib/high/Keccak/FIPS202/KeccakHash.c
-  src/XKCP/lib/high/Keccak/KeccakSpongeWidth1600.c
-  src/XKCP/lib/high/Keccak/SP800-185/SP800-185.c
-  src/XKCP/lib/high/Keccak/FIPS202/SimpleFIPS202.c
-)
-
-if(WIN32)
-  if(BUILD_64)
-    #file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64/KeccakP-1600-x86-64-gas.s ) - SIGSEGV on MinGW
-    file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/Compact64/KeccakP-1600-compact64.c )
-  else()
-    file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/Inplace32BI/KeccakP-1600-inplace32BI.c )
-  endif()
-endif()
-
-if(UNIX)
-  if(BUILD_64)
-    file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64/KeccakP-1600-x86-64-gas.s )
-  else()
-    file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/Inplace32BI/KeccakP-1600-inplace32BI.c )
-  endif()
-endif()
-
-add_library(${PROJECT_NAME} STATIC ${CRYPTO_SRCS} ${XKCP_SRCS} ${XKCP_SRCS2} ${CRYPTO_HEADERS} )
-
-target_include_directories(dap_crypto PRIVATE src/rand src/iaes src/oaes src/sha3 src/msrln src/defeo_scheme src/sig_bliss src/sig_tesla src/sig_picnic src/sig_dilithium src include)
-target_include_directories(dap_crypto INTERFACE src/ src/sha3 include/)
-
-target_include_directories(dap_crypto PUBLIC
-        src/XKCP/lib/common
-        src/XKCP/lib/low/common
-        src/XKCP/lib/high/Keccak
-        src/XKCP/lib/high/common
-        src/XKCP/lib/high/Keccak/FIPS202
-        src/XKCP/lib/high/Keccak/SP800-185
-        src/XKCP/lib/low/KeccakP-1600/Optimized
-)
-
-if(WIN32)
-  if(BUILD_64)
-
-    #target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64)
-    target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600/Compact64)
-
-    if (__AVX__)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
-    elseif(__AVX2__)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
-    elseif(__SSE4_1__)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
-    else()
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
-    endif()
-
-  else()
-    target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600/Inplace32BI)
-
-    if (__AVX__)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
-    elseif(__AVX2__)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
-    elseif(__SSE4_1__)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
-    else()
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
-        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
-    endif()
-  endif()
-endif()
-
-if(UNIX)
-  if(BUILD_64)
-    target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64)
-    target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64)
-
-    if(__AVX2__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
-    elseif(__SSE4_1__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
-    else()
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
-    endif()
-
-    if(__AVX2__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
-    elseif(__AVX__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
-    elseif(__SSE4_1__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
-    else()
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
-    endif()
-
-    if(__AVX2__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
-    elseif(__AVX__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
-    elseif(__SSE4_1__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
-    else()
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
-    endif()
-
-  else()
-    target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600/Inplace32BI)
-    target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600/Inplace32BI)
-
-    if(__AVX2__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
-    elseif(__SSE4_1__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
-    else()
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
-    endif()
-
-    if(__AVX2__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
-    elseif(__AVX__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
-    elseif(__SSE4_1__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
-    else()
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
-    endif()
-
-    if(__AVX2__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
-    elseif(__AVX__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
-    elseif(__SSE4_1__)
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
-    else()
-        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
-        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
-    endif()
-
-  endif()
-endif()
-
-if(WIN32)
-  target_link_libraries(dap_crypto dap_core)
-endif()
-
-if(UNIX)
-  target_link_libraries(dap_crypto dap_core m)
-endif()
-
-if(BUILD_CRYPTO_TESTS)
-    enable_testing()
-    add_subdirectory(test)
-endif()
+cmake_minimum_required(VERSION 3.0)
+project (dap_crypto)
+
+# fix implicit declaration warnings
+add_definitions ("-D_GNU_SOURCE")
+
+#set(CMAKE_C_FLAGS "-std=c11  -O2 -Wall -Wextra -fPIC -fno-pie -no-pie -fno-ident ")
+#set(CMAKE_ASM_FLAGS "-std=c11  -O2 -Wall -Wextra -fPIC -fno-pie -no-pie -fno-ident ")
+#set(CMAKE_C_FLAGS "-std=c11  -O3 -Wall -Wextra -fPIC -fno-pie -no-pie -fno-ident -ffast-math -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all")
+#set(CMAKE_ASM_FLAGS "-std=c11  -O3 -Wall -Wextra -fPIC -fno-pie -no-pie -fno-ident -ffast-math -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all")
+#set(CMAKE_C_FLAGS "-static -Wall -O3 -fno-ident -ffast-math -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all")
+#set(CMAKE_ASM_FLAGS "-static -Wall -O3 -fno-ident -ffast-math -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all")
+
+if(NOT (${SUBMODULES_NO_BUILD} MATCHES ON))
+
+  # Check whether we're on a 32-bit or 64-bit system
+  if(CMAKE_SIZEOF_VOID_P EQUAL "8")
+    set(DEFAULT_BUILD_64 ON)
+  else()
+    set(DEFAULT_BUILD_64 OFF)
+  endif()
+  option(BUILD_64 "Build for 64-bit? 'OFF' builds for 32-bit." ${DEFAULT_BUILD_64})
+
+  add_definitions ("-DDAP_SERVER")
+  add_definitions ("-DNODE_NETNAME=\"kelvin\"")
+
+  set(_CCOPT "-Wall -O2 -pg -fPIC -fno-pie -no-pie")
+  set(_LOPT "-pg")
+  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT}")
+  set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} ${_LOPT}")
+
+  if (NOT (TARGET dap_core))
+    add_subdirectory(libdap)
+  endif()
+endif()
+
+file( GLOB CRYPTO_SRCS 
+      src/*.c 
+      src/rand/*.c 
+      src/iaes/*.c 
+      src/oaes/*.c 
+      src/sha3/*.c 
+      src/msrln/*.c 
+      src/defeo_scheme/*.c 
+      src/sig_bliss/*.c 
+      src/sig_tesla/*.c 
+      src/sig_picnic/*.c
+      src/sig_dilithium/*.c
+)
+
+file( GLOB CRYPTO_HEADERS 
+      src/*.h 
+      src/rand/*.h 
+      src/iaes/*.h 
+      src/oaes/*.h 
+      src/sha3/*.h 
+      src/msrln/*.h 
+      src/defeo_scheme/*.h 
+      src/sig_bliss/*.h 
+      src/sig_tesla/*.h 
+      src/sig_picnic/*.h 
+      src/sig_dilithium/*.h
+      include/*.h
+)
+
+enable_language(ASM)
+
+file( GLOB XKCP_SRCS 
+  src/XKCP/lib/high/Keccak/FIPS202/KeccakHash.c
+  src/XKCP/lib/high/Keccak/KeccakSpongeWidth1600.c
+  src/XKCP/lib/high/Keccak/SP800-185/SP800-185.c
+  src/XKCP/lib/high/Keccak/FIPS202/SimpleFIPS202.c
+)
+
+if(WIN32)
+  if(BUILD_64)
+    #file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64/KeccakP-1600-x86-64-gas.s ) - SIGSEGV on MinGW
+    file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/Compact64/KeccakP-1600-compact64.c )
+  else()
+    file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/Inplace32BI/KeccakP-1600-inplace32BI.c )
+  endif()
+endif()
+
+if(UNIX)
+  if(BUILD_64)
+    file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64/KeccakP-1600-x86-64-gas.s )
+  else()
+    file( GLOB XKCP_SRCS2 src/XKCP/lib/low/KeccakP-1600/Inplace32BI/KeccakP-1600-inplace32BI.c )
+  endif()
+endif()
+
+add_library(${PROJECT_NAME} STATIC ${CRYPTO_SRCS} ${XKCP_SRCS} ${XKCP_SRCS2} ${CRYPTO_HEADERS} )
+
+target_include_directories(dap_crypto PRIVATE src/rand src/iaes src/oaes src/sha3 src/msrln src/defeo_scheme src/sig_bliss src/sig_tesla src/sig_picnic src/sig_dilithium src include)
+target_include_directories(dap_crypto INTERFACE src/ src/sha3 include/)
+
+target_include_directories(dap_crypto PUBLIC
+        src/XKCP/lib/common
+        src/XKCP/lib/low/common
+        src/XKCP/lib/high/Keccak
+        src/XKCP/lib/high/common
+        src/XKCP/lib/high/Keccak/FIPS202
+        src/XKCP/lib/high/Keccak/SP800-185
+        src/XKCP/lib/low/KeccakP-1600/Optimized
+)
+
+if(WIN32)
+  if(BUILD_64)
+
+    #target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64)
+    target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600/Compact64)
+
+    if (__AVX__)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
+    elseif(__AVX2__)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
+    elseif(__SSE4_1__)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
+    else()
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
+    endif()
+
+  else()
+    target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600/Inplace32BI)
+
+    if (__AVX__)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
+    elseif(__AVX2__)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
+    elseif(__SSE4_1__)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
+    else()
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
+        target_include_directories(dap_crypto PUBLIC src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
+    endif()
+  endif()
+endif()
+
+if(UNIX)
+  if(BUILD_64)
+    target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64)
+    target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600/OptimizedAsmX86-64)
+
+    if(__AVX2__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
+    elseif(__SSE4_1__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
+    else()
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
+    endif()
+
+    if(__AVX2__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
+    elseif(__AVX__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
+    elseif(__SSE4_1__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
+    else()
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
+    endif()
+
+    if(__AVX2__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
+    elseif(__AVX__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
+    elseif(__SSE4_1__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
+    else()
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
+    endif()
+
+  else()
+    target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600/Inplace32BI)
+    target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600/Inplace32BI)
+
+    if(__AVX2__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD512/AVX512ufull)
+    elseif(__SSE4_1__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull)
+    else()
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times2/FallbackOn1)
+    endif()
+
+    if(__AVX2__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX512ufull)
+    elseif(__AVX__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD256)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/SIMD512/AVX2ufull)
+    elseif(__SSE4_1__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn2)
+    else()
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times4/FallbackOn1)
+    endif()
+
+    if(__AVX2__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/SIMD512/AVX512ufull)
+    elseif(__AVX__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn4)
+    elseif(__SSE4_1__)
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn2)
+    else()
+        target_include_directories(dap_crypto INTERFACE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
+        target_include_directories(dap_crypto PRIVATE src/XKCP/lib/low/KeccakP-1600-times8/FallbackOn1)
+    endif()
+
+  endif()
+endif()
+
+if(WIN32)
+  target_link_libraries(dap_crypto dap_core)
+endif()
+
+if(UNIX)
+  target_link_libraries(dap_crypto dap_core m)
+endif()
+
+if(BUILD_CRYPTO_TESTS)
+    enable_testing()
+    add_subdirectory(test)
+endif()
diff --git a/include/dap_enc_key.h b/include/dap_enc_key.h
index e439be641b13e4205842e912ebd4621b94fd92e1..4598356890308ff25d0bfb1d3c3e3196b3d5a66e 100755
--- a/include/dap_enc_key.h
+++ b/include/dap_enc_key.h
@@ -228,7 +228,7 @@ uint8_t* dap_enc_key_deserealize_sign(dap_enc_key_type_t a_key_type, uint8_t *a_
 uint8_t* dap_enc_key_serealize_priv_key(dap_enc_key_t *a_key, size_t *a_buflen_out);
 uint8_t* dap_enc_key_serealize_pub_key(dap_enc_key_t *a_key, size_t *a_buflen_out);
 int dap_enc_key_deserealize_priv_key(dap_enc_key_t *a_key, uint8_t *a_buf, size_t a_buflen);
-int dap_enc_key_deserealize_pub_key(dap_enc_key_t *a_key, const uint8_t *a_buf, size_t a_buflen);
+int dap_enc_key_deserealize_pub_key(dap_enc_key_t *a_key, uint8_t *a_buf, size_t a_buflen);
 
 dap_enc_key_serealize_t* dap_enc_key_serealize(dap_enc_key_t * key);
 dap_enc_key_t* dap_enc_key_deserealize(void *buf, size_t buf_size);
diff --git a/src/dap_enc_dilithium.c b/src/dap_enc_dilithium.c
index b51112fbfe81bc7719d00580d8cef7fb985b67cc..da925e026fe307d7e70b3fd75e88286bc77e5e85 100755
--- a/src/dap_enc_dilithium.c
+++ b/src/dap_enc_dilithium.c
@@ -88,8 +88,14 @@ size_t dap_enc_sig_dilithium_verify_sign(struct dap_enc_key * key, const void *
 
 void dap_enc_sig_dilithium_key_delete(struct dap_enc_key * key)
 {
-    dilithium_private_and_public_keys_delete((dilithium_private_key_t *) key->priv_key_data,
+    if( key->priv_key_data && key->pub_key_data)
+        dilithium_private_and_public_keys_delete((dilithium_private_key_t *) key->priv_key_data,
             (dilithium_public_key_t *) key->pub_key_data);
+    else if ( key->pub_key_data )
+        dilithium_public_key_delete((dilithium_public_key_t *) key->pub_key_data);
+    else if ( key->priv_key_data )
+        dilithium_public_key_delete((dilithium_public_key_t *) key->priv_key_data);
+
 }
 
 size_t dap_enc_dilithium_calc_signature_size(void)
@@ -217,10 +223,10 @@ dilithium_public_key_t* dap_enc_dilithium_read_public_key(const uint8_t *a_buf,
     dilithium_param_t p;
     if(!dilithium_params_init(&p, kind))
         return NULL;
-    dilithium_public_key_t* l_public_key = DAP_NEW(dilithium_public_key_t);
+    dilithium_public_key_t* l_public_key = DAP_NEW_Z(dilithium_public_key_t);
     l_public_key->kind = kind;
 
-    l_public_key->data = DAP_NEW_SIZE(unsigned char, p.CRYPTO_PUBLICKEYBYTES);
+    l_public_key->data = DAP_NEW_Z_SIZE(unsigned char, p.CRYPTO_PUBLICKEYBYTES);
     memcpy(l_public_key->data, a_buf + sizeof(size_t) + sizeof(dilithium_kind_t), p.CRYPTO_PUBLICKEYBYTES);
     return l_public_key;
 }
diff --git a/src/dap_enc_key.c b/src/dap_enc_key.c
index 1b0d467c398d8eb5a359a1a4040a9f2c86cf7ff7..1d9ab6e03c4a155042b306c9acea58bff9659627 100755
--- a/src/dap_enc_key.c
+++ b/src/dap_enc_key.c
@@ -410,7 +410,7 @@ int dap_enc_key_deserealize_priv_key(dap_enc_key_t *a_key, uint8_t *a_buf, size_
  * @param a_buflen_out
  * @return 0 Ok, -1 error
  */
-int dap_enc_key_deserealize_pub_key(dap_enc_key_t *a_key,const uint8_t *a_buf, size_t a_buflen)
+int dap_enc_key_deserealize_pub_key(dap_enc_key_t *a_key, uint8_t *a_buf, size_t a_buflen)
 {
     if(!a_key || !a_buf)
         return -1;
@@ -446,7 +446,8 @@ int dap_enc_key_deserealize_pub_key(dap_enc_key_t *a_key,const uint8_t *a_buf, s
         dap_enc_sig_picnic_update(a_key);
         break;
     case DAP_ENC_KEY_TYPE_SIG_DILITHIUM:
-        dilithium_public_key_delete((dilithium_public_key_t *) a_key->pub_key_data);
+        if ( a_key->pub_key_data )
+            dilithium_public_key_delete((dilithium_public_key_t *) a_key->pub_key_data);
         a_key->pub_key_data = (uint8_t*) dap_enc_dilithium_read_public_key(a_buf, a_buflen);
         if(!a_key->pub_key_data)
         {
@@ -631,8 +632,10 @@ void dap_enc_key_delete(dap_enc_key_t * a_key)
         log_it(L_ERROR, "delete callback is null. Can be leak memory!");
     }
     /* a_key->_inheritor must be cleaned in delete_callback func */
-    DAP_DELETE(a_key->pub_key_data);
-    DAP_DELETE(a_key->priv_key_data);
+    if ( a_key->pub_key_data)
+        DAP_DELETE(a_key->pub_key_data);
+    if (a_key->priv_key_data )
+        DAP_DELETE(a_key->priv_key_data);
     DAP_DELETE(a_key);
 }
 
diff --git a/src/sig_dilithium/dilithium_sign.c b/src/sig_dilithium/dilithium_sign.c
index 63ddd1a048bcfcbdb5128ff43f8585f2fd77e836..4b2a59e34742ced37c42ca6ca2f74ed3a37f6cfb 100755
--- a/src/sig_dilithium/dilithium_sign.c
+++ b/src/sig_dilithium/dilithium_sign.c
@@ -91,7 +91,7 @@ void dilithium_public_key_delete(dilithium_public_key_t *public_key)
     if(public_key) {
         free(public_key->data);
         public_key->data = NULL;
-        free(public_key);
+        //free(public_key);
     }
 }