Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • car/libdap-crypto
1 result
Show changes
Commits on Source (88)
Showing
with 1884 additions and 1238 deletions
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 )
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 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 INTERFACE
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
)
target_include_directories(dap_crypto PRIVATE
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/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(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")
if(NOT SUBMODULES_NO_BUILD)
# 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})
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/blowfish/*.c
src/GOST/*.c
src/salsa2012/*.c
src/seed/*.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
src/ringct20/*.c
)
file( GLOB CRYPTO_HEADERS
src/*.h
src/rand/*.h
src/iaes/*.h
src/oaes/*.h
src/blowfish/*.h
src/GOST/*.h
src/salsa2012/*.h
src/seed/*.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
src/ringct20/*.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()
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.2, 2020-04-29T10:52:27. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{11b3ace2-edb6-4ae7-8e1b-fce9fa91893f}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 MinGW 32-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 32-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win32_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">BUILD_CRYPTO_TESTS:BOOL=ON</value>
<value type="QString">CMAKE_BUILD_TYPE:STRING=Debug</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/qt_proj/build-libdap-crypto_new-Desktop_Qt_5_14_2_MinGW_32_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=Release</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/qt_proj/build-libdap-crypto_new-Desktop_Qt_5_14_2_MinGW_32_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/qt_proj/build-libdap-crypto_new-Desktop_Qt_5_14_2_MinGW_32_bit-RelWithDebInfo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release with Debug Information</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=MinSizeRel</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/qt_proj/build-libdap-crypto_new-Desktop_Qt_5_14_2_MinGW_32_bit-MinSizeRel</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Minimum Size Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">4</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">crypto-test</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.crypto-test</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">crypto-test</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">crypto_cert_test</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.crypto_cert_test</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">crypto_cert_test</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>
# libdap
Deus Applications Prototypes: core library
[![Build Status](https://travis-ci.com/kelvinblockchain/libdap.svg?branch=master)](https://travis-ci.com/kelvinblockchain/libdap)
[![Build Status](https://travis-ci.com/cellframe/libdap.svg?branch=master)](https://travis-ci.com/cellframe/libdap)
## Build and Run tests:
```
......
/*
* Authors:
* Dmitriy A. Gearasimov <gerasimov.dmitriy@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Sources https://gitlab.demlabs.net/cellframe
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of CellFrame SDK the open source project
CellFrame SDK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CellFrame SDK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any CellFrame SDK based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "dap_sign.h"
#include "dap_pkey.h"
#include "dap_enc.h"
#include "dap_enc_key.h"
#define DAP_CERT_ITEM_NAME_MAX 40
typedef struct dap_cert {
dap_enc_key_t * enc_key;
char name[DAP_CERT_ITEM_NAME_MAX];
void * _pvt;
char * metadata;
} dap_cert_t;
#ifdef __cplusplus
extern "C" {
#endif
int dap_cert_init();
dap_cert_t * dap_cert_new(const char * a_name);
size_t dap_cert_parse_str_list(const char * a_certs_str, dap_cert_t *** a_certs, size_t * a_certs_size);
dap_cert_t * dap_cert_generate(const char * a_cert_name,const char * a_file_path,dap_enc_key_type_t a_key_type );
dap_cert_t * dap_cert_generate_mem_with_seed(const char * a_cert_name, dap_enc_key_type_t a_key_type,
const void* a_seed, size_t a_seed_size);
dap_cert_t * dap_cert_generate_mem(const char * a_cert_name, dap_enc_key_type_t a_key_type );
dap_cert_t * dap_cert_add_file(const char * a_cert_name,const char *a_folder_path);
int dap_cert_save_to_folder(dap_cert_t * a_cert, const char *a_file_dir_path);
const char* dap_cert_get_folder(int a_n_folder_path);
void dap_cert_add_folder(const char *a_folder_path);
void dap_cert_dump(dap_cert_t * a_cert);
dap_pkey_t * dap_cert_to_pkey(dap_cert_t * a_cert);
dap_cert_t * dap_cert_find_by_name(const char * a_cert_name);
dap_sign_t * dap_cert_sign(dap_cert_t * a_cert, const void * a_data, size_t a_data_size, size_t a_output_size_wished );
int dap_cert_compare_with_sign (dap_cert_t * a_cert,const dap_sign_t * a_sign);
size_t dap_cert_sign_output_size(dap_cert_t * a_cert, size_t a_size_wished);
//int dap_cert_sign_output(dap_cert_t * a_cert, const void * a_data, size_t a_data_size
// , void * a_output , size_t a_output_size);
int dap_cert_add_cert_sign(dap_cert_t * a_cert, dap_cert_t * a_cert_signer);
size_t dap_cert_count_cert_sign(dap_cert_t * a_cert);
void dap_cert_deinit();
void dap_cert_delete(dap_cert_t * a_cert);
void dap_cert_delete_by_name(const char * a_cert_name);
#ifdef __cplusplus
}
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <gerasimov.dmitriy@demlabs.net>
* DeM Labs Inc. https://demlabs.net https:/gitlab.com/demlabs
* Kelvin Project https://github.com/kelvinblockchain
* Copyright (c) 2017-2018
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdint.h>
#include "dap_common.h"
#include "dap_cert.h"
// Magic .dapcert signature
#define dap_cert_FILE_HDR_SIGN 0x0F300C4711E29380
#define dap_cert_FILE_VERSION 1
// Default certificate with private key and optionaly some signs
#define dap_cert_FILE_TYPE_PRIVATE 0x00
// Default certificate with public key and optionaly some signs
#define dap_cert_FILE_TYPE_PUBLIC 0xf0
typedef struct dap_cert_file_hdr
{
uint64_t sign;
int version;
uint8_t type;
dap_sign_type_t sign_type;
uint64_t data_size;
uint64_t data_pvt_size;
uint64_t metadata_size;
time_t ts_last_used;
} DAP_ALIGN_PACKED dap_cert_file_hdr_t;
typedef struct dap_cert_file{
dap_cert_file_hdr_t hdr;
uint8_t data[];
}DAP_ALIGN_PACKED dap_cert_file_t;
#ifdef __cplusplus
extern "C" {
#endif
int dap_cert_file_save(dap_cert_t * a_cert, const char * a_cert_file_path);
uint8_t* dap_cert_mem_save(dap_cert_t * a_cert, uint32_t *a_cert_size_out);
dap_cert_t* dap_cert_file_load(const char * a_cert_file_path);
dap_cert_t* dap_cert_mem_load(const void * a_data, size_t a_data_size);
#ifdef __cplusplus
}
#endif
#ifndef __CRYPTO_COMMON_H__
#define __CRYPTO_COMMON_H__
// For C++
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "dap_common.h"
#include "sha3/fips202.h"
#include "KeccakHash.h"
#include "SimpleFIPS202.h"
#include "SP800-185.h"
#include "rand/dap_rand.h"
// Definition of operating system
#define OS_WIN 1
#define OS_LINUX 2
#define OS_MACOS 3
#if defined(_WIN32) // Microsoft Windows OS
#define OS_TARGET OS_WIN
#elif defined(__linux__) // Linux OS
#define OS_TARGET OS_LINUX
#elif defined(__APPLE__) // MACOS
#define OS_TARGET OS_MACOS
#else
#error -- "Unsupported OS"
#endif
// Definition of compiler
#define COMPILER_VC 1
#define COMPILER_GCC 2
#define COMPILER_CLANG 3
#if defined(_MSC_VER) // Microsoft Visual C compiler
#define COMPILER COMPILER_VC
#elif defined(__GNUC__) // GNU GCC compiler
#define COMPILER COMPILER_GCC
#elif defined(__clang__) // Clang compiler
#define COMPILER COMPILER_CLANG
#else
#error -- "Unsupported COMPILER"
#endif
// Definition of the targeted architecture and basic data types
#define TARGET_AMD64 1
#define TARGET_x86 2
#define TARGET_ARM 3
#define TARGET_ARM64 4
#if (defined(__x86_64__) || defined(__x86_64) || defined(__arch64__) || defined(_M_AMD64) || defined(_M_X64) || defined(_WIN64) || !defined(__LP64__))
#define _AMD64_
#elif (defined(__aarch64__))
#define _ARM64_
#else
#define _X86_
#endif
#if defined(_AMD64_)
#define TARGET TARGET_AMD64
#define RADIX 64
#define LOG2RADIX 6
typedef uint64_t digit_t; // Unsigned 64-bit digit
typedef int64_t sdigit_t; // Signed 64-bit digit
typedef uint32_t hdigit_t; // Unsigned 32-bit digit
#define NWORDS_FIELD 12 // Number of words of a 751-bit field element
#define p751_ZERO_WORDS 5 // Number of "0" digits in the least significant part of p751 + 1
#elif defined(_X86_)
#define TARGET TARGET_x86
#define RADIX 32
#define LOG2RADIX 5
typedef uint32_t digit_t; // Unsigned 32-bit digit
typedef int32_t sdigit_t; // Signed 32-bit digit
typedef uint16_t hdigit_t; // Unsigned 16-bit digit
#define NWORDS_FIELD 24
#define p751_ZERO_WORDS 11
#elif defined(_ARM_)
#define TARGET TARGET_ARM
#define RADIX 32
#define LOG2RADIX 5
typedef uint32_t digit_t; // Unsigned 32-bit digit
typedef int32_t sdigit_t; // Signed 32-bit digit
typedef uint16_t hdigit_t; // Unsigned 16-bit digit
#define NWORDS_FIELD 24
#define p751_ZERO_WORDS 11
#elif defined(_ARM64_)
#define TARGET TARGET_ARM64
#define RADIX 64
#define LOG2RADIX 6
typedef uint64_t digit_t; // Unsigned 64-bit digit
typedef int64_t sdigit_t; // Signed 64-bit digit
typedef uint32_t hdigit_t;
#define NWORDS_FIELD 12
#define p751_ZERO_WORDS 5
#else
#error -- "Unsupported ARCHITECTURE"
#endif
#define RADIX64
// Instruction support
#define NO_SIMD_SUPPORT 0
#define AVX_SUPPORT 1
#define AVX2_SUPPORT 2
#if defined(__AVX2__)
#define SIMD_SUPPORT AVX2_SUPPORT // AVX2 support selection
#elif defined(__AVX__)
#define SIMD_SUPPORT AVX_SUPPORT // AVX support selection
#else
#define SIMD_SUPPORT NO_SIMD_SUPPORT
#endif
#if defined(__ASM__) // Assembly support selection
#define ASM_SUPPORT
#endif
#if (SIMD_SUPPORT == NO_SIMD_SUPPORT) // Selection of generic, portable implementation
#define GENERIC_IMPLEMENTATION
#endif
// Unsupported configurations
#if defined(ASM_SUPPORT) && (OS_TARGET == OS_WIN)
#error -- "Assembly is not supported on this platform"
#endif
#if defined(ASM_SUPPORT) && defined(GENERIC_IMPLEMENTATION)
#error -- "Unsupported configuration"
#endif
#if (SIMD_SUPPORT != NO_SIMD_SUPPORT) && defined(GENERIC_IMPLEMENTATION)
#error -- "Unsupported configuration"
#endif
#if (TARGET != TARGET_AMD64) && !defined(GENERIC_IMPLEMENTATION)
#error -- "Unsupported configuration"
#endif
#if (OS_TARGET == OS_LINUX) && defined(ASM_SUPPORT) && (SIMD_SUPPORT != AVX2_SUPPORT)
#error -- "Unsupported configuration"
#endif
// Definitions of the error-handling type and error codes
/*typedef enum {
CRYPTO_MSRLN_SUCCESS, // 0x00
CRYPTO_MSRLN_ERROR, // 0x01
CRYPTO_MSRLN_ERROR_DURING_TEST, // 0x02
CRYPTO_MSRLN_ERROR_UNKNOWN, // 0x03
CRYPTO_MSRLN_ERROR_NOT_IMPLEMENTED, // 0x04
CRYPTO_MSRLN_ERROR_NO_MEMORY, // 0x05
CRYPTO_MSRLN_ERROR_INVALID_PARAMETER, // 0x06
CRYPTO_MSRLN_ERROR_SHARED_KEY, // 0x07
CRYPTO_MSRLN_ERROR_TOO_MANY_ITERATIONS, // 0x08
CRYPTO_MSRLN_ERROR_END_OF_LIST
} CRYPTO_MSRLN_STATUS;
#define CRYPTO_STATUS_TYPE_SIZE (CRYPTO_ERROR_END_OF_LIST)
// Definitions of the error messages
// NOTE: they must match the error codes above
#define CRYPTO_MSG_SUCCESS "CRYPTO_SUCCESS"
#define CRYPTO_MSG_ERROR "CRYPTO_ERROR"
#define CRYPTO_MSG_ERROR_DURING_TEST "CRYPTO_ERROR_DURING_TEST"
#define CRYPTO_MSG_ERROR_UNKNOWN "CRYPTO_ERROR_UNKNOWN"
#define CRYPTO_MSG_ERROR_NOT_IMPLEMENTED "CRYPTO_ERROR_NOT_IMPLEMENTED"
#define CRYPTO_MSG_ERROR_NO_MEMORY "CRYPTO_ERROR_NO_MEMORY"
#define CRYPTO_MSG_ERROR_INVALID_PARAMETER "CRYPTO_ERROR_INVALID_PARAMETER"
#define CRYPTO_MSG_ERROR_SHARED_KEY "CRYPTO_ERROR_SHARED_KEY"
#define CRYPTO_MSG_ERROR_TOO_MANY_ITERATIONS "CRYPTO_ERROR_TOO_MANY_ITERATIONS"
*/
#ifdef __cplusplus
}
#endif
#endif
#ifndef __CRYPTO_COMMON_H__
#define __CRYPTO_COMMON_H__
// For C++
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "dap_common.h"
#include "sha3/fips202.h"
//#include "KeccakHash.h"
//#include "SimpleFIPS202.h"
//#include "SP800-185.h"
#include "rand/dap_rand.h"
// Definition of operating system
#define OS_WIN 1
#define OS_LINUX 2
#define OS_MACOS 3
#if defined(_WIN32) // Microsoft Windows OS
#define OS_TARGET OS_WIN
#elif defined(__linux__) // Linux OS
#define OS_TARGET OS_LINUX
#elif defined(__APPLE__) // MACOS
#define OS_TARGET OS_MACOS
#else
#error -- "Unsupported OS"
#endif
// Definition of compiler
#define COMPILER_VC 1
#define COMPILER_GCC 2
#define COMPILER_CLANG 3
#if defined(_MSC_VER) // Microsoft Visual C compiler
#define COMPILER COMPILER_VC
#elif defined(__GNUC__) // GNU GCC compiler
#define COMPILER COMPILER_GCC
#elif defined(__clang__) // Clang compiler
#define COMPILER COMPILER_CLANG
#else
#error -- "Unsupported COMPILER"
#endif
// Definition of the targeted architecture and basic data types
#define TARGET_AMD64 1
#define TARGET_x86 2
#define TARGET_ARM 3
#define TARGET_ARM64 4
#if (defined(__x86_64__) || defined(__x86_64) || defined(__arch64__) || defined(_M_AMD64) || defined(_M_X64) || defined(_WIN64) || !defined(__LP64__))
#define _AMD64_
#elif (defined(__aarch64__))
#define _ARM64_
#else
#define _X86_
#endif
#if defined(_AMD64_)
#define TARGET TARGET_AMD64
#define RADIX 64
#define LOG2RADIX 6
typedef uint64_t digit_t; // Unsigned 64-bit digit
typedef int64_t sdigit_t; // Signed 64-bit digit
typedef uint32_t hdigit_t; // Unsigned 32-bit digit
#define NWORDS_FIELD 12 // Number of words of a 751-bit field element
#define p751_ZERO_WORDS 5 // Number of "0" digits in the least significant part of p751 + 1
#elif defined(_X86_)
#define TARGET TARGET_x86
#define RADIX 32
#define LOG2RADIX 5
typedef uint32_t digit_t; // Unsigned 32-bit digit
typedef int32_t sdigit_t; // Signed 32-bit digit
typedef uint16_t hdigit_t; // Unsigned 16-bit digit
#define NWORDS_FIELD 24
#define p751_ZERO_WORDS 11
#elif defined(_ARM_)
#define TARGET TARGET_ARM
#define RADIX 32
#define LOG2RADIX 5
typedef uint32_t digit_t; // Unsigned 32-bit digit
typedef int32_t sdigit_t; // Signed 32-bit digit
typedef uint16_t hdigit_t; // Unsigned 16-bit digit
#define NWORDS_FIELD 24
#define p751_ZERO_WORDS 11
#elif defined(_ARM64_)
#define TARGET TARGET_ARM64
#define RADIX 64
#define LOG2RADIX 6
typedef uint64_t digit_t; // Unsigned 64-bit digit
typedef int64_t sdigit_t; // Signed 64-bit digit
typedef uint32_t hdigit_t;
#define NWORDS_FIELD 12
#define p751_ZERO_WORDS 5
#else
#error -- "Unsupported ARCHITECTURE"
#endif
#define RADIX64
// Instruction support
#define NO_SIMD_SUPPORT 0
#define AVX_SUPPORT 1
#define AVX2_SUPPORT 2
#if defined(__AVX2__)
#define SIMD_SUPPORT AVX2_SUPPORT // AVX2 support selection
#elif defined(__AVX__)
#define SIMD_SUPPORT AVX_SUPPORT // AVX support selection
#else
#define SIMD_SUPPORT NO_SIMD_SUPPORT
#endif
#if defined(__ASM__) // Assembly support selection
#define ASM_SUPPORT
#endif
#if (SIMD_SUPPORT == NO_SIMD_SUPPORT) // Selection of generic, portable implementation
#define GENERIC_IMPLEMENTATION
#endif
// Unsupported configurations
#if defined(ASM_SUPPORT) && (OS_TARGET == OS_WIN)
#error -- "Assembly is not supported on this platform"
#endif
#if defined(ASM_SUPPORT) && defined(GENERIC_IMPLEMENTATION)
#error -- "Unsupported configuration"
#endif
#if (SIMD_SUPPORT != NO_SIMD_SUPPORT) && defined(GENERIC_IMPLEMENTATION)
#error -- "Unsupported configuration"
#endif
#if (TARGET != TARGET_AMD64) && !defined(GENERIC_IMPLEMENTATION)
#error -- "Unsupported configuration"
#endif
#if (OS_TARGET == OS_LINUX) && defined(ASM_SUPPORT) && (SIMD_SUPPORT != AVX2_SUPPORT)
#error -- "Unsupported configuration"
#endif
// Definitions of the error-handling type and error codes
/*typedef enum {
CRYPTO_MSRLN_SUCCESS, // 0x00
CRYPTO_MSRLN_ERROR, // 0x01
CRYPTO_MSRLN_ERROR_DURING_TEST, // 0x02
CRYPTO_MSRLN_ERROR_UNKNOWN, // 0x03
CRYPTO_MSRLN_ERROR_NOT_IMPLEMENTED, // 0x04
CRYPTO_MSRLN_ERROR_NO_MEMORY, // 0x05
CRYPTO_MSRLN_ERROR_INVALID_PARAMETER, // 0x06
CRYPTO_MSRLN_ERROR_SHARED_KEY, // 0x07
CRYPTO_MSRLN_ERROR_TOO_MANY_ITERATIONS, // 0x08
CRYPTO_MSRLN_ERROR_END_OF_LIST
} CRYPTO_MSRLN_STATUS;
#define CRYPTO_STATUS_TYPE_SIZE (CRYPTO_ERROR_END_OF_LIST)
// Definitions of the error messages
// NOTE: they must match the error codes above
#define CRYPTO_MSG_SUCCESS "CRYPTO_SUCCESS"
#define CRYPTO_MSG_ERROR "CRYPTO_ERROR"
#define CRYPTO_MSG_ERROR_DURING_TEST "CRYPTO_ERROR_DURING_TEST"
#define CRYPTO_MSG_ERROR_UNKNOWN "CRYPTO_ERROR_UNKNOWN"
#define CRYPTO_MSG_ERROR_NOT_IMPLEMENTED "CRYPTO_ERROR_NOT_IMPLEMENTED"
#define CRYPTO_MSG_ERROR_NO_MEMORY "CRYPTO_ERROR_NO_MEMORY"
#define CRYPTO_MSG_ERROR_INVALID_PARAMETER "CRYPTO_ERROR_INVALID_PARAMETER"
#define CRYPTO_MSG_ERROR_SHARED_KEY "CRYPTO_ERROR_SHARED_KEY"
#define CRYPTO_MSG_ERROR_TOO_MANY_ITERATIONS "CRYPTO_ERROR_TOO_MANY_ITERATIONS"
*/
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <kahovski@gmail.com>
* Anatolii Kurotych <akurotych@gmail.com>
* DeM Labs Inc. https://demlabs.net
* DeM Labs Open source community https://github.com/demlabsinc
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DAP_ENC_H_
#define _DAP_ENC_H_
#include <stddef.h>
#include <stdbool.h>
#include "dap_enc_key.h"
#ifdef __cplusplus
extern "C" {
#endif
int dap_enc_init(void);
void dap_enc_deinit(void);
// if include_base64 == true. Calc out size with base64 encoding
size_t dap_enc_code_out_size(dap_enc_key_t* a_key, const size_t a_buf_in_size, dap_enc_data_type_t type);
size_t dap_enc_decode_out_size(dap_enc_key_t* a_key, const size_t a_buf_in_size, dap_enc_data_type_t type);
size_t dap_enc_code(struct dap_enc_key * a_key, // Key
const void * a_buf_in, const size_t a_buf_in_size, // Input
void * a_buf_out, const size_t a_buf_out_size_max, // Output
dap_enc_data_type_t a_data_type_out); // Output data type
size_t dap_enc_decode(struct dap_enc_key * a_key, // Key
const void * a_buf_in, const size_t a_buf_in_size, // Input
void * a_buf_out, const size_t a_buf_out_size_max, // Output
dap_enc_data_type_t a_data_type_in); // Output data type
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <kahovski@gmail.com>
* Anatolii Kurotych <akurotych@gmail.com>
* DeM Labs Inc. https://demlabs.net
* DeM Labs Open source community https://github.com/demlabsinc
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DAP_ENC_H_
#define _DAP_ENC_H_
#include <stddef.h>
#include <stdbool.h>
#include "dap_enc_key.h"
#ifdef __cplusplus
extern "C" {
#endif
int dap_enc_init(void);
void dap_enc_deinit(void);
// if include_base64 == true. Calc out size with base64 encoding
size_t dap_enc_code_out_size(dap_enc_key_t* a_key, const size_t a_buf_in_size, dap_enc_data_type_t type);
size_t dap_enc_decode_out_size(dap_enc_key_t* a_key, const size_t a_buf_in_size, dap_enc_data_type_t type);
size_t dap_enc_code(struct dap_enc_key * a_key, // Key
const void * a_buf_in, const size_t a_buf_in_size, // Input
void * a_buf_out, const size_t a_buf_out_size_max, // Output
dap_enc_data_type_t a_data_type_out); // Output data type
size_t dap_enc_decode(struct dap_enc_key * a_key, // Key
const void * a_buf_in, const size_t a_buf_in_size, // Input
void * a_buf_out, const size_t a_buf_out_size_max, // Output
dap_enc_data_type_t a_data_type_in); // Output data type
#ifdef __cplusplus
}
#endif
#endif
#ifndef _DAP_ENC_GOST_H_
#define _DAP_ENC_GOST_H_
#include <stddef.h>
#include "dap_enc_key.h"
#include "GOST/block_chipher.h"
#ifdef __cplusplus
extern "C" {
#endif
void dap_enc_gost_key_delete(struct dap_enc_key *a_key);
void dap_enc_gost_key_generate(struct dap_enc_key * a_key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size, size_t key_size);
//------GOST_OFB---------
void dap_enc_gost_ofb_key_new(struct dap_enc_key * a_key);
size_t dap_enc_gost_ofb_calc_decode_size(const size_t size_in);
size_t dap_enc_gost_ofb_calc_encode_size(const size_t size_in);
size_t dap_enc_gost_ofb_decrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
size_t dap_enc_gost_ofb_encrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_gost_ofb_decrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_gost_ofb_encrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
//------KUZNECHIK_OFB--------------
void dap_enc_kuzn_ofb_key_new(struct dap_enc_key * a_key);
size_t dap_enc_kuzn_ofb_calc_decode_size(const size_t size_in);
size_t dap_enc_kuzn_ofb_calc_encode_size(const size_t size_in);
size_t dap_enc_kuzn_ofb_decrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
size_t dap_enc_kuzn_ofb_encrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_kuzn_ofb_decrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_kuzn_ofb_encrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <kahovski@gmail.com>
* DeM Labs Inc. https://demlabs.net
* Kelvin Blockchain community https://github.com/kelvinblockchain
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DAP_ENC_BASE64_H_
#define _DAP_ENC_BASE64_H_
#include <stddef.h>
#include <stdint.h>
#include "dap_enc_key.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Calculates encode size from input size
*/
#define DAP_ENC_BASE58_ENCODE_SIZE(a_in_size) ( (size_t) ((137 * a_in_size / 100)+2))
#define DAP_ENC_BASE58_DECODE_SIZE(a_in_size) ( (size_t) ( 2 * a_in_size +1) )
size_t dap_enc_base58_encode(const void * a_in, size_t a_in_size, char * a_out);
size_t dap_enc_base58_decode(const char * a_in, void * a_out);
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <kahovski@gmail.com>
* DeM Labs Inc. https://demlabs.net
* CellFrame https://cellframe.net
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DAP_ENC_BASE58_H_
#define _DAP_ENC_BASE58_H_
#include <stddef.h>
#include <stdint.h>
#include "dap_enc_key.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Calculates encode size from input size
*/
#define DAP_ENC_BASE58_ENCODE_SIZE(a_in_size) ( (size_t) ((137 * a_in_size / 100)+2))
#define DAP_ENC_BASE58_DECODE_SIZE(a_in_size) ( (size_t) ( 2 * a_in_size +1) )
size_t dap_enc_base58_encode(const void * a_in, size_t a_in_size, char * a_out);
size_t dap_enc_base58_decode(const char * a_in, void * a_out);
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <kahovski@gmail.com>
* Anatolii Kurotych <akurotych@gmail.com>
* DeM Labs Inc. https://demlabs.net
* DeM Labs Open source community https://github.com/demlabsinc
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DAP_ENC_BASE64_H_
#define _DAP_ENC_BASE64_H_
#include <stddef.h>
#include "dap_enc_key.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Calculates encode size from input size
*/
#define DAP_ENC_BASE64_ENCODE_SIZE(in_size) (size_t)(((4 * in_size / 3) + 3) & ~3)
size_t dap_enc_base64_decode(const char * in, size_t in_size, void * out, dap_enc_data_type_t standard);
size_t dap_enc_base64_encode(const void * in, size_t in_size, char * out, dap_enc_data_type_t standard);
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <kahovski@gmail.com>
* Anatolii Kurotych <akurotych@gmail.com>
* DeM Labs Inc. https://demlabs.net
* DeM Labs Open source community https://github.com/demlabsinc
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DAP_ENC_BASE64_H_
#define _DAP_ENC_BASE64_H_
#include <stddef.h>
#include "dap_enc_key.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Calculates encode size from input size
*/
#define DAP_ENC_BASE64_ENCODE_SIZE(in_size) (size_t)(((4 * in_size / 3) + 3) & ~3)
size_t dap_enc_base64_decode(const char * in, size_t in_size, void * out, dap_enc_data_type_t standard);
size_t dap_enc_base64_encode(const void * in, size_t in_size, char * out, dap_enc_data_type_t standard);
#ifdef __cplusplus
}
#endif
#endif
#ifndef _DAP_ENC_BF_H_
#define _DAP_ENC_BF_H_
#include <stddef.h>
#include "dap_enc_key.h"
#include"blowfish/blowfish.h"
#ifdef __cplusplus
extern "C" {
#endif
void dap_enc_bf_key_delete(struct dap_enc_key *a_key);
void dap_enc_bf_key_generate(struct dap_enc_key * a_key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size, size_t key_size);
//-----CBC----------
void dap_enc_bf_cbc_key_new(struct dap_enc_key * a_key);
size_t dap_enc_bf_cbc_calc_decode_size(const size_t size_in);
size_t dap_enc_bf_cbc_calc_encode_size(const size_t size_in);
size_t dap_enc_bf_cbc_decrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
size_t dap_enc_bf_cbc_encrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_bf_cbc_decrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_bf_cbc_encrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
//------OFB---------
void dap_enc_bf_ofb_key_new(struct dap_enc_key * a_key);
size_t dap_enc_bf_ofb_calc_decode_size(const size_t size_in);
size_t dap_enc_bf_ofb_calc_encode_size(const size_t size_in);
size_t dap_enc_bf_ofb_decrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
size_t dap_enc_bf_ofb_encrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_bf_ofb_decrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_bf_ofb_encrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
#ifdef __cplusplus
}
#endif
#endif
#pragma once
#include "sig_bliss/bliss_b_params.h"
#include "dap_enc_key.h"
enum DAP_BLISS_SIGN_SECURITY {
TOY = 0, MAX_SPEED, MIN_SIZE, SPEED_AND_SECURITY, MAX_SECURITY
};
void dap_enc_sig_bliss_set_type(enum DAP_BLISS_SIGN_SECURITY type);
void dap_enc_sig_bliss_key_new(struct dap_enc_key *key);
void dap_enc_sig_bliss_key_new_generate(struct dap_enc_key * key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size,
size_t key_size);
int dap_enc_sig_bliss_get_sign(struct dap_enc_key * key,const void * msg,
const size_t msg_size, void * signature, const size_t signature_size);
int dap_enc_sig_bliss_verify_sign(struct dap_enc_key * key,const void * msg,
const size_t msg_size, void * signature, const size_t signature_size);
void dap_enc_sig_bliss_key_delete(struct dap_enc_key *key);
size_t dap_enc_sig_bliss_key_pub_output_size(struct dap_enc_key *l_key);
int dap_enc_sig_bliss_key_pub_output(struct dap_enc_key *l_key, void * l_output);
uint8_t* dap_enc_sig_bliss_write_signature(bliss_signature_t* a_sign, size_t *a_sign_out);
bliss_signature_t* dap_enc_sig_bliss_read_signature(uint8_t *a_buf, size_t a_buflen);
uint8_t* dap_enc_sig_bliss_write_private_key(const bliss_private_key_t* a_private_key, size_t *a_buflen_out);
uint8_t* dap_enc_sig_bliss_write_public_key(const bliss_public_key_t* a_public_key, size_t *a_buflen_out);
bliss_private_key_t* dap_enc_sig_bliss_read_private_key(uint8_t *a_buf, size_t a_buflen);
bliss_public_key_t* dap_enc_sig_bliss_read_public_key(const uint8_t *a_buf, size_t a_buflen);
#pragma once
#include "sig_bliss/bliss_b_params.h"
#include "dap_enc_key.h"
enum DAP_BLISS_SIGN_SECURITY {
TOY = 0, MAX_SPEED, MIN_SIZE, SPEED_AND_SECURITY, MAX_SECURITY
};
void dap_enc_sig_bliss_set_type(enum DAP_BLISS_SIGN_SECURITY type);
void dap_enc_sig_bliss_key_new(struct dap_enc_key *key);
void dap_enc_sig_bliss_key_new_generate(struct dap_enc_key * key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size,
size_t key_size);
int dap_enc_sig_bliss_get_sign(struct dap_enc_key * key,const void * msg,
const size_t msg_size, void * signature, const size_t signature_size);
int dap_enc_sig_bliss_verify_sign(struct dap_enc_key * key,const void * msg,
const size_t msg_size, void * signature, const size_t signature_size);
void dap_enc_sig_bliss_key_delete(struct dap_enc_key *key);
size_t dap_enc_sig_bliss_key_pub_output_size(struct dap_enc_key *l_key);
int dap_enc_sig_bliss_key_pub_output(struct dap_enc_key *l_key, void * l_output);
uint8_t* dap_enc_sig_bliss_write_signature(bliss_signature_t* a_sign, size_t *a_sign_out);
bliss_signature_t* dap_enc_sig_bliss_read_signature(const uint8_t *a_buf, size_t a_buflen);
uint8_t* dap_enc_sig_bliss_write_private_key(const bliss_private_key_t* a_private_key, size_t *a_buflen_out);
uint8_t* dap_enc_sig_bliss_write_public_key(const bliss_public_key_t* a_public_key, size_t *a_buflen_out);
bliss_private_key_t* dap_enc_sig_bliss_read_private_key(const uint8_t *a_buf, size_t a_buflen);
bliss_public_key_t* dap_enc_sig_bliss_read_public_key(const uint8_t *a_buf, size_t a_buflen);
#pragma once
typedef struct dap_enc_ca {
} dap_enc_ca_t;
#pragma once
typedef struct dap_enc_ca {
} dap_enc_ca_t;
#ifndef _DAP_ENC_DEFEO_H_
#define _DAP_ENC_DEFEO_H_
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "dap_common.h"
#include "dap_enc_key.h"
struct dap_enc_key;
typedef struct dap_enc_defeo_key{
unsigned int alice_msg_len;
unsigned int bob_msg_len;
unsigned int key_len;
uint16_t estimated_classical_security;
uint16_t estimated_quantum_security;
} dap_enc_defeo_key_t;
#define LOG_TAG "dap_enc_defeo"
#define DAP_ENC_DEFEO_KEY(a) ((dap_enc_defeo_key_t *)((a)->_inheritor))
void dap_enc_defeo_key_new(struct dap_enc_key* a_key);
void dap_enc_defeo_key_new_generate(struct dap_enc_key * a_key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size,
size_t key_size);
void dap_enc_defeo_key_new_from_data(struct dap_enc_key* a_key, void **a_priv, size_t a_in_size);
void dap_enc_defeo_key_delete(struct dap_enc_key* a_key);
size_t dap_enc_defeo_gen_bob_shared_key(struct dap_enc_key* b_key, const void* a_pub, size_t a_pub_size, void **b_pub);
size_t dap_enc_defeo_gen_alice_shared_key(struct dap_enc_key* a_key, const void* a_priv, size_t b_pub_size, unsigned char * b_pub);
#endif
#ifndef _DAP_ENC_DEFEO_H_
#define _DAP_ENC_DEFEO_H_
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "dap_common.h"
#include "dap_enc_key.h"
struct dap_enc_key;
typedef struct dap_enc_defeo_key{
unsigned int alice_msg_len;
unsigned int bob_msg_len;
unsigned int key_len;
uint16_t estimated_classical_security;
uint16_t estimated_quantum_security;
} dap_enc_defeo_key_t;
#define LOG_TAG "dap_enc_defeo"
#define DAP_ENC_DEFEO_KEY(a) ((dap_enc_defeo_key_t *)((a)->_inheritor))
void dap_enc_defeo_key_new(struct dap_enc_key* a_key);
void dap_enc_defeo_key_new_generate(struct dap_enc_key * a_key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size,
size_t key_size);
void dap_enc_defeo_key_new_from_data(struct dap_enc_key* a_key, void **a_priv, size_t a_in_size);
void dap_enc_defeo_key_delete(struct dap_enc_key* a_key);
size_t dap_enc_defeo_gen_bob_shared_key(struct dap_enc_key* b_key, const void* a_pub, size_t a_pub_size, void **b_pub);
size_t dap_enc_defeo_gen_alice_shared_key(struct dap_enc_key* a_key, const void* a_priv, size_t b_pub_size, unsigned char * b_pub);
#endif
#ifndef _DAP_ENC_DILITHIUM_H_
#define _DAP_ENC_DILITHIUM_H_
#include "sig_dilithium/dilithium_params.h"
#include "dap_enc_key.h"
enum DAP_DILITHIUM_SIGN_SECURITY {
DILITHIUM_TOY = 0, DILITHIUM_MAX_SPEED, DILITHIUM_MIN_SIZE, DILITHIUM_MAX_SECURITY
};
void dap_enc_sig_dilithium_set_type(enum DAP_DILITHIUM_SIGN_SECURITY type);
void dap_enc_sig_dilithium_key_new(struct dap_enc_key *key);
void dap_enc_sig_dilithium_key_new_generate(struct dap_enc_key * key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size,
size_t key_size);
size_t dap_enc_sig_dilithium_get_sign(struct dap_enc_key * key,const void * msg,
const size_t msg_size, void * signature, const size_t signature_size);
size_t dap_enc_sig_dilithium_verify_sign(struct dap_enc_key * key,const void * msg,
const size_t msg_size, void * signature, const size_t signature_size);
void dap_enc_sig_dilithium_key_delete(struct dap_enc_key * key);
size_t dap_enc_dilithium_calc_signature_size(void);
uint8_t* dap_enc_dilithium_write_signature(dilithium_signature_t* a_sign, size_t *a_sign_out);
dilithium_signature_t* dap_enc_dilithium_read_signature(uint8_t *a_buf, size_t a_buflen);
uint8_t* dap_enc_dilithium_write_private_key(const dilithium_private_key_t* a_private_key, size_t *a_buflen_out);
uint8_t* dap_enc_dilithium_write_public_key(const dilithium_public_key_t* a_public_key, size_t *a_buflen_out);
dilithium_private_key_t* dap_enc_dilithium_read_private_key(const uint8_t *a_buf, size_t a_buflen);
dilithium_public_key_t* dap_enc_dilithium_read_public_key(const uint8_t *a_buf, size_t a_buflen);
#endif
#ifndef _DAP_ENC_DILITHIUM_H_
#define _DAP_ENC_DILITHIUM_H_
#include "sig_dilithium/dilithium_params.h"
#include "dap_enc_key.h"
enum DAP_DILITHIUM_SIGN_SECURITY {
DILITHIUM_TOY = 0, DILITHIUM_MAX_SPEED, DILITHIUM_MIN_SIZE, DILITHIUM_MAX_SECURITY
};
void dap_enc_sig_dilithium_set_type(enum DAP_DILITHIUM_SIGN_SECURITY type);
void dap_enc_sig_dilithium_key_new(struct dap_enc_key *key);
void dap_enc_sig_dilithium_key_new_generate(struct dap_enc_key * key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size,
size_t key_size);
size_t dap_enc_sig_dilithium_get_sign(struct dap_enc_key * key,const void * msg,
const size_t msg_size, void * signature, const size_t signature_size);
size_t dap_enc_sig_dilithium_verify_sign(struct dap_enc_key * key,const void * msg,
const size_t msg_size, void * signature, const size_t signature_size);
void dap_enc_sig_dilithium_key_delete(struct dap_enc_key * key);
size_t dap_enc_dilithium_calc_signature_unserialized_size(void);
static inline size_t dap_enc_dilithium_calc_signagture_size(dilithium_signature_t* a_sign)
{
return sizeof(size_t) + sizeof(dilithium_kind_t) + a_sign->sig_len + sizeof(unsigned long long);
}
uint8_t* dap_enc_dilithium_write_signature(dilithium_signature_t* a_sign, size_t *a_sign_out);
dilithium_signature_t* dap_enc_dilithium_read_signature(uint8_t *a_buf, size_t a_buflen);
uint8_t* dap_enc_dilithium_write_private_key(const dilithium_private_key_t* a_private_key, size_t *a_buflen_out);
uint8_t* dap_enc_dilithium_write_public_key(const dilithium_public_key_t* a_public_key, size_t *a_buflen_out);
dilithium_private_key_t* dap_enc_dilithium_read_private_key(const uint8_t *a_buf, size_t a_buflen);
dilithium_public_key_t* dap_enc_dilithium_read_public_key(const uint8_t *a_buf, size_t a_buflen);
#endif
#ifndef _DAP_ENC_AES_H_
#define _DAP_ENC_AES_H_
#include <stddef.h>
#include <stdint.h>
#include "iaes/dap_iaes_proto.h"
#ifdef __cplusplus
extern "C" {
#endif
struct dap_enc_key;
void dap_enc_aes_key_new(struct dap_enc_key * a_key);
void dap_enc_aes_key_delete(struct dap_enc_key *a_key);
void dap_enc_aes_key_generate(struct dap_enc_key * a_key, const void *kex_buf, size_t kex_size,
const void * seed, size_t seed_size, size_t key_size);
size_t dap_enc_iaes256_calc_decode_size(const size_t size_in);
size_t dap_enc_iaes256_calc_encode_size(const size_t size_in);
size_t dap_enc_iaes256_cbc_decrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
size_t dap_enc_iaes256_cbc_encrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_iaes256_cbc_decrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
// if "a_in size mod IAES_BLOCK_SIZE = 0" encryption will be faster
size_t dap_enc_iaes256_cbc_encrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
#ifdef __cplusplus
}
#endif
#endif
#ifndef _DAP_ENC_AES_H_
#define _DAP_ENC_AES_H_
#include <stddef.h>
#include <stdint.h>
#include "iaes/dap_iaes_proto.h"
#ifdef __cplusplus
extern "C" {
#endif
struct dap_enc_key;
void dap_enc_aes_key_new(struct dap_enc_key * a_key);
void dap_enc_aes_key_delete(struct dap_enc_key *a_key);
void dap_enc_aes_key_generate(struct dap_enc_key * a_key, const void *kex_buf, size_t kex_size,
const void * seed, size_t seed_size, size_t key_size);
size_t dap_enc_iaes256_calc_decode_max_size(const size_t size_in);
size_t dap_enc_iaes256_calc_encode_size(const size_t size_in);
size_t dap_enc_iaes256_cbc_decrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
size_t dap_enc_iaes256_cbc_encrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_iaes256_cbc_decrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
// if "a_in size mod IAES_BLOCK_SIZE = 0" encryption will be faster
size_t dap_enc_iaes256_cbc_encrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <kahovski@gmail.com>
* Anatolii Kurotych <akurotych@gmail.com>
* DeM Labs Inc. https://demlabs.net
* DeM Labs Open source community https://github.com/demlabsinc
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DAP_ENC_KEY_H_
#define _DAP_ENC_KEY_H_
#include <stddef.h>
#include <time.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum dap_enc_data_type{DAP_ENC_DATA_TYPE_RAW,
DAP_ENC_DATA_TYPE_B64,
DAP_ENC_DATA_TYPE_B64_URLSAFE,
} dap_enc_data_type_t;
typedef enum dap_enc_key_type{ DAP_ENC_KEY_TYPE_IAES, // Symmetric AES
DAP_ENC_KEY_TYPE_OAES,// from https://github.com/monero-project/monero/tree/master/src/crypto
DAP_ENC_KEY_TYPE_RLWE_NEWHOPE, // "NewHope": key exchange from the ring learning with errors problem
// (Alkim, Ducas, Pöppelmann, Schwabe, USENIX Security 2016 )
// Using the reference C implementation of NewHope
// from https://github.com/tpoeppelmann/newhop
// https://eprint.iacr.org/2015/1092
DAP_ENC_KEY_TYPE_SIDH_CLN16 , // Key exchange from the supersingular isogeny Diffie-Hellman problem
// (Costello, Naehrig, Longa, CRYPTO 2016, https://eprint.iacr.org/2016/413)
// using the implementation of Microsoft Research
// https://www.microsoft.com/en-us/research/project/sidh-library/
DAP_ENC_KEY_TYPE_DEFEO , // Key exchange from the supersingular isogeny Diffie-Hellman problem
DAP_ENC_KEY_TYPE_MSRLN,
DAP_ENC_KEY_TYPE_RLWE_MSRLN16,
//DAP_ENC_KEY_TYPE_RLWE_MSRLN16, // Microsoft Research implementation of Peikert's ring-LWE key exchange
// (Longa, Naehrig, CANS 2016, https://eprint.iacr.org/2016/504)
// based on the implementation of Alkim, Ducas, Pöppelmann, and Schwabe,
// with improvements from Longa and Naehrig,
// https://www.microsoft.com/en-us/research/project/lattice-cryptography-library/
DAP_ENC_KEY_TYPE_RLWE_BCNS15, // key exchange from the ring learning with errors problem
// (Bos, Costello, Naehrig, Stebila,
// IEEE Symposium on Security & Privacy 2015,
// https://eprint.iacr.org/2014/599)
DAP_ENC_KEY_TYPE_LWE_FRODO , // "Frodo": key exchange from the learning with errors problem
// Bos, Costello, Ducas, Mironov, Naehrig, Nikolaenko, Raghunathan, Stebila
// ACM Conference on Computer and Communications Security 2016
// https://eprint.iacr.org/2016/659
DAP_ENC_KEY_TYPE_SIDH_IQC_REF, // key exchange from the supersingular isogeny Diffie-Hellman problem
// (De Feo, Jao, Plût, J. Math. Cryptol. 8(3):209, 2014
// https://eprint.iacr.org/2011/506
//
DAP_ENC_KEY_TYPE_CODE_MCBITS, // "McBits": key exchange from the error correcting codes,
// specifically Niederreiter's form of McEliece public key encryption
// using hidden Goppa codes (Bernstein, Chou, Schwabe, CHES 2013, https://eprint.iacr.org/2015/610)
// using the implementation of McBits from https://www.win.tue.nl/~tchou/mcbits/
DAP_ENC_KEY_TYPE_NTRU, // NTRU: key transport using NTRU public key encryption
// (Hoffstein, Pipher, Silverman, ANTS 1998) with the EES743EP1 parameter set
// wrapper around the implementation from the NTRU Open Source project
// https://github.com/NTRUOpenSourceProject/NTRUEncrypt)
DAP_ENC_KEY_TYPE_MLWE_KYBER, // Kyber: a CCA-secure module-lattice-based key exchange mechanism
// (Bos, Ducas, Kiltz, Lepoint, Lyubashevsky, Schwabe, Shanck, Stehlé)
// Real World Crypto 2017, https://eprint.iacr.org/2017/634)
// using the reference C implementation of Kyber from pq-crystals/kyber
DAP_ENC_KEY_TYPE_SIG_PICNIC, // signature based on zero-knowledge proof as specified in
// Post-Quantum Zero-Knowledge and Signatures from Symmetric-Key Primitives
// (Melissa Chase and David Derler and Steven Goldfeder and Claudio Orlandi
// and Sebastian Ramacher and Christian Rechberger and Daniel Slamanig and Greg Zaverucha
// https://eprint.iacr.org/2017/279.pdf), using the optimized implemenation
// from https://github.com/IAIK/Picnic
DAP_ENC_KEY_TYPE_SIG_BLISS, // signature based on zero-knowledge proof as specified in
// Post-Quantum Zero-Knowledge and Signatures from Symmetric-Key Primitives
DAP_ENC_KEY_TYPE_SIG_TESLA, // signature based on Ring_LWE problem with zero-knowledge proof as specified in
// Post-Quantum Zero-Knowledge and Signatures from Symmetric-Key Primitives
DAP_ENC_KEY_TYPE_SIG_DILITHIUM,
DAP_ENC_KEY_TYPE_NULL = 0
} dap_enc_key_type_t;
struct dap_enc_key;
// allocates memory and sets callbacks
typedef void (*dap_enc_callback_new)(struct dap_enc_key*);
// generates key data from seed
typedef void (*dap_enc_callback_new_generate)(struct dap_enc_key* key, const void *kex_buf,
size_t kex_size, const void* seed, size_t seed_size,
size_t key_size);
// free memory
typedef void (*dap_enc_callback_delete)(struct dap_enc_key*);
typedef size_t (*dap_enc_callback_key_size_t)(struct dap_enc_key*);
// encrypt and decrypt functions. Allocates Memory for out
typedef size_t (*dap_enc_callback_dataop_t)(struct dap_enc_key *key, const void *in,
const size_t in_size,void ** out);
typedef size_t (*dap_enc_callback_dataop_na_t)(struct dap_enc_key *key, const void *in,
const size_t in_size,void * out, const size_t out_size_max);
typedef int (*dap_enc_callback_sign_op_t)(struct dap_enc_key *key, const void *in,
const size_t in_size,void * out, const size_t out_size_max);
// key pair generation and generation of shared key at Bob's side
// INPUT:
// dap_enc_key *b_key
// a_pub --- Alice's public key
// a_pub_size --- Alice's public key length
// OUTPUT:
// b_pub --- Bob's public key
// b_key->priv_key_data --- shared key
// b_key->priv_key_data_size --- shared key length
typedef size_t (*dap_enc_gen_bob_shared_key) (struct dap_enc_key *b_key, const void *a_pub,
size_t a_pub_size, void ** b_pub);
// generation of shared key at Alice's side
// INPUT:
// dap_enc_key *a_key
// a_priv --- Alice's private key
// b_pub --- Bob's public key
// b_pub_size --- Bob public key size
// OUTPUT:
// a_key->priv_key_data --- shared key
// a_key->priv_key_data_size --- shared key length
typedef size_t (*dap_enc_gen_alice_shared_key) (struct dap_enc_key *a_key, const void *a_priv,
size_t b_pub_size, unsigned char *b_pub);
typedef int (*dap_enc_callback_gen_key_public_t ) (struct dap_enc_key *l_key, void * l_output);
typedef void (*dap_enc_callback_ptr_t)(struct dap_enc_key *, void *);
typedef size_t (*dap_enc_callback_pptr_r_size_t)(struct dap_enc_key *, void **);
typedef void (*dap_enc_callback_data_t)(struct dap_enc_key *, const void * , size_t);
typedef void (*dap_enc_callback_size_t)(struct dap_enc_key *, size_t);
typedef void (*dap_enc_callback_str_t)(struct dap_enc_key *, const char*);
typedef char* (*dap_enc_callback_r_str_t)(struct dap_enc_key *);
typedef size_t (*dap_enc_callback_calc_out_size)(const size_t);
typedef struct dap_enc_key {
size_t priv_key_data_size;
//unsigned char * priv_key_data; // can be shared key in assymetric alghoritms
void * priv_key_data; // can be shared key in assymetric alghoritms or secret key in signature alghoritms
size_t pub_key_data_size;
//unsigned char * pub_key_data; // can be null if enc symmetric
void * pub_key_data; // can be null if enc symmetric
time_t last_used_timestamp;
dap_enc_key_type_t type;
dap_enc_callback_dataop_t enc;
dap_enc_callback_dataop_t dec;
dap_enc_callback_dataop_na_t enc_na;
dap_enc_callback_dataop_na_t dec_na;
dap_enc_callback_sign_op_t sign_get;
dap_enc_callback_sign_op_t sign_verify;
dap_enc_gen_alice_shared_key gen_alice_shared_key;
dap_enc_gen_bob_shared_key gen_bob_shared_key;
void * _inheritor; // WARNING! Inheritor must have only serealizeble/deserializeble data (copy)
size_t _inheritor_size;
} dap_enc_key_t;
#define MAX_ENC_KEY_SIZE 16384
#define MAX_INHERITOR_SIZE 2048
// struct for serelization/deseralization keys in binary storage
typedef struct dap_enc_key_serealize {
size_t priv_key_data_size;
size_t pub_key_data_size;
size_t inheritor_size;
time_t last_used_timestamp;
dap_enc_key_type_t type;
unsigned char priv_key_data[MAX_ENC_KEY_SIZE];
unsigned char pub_key_data[MAX_ENC_KEY_SIZE];
unsigned char inheritor[MAX_INHERITOR_SIZE];
} dap_enc_key_serealize_t;
int dap_enc_key_init(void);
void dap_enc_key_deinit(void);
size_t dap_enc_key_get_enc_size(dap_enc_key_t * a_key, const size_t buf_in_size);
size_t dap_enc_key_get_dec_size(dap_enc_key_t * a_key, const size_t buf_in_size);
uint8_t* dap_enc_key_serealize_sign(dap_enc_key_type_t a_key_type, uint8_t *a_sign, size_t *a_sign_len);
uint8_t* dap_enc_key_deserealize_sign(dap_enc_key_type_t a_key_type, uint8_t *a_sign, size_t *a_sign_len);
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);
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);
// allocate memory for key struct
dap_enc_key_t *dap_enc_key_new(dap_enc_key_type_t a_key_type);
// default gen key
dap_enc_key_t *dap_enc_key_new_generate(dap_enc_key_type_t key_type, const void *kex_buf,
size_t kex_size, const void* seed,
size_t seed_size, size_t key_size);
// update struct dap_enc_key_t after insert foreign keys
void dap_enc_key_update(dap_enc_key_t *a_key);
// for asymmetric gen public key
dap_enc_key_t *dap_enc_gen_pub_key_from_priv(struct dap_enc_key *a_key, void **priv_key, size_t *alice_msg_len);
size_t dap_enc_gen_key_public_size (dap_enc_key_t *a_key);
int dap_enc_gen_key_public (dap_enc_key_t *a_key, void * a_output);
void dap_enc_key_signature_delete(dap_enc_key_type_t a_key_type, uint8_t *a_sig_buf);
void dap_enc_key_delete(dap_enc_key_t * a_key);
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy A. Gearasimov <kahovski@gmail.com>
* Anatolii Kurotych <akurotych@gmail.com>
* DeM Labs Inc. https://demlabs.net
* DeM Labs Open source community https://github.com/demlabsinc
* Copyright (c) 2017-2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DAP_ENC_KEY_H_
#define _DAP_ENC_KEY_H_
#include <stddef.h>
#include <time.h>
#include <stdint.h>
#include "dap_common.h"
typedef enum dap_enc_data_type{DAP_ENC_DATA_TYPE_RAW,
DAP_ENC_DATA_TYPE_B64,
DAP_ENC_DATA_TYPE_B64_URLSAFE,
} dap_enc_data_type_t;
typedef enum dap_enc_key_type{
DAP_ENC_KEY_TYPE_IAES, // Symmetric AES
DAP_ENC_KEY_TYPE_OAES,// from https://github.com/monero-project/monero/tree/master/src/crypto
DAP_ENC_KEY_TYPE_BF_CBC,// BlowFish CBCmode
DAP_ENC_KEY_TYPE_BF_OFB,//BlowFish OFBmode
DAP_ENC_KEY_TYPE_GOST_OFB,//GOST28147_89
DAP_ENC_KEY_TYPE_KUZN_OFB,//GOST28147_14
DAP_ENC_KEY_TYPE_SALSA2012,//SALSA2012//http://www.ecrypt.eu.org/stream/salsa20pf.html//https://ianix.com/pub/salsa20-deployment.html
DAP_ENC_KEY_TYPE_RLWE_NEWHOPE, // "NewHope": key exchange from the ring learning with errors problem
// (Alkim, Ducas, Pöppelmann, Schwabe, USENIX Security 2016 )
// Using the reference C implementation of NewHope
// from https://github.com/tpoeppelmann/newhop
// https://eprint.iacr.org/2015/1092
DAP_ENC_KEY_TYPE_SIDH_CLN16 , // Key exchange from the supersingular isogeny Diffie-Hellman problem
// (Costello, Naehrig, Longa, CRYPTO 2016, https://eprint.iacr.org/2016/413)
// using the implementation of Microsoft Research
// https://www.microsoft.com/en-us/research/project/sidh-library/
DAP_ENC_KEY_TYPE_DEFEO , // Key exchange from the supersingular isogeny Diffie-Hellman problem
DAP_ENC_KEY_TYPE_MSRLN,
DAP_ENC_KEY_TYPE_RLWE_MSRLN16,
//DAP_ENC_KEY_TYPE_RLWE_MSRLN16, // Microsoft Research implementation of Peikert's ring-LWE key exchange
// (Longa, Naehrig, CANS 2016, https://eprint.iacr.org/2016/504)
// based on the implementation of Alkim, Ducas, Pöppelmann, and Schwabe,
// with improvements from Longa and Naehrig,
// https://www.microsoft.com/en-us/research/project/lattice-cryptography-library/
DAP_ENC_KEY_TYPE_RLWE_BCNS15, // key exchange from the ring learning with errors problem
// (Bos, Costello, Naehrig, Stebila,
// IEEE Symposium on Security & Privacy 2015,
// https://eprint.iacr.org/2014/599)
DAP_ENC_KEY_TYPE_LWE_FRODO , // "Frodo": key exchange from the learning with errors problem
// Bos, Costello, Ducas, Mironov, Naehrig, Nikolaenko, Raghunathan, Stebila
// ACM Conference on Computer and Communications Security 2016
// https://eprint.iacr.org/2016/659
DAP_ENC_KEY_TYPE_SIDH_IQC_REF, // key exchange from the supersingular isogeny Diffie-Hellman problem
// (De Feo, Jao, Plût, J. Math. Cryptol. 8(3):209, 2014
// https://eprint.iacr.org/2011/506
//
DAP_ENC_KEY_TYPE_CODE_MCBITS, // "McBits": key exchange from the error correcting codes,
// specifically Niederreiter's form of McEliece public key encryption
// using hidden Goppa codes (Bernstein, Chou, Schwabe, CHES 2013, https://eprint.iacr.org/2015/610)
// using the implementation of McBits from https://www.win.tue.nl/~tchou/mcbits/
DAP_ENC_KEY_TYPE_NTRU, // NTRU: key transport using NTRU public key encryption
// (Hoffstein, Pipher, Silverman, ANTS 1998) with the EES743EP1 parameter set
// wrapper around the implementation from the NTRU Open Source project
// https://github.com/NTRUOpenSourceProject/NTRUEncrypt)
DAP_ENC_KEY_TYPE_MLWE_KYBER, // Kyber: a CCA-secure module-lattice-based key exchange mechanism
// (Bos, Ducas, Kiltz, Lepoint, Lyubashevsky, Schwabe, Shanck, Stehlé)
// Real World Crypto 2017, https://eprint.iacr.org/2017/634)
// using the reference C implementation of Kyber from pq-crystals/kyber
DAP_ENC_KEY_TYPE_SIG_PICNIC, // signature based on zero-knowledge proof as specified in
// Post-Quantum Zero-Knowledge and Signatures from Symmetric-Key Primitives
// (Melissa Chase and David Derler and Steven Goldfeder and Claudio Orlandi
// and Sebastian Ramacher and Christian Rechberger and Daniel Slamanig and Greg Zaverucha
// https://eprint.iacr.org/2017/279.pdf), using the optimized implemenation
// from https://github.com/IAIK/Picnic
DAP_ENC_KEY_TYPE_SIG_BLISS, // signature based on zero-knowledge proof as specified in
// Post-Quantum Zero-Knowledge and Signatures from Symmetric-Key Primitives
DAP_ENC_KEY_TYPE_SIG_TESLA, // signature based on Ring_LWE problem with zero-knowledge proof as specified in
// Post-Quantum Zero-Knowledge and Signatures from Symmetric-Key Primitives
DAP_ENC_KEY_TYPE_SIG_DILITHIUM,
DAP_ENC_KEY_TYPE_SIG_RINGCT20,//ring signature for confidentional transaction
DAP_ENC_KEY_TYPE_NULL = 0
} dap_enc_key_type_t;
struct dap_enc_key;
// allocates memory and sets callbacks
typedef void (*dap_enc_callback_new)(struct dap_enc_key*);
// generates key data from seed
typedef void (*dap_enc_callback_new_generate)(struct dap_enc_key* key, const void *kex_buf,
size_t kex_size, const void* seed, size_t seed_size,
size_t key_size);
// free memory
typedef void (*dap_enc_callback_delete)(struct dap_enc_key*);
typedef size_t (*dap_enc_callback_key_size_t)(struct dap_enc_key*);
// encrypt and decrypt functions. Allocates Memory for out
typedef size_t (*dap_enc_callback_dataop_t)(struct dap_enc_key *key, const void *in,
const size_t in_size,void ** out);
typedef size_t (*dap_enc_callback_dataop_na_t)(struct dap_enc_key *key, const void *in,
const size_t in_size,void * out, const size_t out_size_max);
typedef size_t (*dap_enc_callback_dataop_na_ext_t)(struct dap_enc_key *key, const void *in,
const size_t in_size,void * out, const size_t out_size_max, const void *extra_param, const int extra_param_len);
typedef int (*dap_enc_callback_sign_op_t)(struct dap_enc_key *key, const void *in,
const size_t in_size,void * out, const size_t out_size_max);
// key pair generation and generation of shared key at Bob's side
// INPUT:
// dap_enc_key *b_key
// a_pub --- Alice's public key
// a_pub_size --- Alice's public key length
// OUTPUT:
// b_pub --- Bob's public key
// b_key->priv_key_data --- shared key
// b_key->priv_key_data_size --- shared key length
typedef size_t (*dap_enc_gen_bob_shared_key) (struct dap_enc_key *b_key, const void *a_pub,
size_t a_pub_size, void ** b_pub);
// generation of shared key at Alice's side
// INPUT:
// dap_enc_key *a_key
// a_priv --- Alice's private key
// b_pub --- Bob's public key
// b_pub_size --- Bob public key size
// OUTPUT:
// a_key->priv_key_data --- shared key
// a_key->priv_key_data_size --- shared key length
typedef size_t (*dap_enc_gen_alice_shared_key) (struct dap_enc_key *a_key, const void *a_priv,
size_t b_pub_size, unsigned char *b_pub);
typedef int (*dap_enc_callback_gen_key_public_t ) (struct dap_enc_key *a_key, void * a_output);
typedef void (*dap_enc_callback_ptr_t)(struct dap_enc_key *, void *);
typedef size_t (*dap_enc_callback_pptr_r_size_t)(struct dap_enc_key *, void **);
typedef void (*dap_enc_callback_data_t)(struct dap_enc_key *, const void * , size_t);
typedef void (*dap_enc_callback_size_t)(struct dap_enc_key *, size_t);
typedef void (*dap_enc_callback_str_t)(struct dap_enc_key *, const char*);
typedef char* (*dap_enc_callback_r_str_t)(struct dap_enc_key *);
typedef size_t (*dap_enc_callback_calc_out_size)(const size_t);
typedef size_t (*dap_enc_get_allpbk_list) (struct dap_enc_key *a_key, const void *allpbk_list, const int allpbk_num);
typedef struct dap_enc_key {
size_t priv_key_data_size;
//unsigned char * priv_key_data; // can be shared key in assymetric alghoritms
void * priv_key_data; // can be shared key in assymetric alghoritms or secret key in signature alghoritms
size_t pub_key_data_size;
//unsigned char * pub_key_data; // can be null if enc symmetric
void * pub_key_data; // can be null if enc symmetric
time_t last_used_timestamp;
dap_enc_key_type_t type;
dap_enc_callback_dataop_t enc;
dap_enc_callback_dataop_t dec;
dap_enc_callback_dataop_na_t enc_na;
dap_enc_callback_dataop_na_t dec_na;
dap_enc_callback_dataop_na_ext_t dec_na_ext;
dap_enc_callback_sign_op_t sign_get;
dap_enc_callback_sign_op_t sign_verify;
dap_enc_gen_alice_shared_key gen_alice_shared_key;
dap_enc_gen_bob_shared_key gen_bob_shared_key;
void *pbkListdata;
size_t pbkListsize;
dap_enc_get_allpbk_list getallpbkList;
void * _inheritor; // WARNING! Inheritor must have only serealizeble/deserializeble data (copy)
size_t _inheritor_size;
} dap_enc_key_t;
#define MAX_ENC_KEY_SIZE 16384
#define MAX_INHERITOR_SIZE 2048
// struct for serelization/deseralization keys in binary storage
typedef struct dap_enc_key_serealize {
size_t priv_key_data_size;
size_t pub_key_data_size;
size_t inheritor_size;
time_t last_used_timestamp;
dap_enc_key_type_t type;
unsigned char priv_key_data[MAX_ENC_KEY_SIZE];
unsigned char pub_key_data[MAX_ENC_KEY_SIZE];
unsigned char inheritor[MAX_INHERITOR_SIZE];
} dap_enc_key_serealize_t;
#ifdef __cplusplus
extern "C" {
#endif
int dap_enc_key_init(void);
void dap_enc_key_deinit(void);
const char *dap_enc_get_type_name(dap_enc_key_type_t a_key_type);
size_t dap_enc_key_get_enc_size(dap_enc_key_t * a_key, const size_t buf_in_size);
size_t dap_enc_key_get_dec_size(dap_enc_key_t * a_key, const size_t buf_in_size);
uint8_t* dap_enc_key_serealize_sign(dap_enc_key_type_t a_key_type, uint8_t *a_sign, size_t *a_sign_len);
uint8_t* dap_enc_key_deserealize_sign(dap_enc_key_type_t a_key_type, uint8_t *a_sign, size_t *a_sign_len);
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, const 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);
dap_enc_key_serealize_t* dap_enc_key_serealize(dap_enc_key_t * key);
dap_enc_key_t* dap_enc_key_deserealize(const void *buf, size_t buf_size);
// allocate memory for key struct
dap_enc_key_t *dap_enc_key_new(dap_enc_key_type_t a_key_type);
// default gen key
dap_enc_key_t *dap_enc_key_new_generate(dap_enc_key_type_t key_type, const void *kex_buf,
size_t kex_size, const void* seed,
size_t seed_size, size_t key_size);
// update struct dap_enc_key_t after insert foreign keys
void dap_enc_key_update(dap_enc_key_t *a_key);
// for asymmetric gen public key
dap_enc_key_t *dap_enc_gen_pub_key_from_priv(struct dap_enc_key *a_key, void **priv_key, size_t *alice_msg_len);
size_t dap_enc_gen_key_public_size (dap_enc_key_t *a_key);
int dap_enc_gen_key_public (dap_enc_key_t *a_key, void * a_output);
void dap_enc_key_signature_delete(dap_enc_key_type_t a_key_type, uint8_t *a_sig_buf);
void dap_enc_key_delete(dap_enc_key_t * a_key);
#ifdef __cplusplus
}
#endif
#endif
#ifndef _DAP_ENC_MSRLN_H_
#define _DAP_ENC_MSRLN_H_
#include <stddef.h>
#include "msrln/msrln.h"
#include "dap_enc_key.h"
//typedef struct dap_enc_key dap_enc_key_t;
//typedef struct dap_enc_msrln_key{
// void* private_key;
// size_t private_length;
// uint8_t* public_key;
// size_t public_length;
//} dap_enc_msrln_key_t;
#define DAP_ENC_KEY_TYPE_MSRLN(a) ((dap_enc_msrln_key_t *)((a)->_inheritor))
void dap_enc_msrln_key_new(struct dap_enc_key* a_key);
void dap_enc_msrln_key_generate(struct dap_enc_key * a_key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size,
size_t key_size);
//void dap_enc_msrln_key_new_from_data(struct dap_enc_key* a_key, void **a_priv, size_t *a_in_size);
void dap_enc_msrln_key_new_from_data_public(dap_enc_key_t* a_key, const void * a_in, size_t a_in_size);
void dap_enc_msrln_key_delete(struct dap_enc_key* a_key);
size_t dap_enc_msrln_key_public_raw(dap_enc_key_t *a_key, void ** a_key_public);
size_t dap_enc_msrln_gen_bob_shared_key(struct dap_enc_key* b_key, const void *a_pub, size_t a_pub_size, void **b_pub);
size_t dap_enc_msrln_gen_alice_shared_key(struct dap_enc_key* a_key, const void* a_priv, const size_t b_key_len, unsigned char * b_pub);
#endif
#ifndef _DAP_ENC_MSRLN_H_
#define _DAP_ENC_MSRLN_H_
#include <stddef.h>
#include "msrln/msrln.h"
#include "dap_enc_key.h"
//typedef struct dap_enc_key dap_enc_key_t;
//typedef struct dap_enc_msrln_key{
// void* private_key;
// size_t private_length;
// uint8_t* public_key;
// size_t public_length;
//} dap_enc_msrln_key_t;
#define DAP_ENC_KEY_TYPE_MSRLN(a) ((dap_enc_msrln_key_t *)((a)->_inheritor))
void dap_enc_msrln_key_new(struct dap_enc_key* a_key);
void dap_enc_msrln_key_generate(struct dap_enc_key * a_key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size,
size_t key_size);
//void dap_enc_msrln_key_new_from_data(struct dap_enc_key* a_key, void **a_priv, size_t *a_in_size);
void dap_enc_msrln_key_new_from_data_public(dap_enc_key_t* a_key, const void * a_in, size_t a_in_size);
void dap_enc_msrln_key_delete(struct dap_enc_key* a_key);
size_t dap_enc_msrln_key_public_raw(dap_enc_key_t *a_key, void ** a_key_public);
size_t dap_enc_msrln_gen_bob_shared_key(struct dap_enc_key* b_key, const void *a_pub, size_t a_pub_size, void **b_pub);
size_t dap_enc_msrln_gen_alice_shared_key(struct dap_enc_key* a_key, const void* a_priv, const size_t b_key_len, unsigned char * b_pub);
#endif
#ifndef _DAP_ENC_OAES_H_
#define _DAP_ENC_OAES_H_
#include <stddef.h>
#include "dap_enc_key.h"
#ifdef __cplusplus
extern "C" {
#endif
void dap_enc_oaes_key_new(struct dap_enc_key * a_key);
void dap_enc_oaes_key_delete(struct dap_enc_key *a_key);
void dap_enc_oaes_key_generate(struct dap_enc_key * a_key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size, size_t key_size);
size_t dap_enc_oaes_calc_decode_size(const size_t size_in);
size_t dap_enc_oaes_calc_encode_size(const size_t size_in);
size_t dap_enc_oaes_decrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
size_t dap_enc_oaes_encrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_oaes_decrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_oaes_encrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
#ifdef __cplusplus
}
#endif
#endif
#ifndef _DAP_ENC_OAES_H_
#define _DAP_ENC_OAES_H_
#include <stddef.h>
#include "dap_enc_key.h"
#ifdef __cplusplus
extern "C" {
#endif
void dap_enc_oaes_key_new(struct dap_enc_key * a_key);
void dap_enc_oaes_key_delete(struct dap_enc_key *a_key);
void dap_enc_oaes_key_generate(struct dap_enc_key * a_key, const void *kex_buf,
size_t kex_size, const void * seed, size_t seed_size, size_t key_size);
size_t dap_enc_oaes_calc_decode_size(const size_t size_in);
size_t dap_enc_oaes_calc_encode_size(const size_t size_in);
size_t dap_enc_oaes_decrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
size_t dap_enc_oaes_encrypt(struct dap_enc_key * a_key, const void * a_in, size_t a_in_size, void ** a_out);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_oaes_decrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
// Writes result ( out ) in already allocated buffer
size_t dap_enc_oaes_encrypt_fast(struct dap_enc_key * a_key, const void * a_in,
size_t a_in_size, void * buf_out, size_t buf_out_size);
#ifdef __cplusplus
}
#endif
#endif
/*
* Authors:
* Dmitriy Gearasimov <gerasimov.dmitriy@demlabs.net>
* Anatoly Kurotych <anatoly.kurotych@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* Copyright (c) 2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
//#include "../sig_picnic/picnic.h"
#include "dap_enc_key.h"
#define DAP_PICNIC_SIGN_PARAMETR 1//determination of the scheme and level of resistance {1-6}
void dap_enc_sig_picnic_key_new(struct dap_enc_key *key);
void dap_enc_sig_picnic_key_delete(struct dap_enc_key *key);
void dap_enc_sig_picnic_update(struct dap_enc_key * key);
void dap_enc_sig_picnic_key_new_generate(struct dap_enc_key * key, const void *kex_buf, size_t kex_size,
const void * seed, size_t seed_size,
size_t key_size);
size_t dap_enc_sig_picnic_get_sign(struct dap_enc_key * key, const void* message, size_t message_len,
void* signature, size_t signature_len);
size_t dap_enc_sig_picnic_verify_sign(struct dap_enc_key * key, const void* message, size_t message_len,
void* signature, size_t signature_len);
size_t dap_enc_picnic_calc_signature_size(struct dap_enc_key *key);
#ifdef __cplusplus
}
#endif
/*
* Authors:
* Dmitriy Gearasimov <gerasimov.dmitriy@demlabs.net>
* Anatoly Kurotych <anatoly.kurotych@demlabs.net>
* DeM Labs Inc. https://demlabs.net
* Copyright (c) 2019
* All rights reserved.
This file is part of DAP (Deus Applications Prototypes) the open source project
DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
//#include "../sig_picnic/picnic.h"
#include "dap_enc_key.h"
#define DAP_PICNIC_SIGN_PARAMETR 1//determination of the scheme and level of resistance {1-6}
void dap_enc_sig_picnic_key_new(struct dap_enc_key *key);
void dap_enc_sig_picnic_key_delete(struct dap_enc_key *key);
void dap_enc_sig_picnic_update(struct dap_enc_key * key);
void dap_enc_sig_picnic_key_new_generate(struct dap_enc_key * key, const void *kex_buf, size_t kex_size,
const void * seed, size_t seed_size,
size_t key_size);
size_t dap_enc_sig_picnic_get_sign(struct dap_enc_key * key, const void* message, size_t message_len,
void* signature, size_t signature_len);
size_t dap_enc_sig_picnic_verify_sign(struct dap_enc_key * key, const void* message, size_t message_len,
void* signature, size_t signature_len);
size_t dap_enc_picnic_calc_signature_size(struct dap_enc_key *key);
#ifdef __cplusplus
}
#endif