mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 00:46:17 +08:00
Add software SDF implementation
The soft_sdf will replace sdf_dummy library for buiding testing apps.
This commit is contained in:
@@ -75,6 +75,7 @@ set(tools
|
||||
tools/sm4.c
|
||||
tools/sm3.c
|
||||
tools/sm3hmac.c
|
||||
tools/sm3xmss_keygen.c
|
||||
tools/sm2keygen.c
|
||||
tools/sm2sign.c
|
||||
tools/sm2verify.c
|
||||
@@ -285,7 +286,7 @@ if (ENABLE_SM3_XMSS)
|
||||
message(STATUS "ENABLE_SM3_XMSS is ON")
|
||||
list(APPEND src src/sm3_xmss.c)
|
||||
|
||||
option(ENABLE_SM3_XMSS_CROSSCHECK "Enable XMSS SHA-256 cross-check" ON)
|
||||
option(ENABLE_SM3_XMSS_CROSSCHECK "Enable XMSS SHA-256 cross-check" OFF)
|
||||
if (ENABLE_SM3_XMSS_CROSSCHECK)
|
||||
message(STATUS "ENABLE_SM3_XMSS_CROSSCHECK is ON")
|
||||
add_definitions(-DENABLE_SM3_XMSS_CROSSCHECK)
|
||||
@@ -331,6 +332,7 @@ if (ENABLE_CHACHA20)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
option(ENABLE_INTEL_RDRAND "Enable Intel RDRAND instructions" OFF)
|
||||
option(ENABLE_INTEL_RDSEED "Enable Intel RDSEED instructions" OFF)
|
||||
|
||||
@@ -361,12 +363,20 @@ if (ENABLE_INTEL_RDRAND)
|
||||
endif()
|
||||
|
||||
|
||||
option(ENABLE_SM4_CBC_MAC "Enable SM4-CBC-MAC" OFF)
|
||||
if (ENABLE_SM4_CBC_MAC)
|
||||
message(STATUS "ENABLE_SM4_CBC_MAC is ON")
|
||||
list(APPEND src src/sm4_cbc_mac.c)
|
||||
list(APPEND tests sm4_cbc_mac)
|
||||
list(APPEND demos sm4_cbc_mac_demo)
|
||||
endif()
|
||||
|
||||
|
||||
option(ENABLE_GMT_0105_RNG "Enable GM/T 0105 Software RNG" OFF)
|
||||
if (ENABLE_GMT_0105_RNG)
|
||||
message(STATUS "ENABLE_GMT_0105_RNG")
|
||||
list(APPEND src src/sm3_rng.c src/sm4_cbc_mac.c src/sm4_rng.c)
|
||||
list(APPEND tests sm3_rng sm4_cbc_mac sm4_rng)
|
||||
list(APPEND demos sm4_cbc_mac_demo)
|
||||
message(STATUS "ENABLE_GMT_0105_RNG is ON")
|
||||
list(APPEND src src/sm3_rng.c src/sm4_rng.c)
|
||||
list(APPEND tests sm3_rng sm4_rng)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -400,6 +410,9 @@ endif()
|
||||
add_library(gmssl ${src})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(gmssl -lws2_32)
|
||||
elseif (APPLE)
|
||||
@@ -421,6 +434,16 @@ SET_TARGET_PROPERTIES(gmssl PROPERTIES VERSION 3.1 SOVERSION 3)
|
||||
install(TARGETS gmssl ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/gmssl DESTINATION include)
|
||||
|
||||
|
||||
option(ENABLE_SOFT_SDF "Enable Software SDF Implementation" OFF)
|
||||
if (ENABLE_SOFT_SDF)
|
||||
message(STATUS "ENABLE_SOFT_SDF is ON")
|
||||
add_library(soft_sdf SHARED src/sdf/soft_sdf.c)
|
||||
target_link_libraries(soft_sdf PRIVATE gmssl)
|
||||
set_target_properties(soft_sdf PROPERTIES VERSION 3.1 SOVERSION 3)
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
|
||||
|
||||
add_library(sdf_dummy SHARED src/sdf/sdf_dummy.c)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
* Copyright 2014-2023 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
@@ -86,6 +86,9 @@ typedef struct ECCCipher_st {
|
||||
unsigned char M[32];
|
||||
unsigned int L;
|
||||
unsigned char C[1];
|
||||
// Extend sizeof(C) to SM2_MAX_PLAINTEXT_SIZE
|
||||
// gmssl/sm2.h: SM2_MAX_PLAINTEXT_SIZE = 255
|
||||
unsigned char C_[254];
|
||||
} ECCCipher;
|
||||
|
||||
typedef struct ECCSignature_st {
|
||||
|
||||
2335
src/sdf/soft_sdf.c
Executable file
2335
src/sdf/soft_sdf.c
Executable file
File diff suppressed because it is too large
Load Diff
@@ -65,9 +65,9 @@
|
||||
#define SGD_RSA_SIGN (SGD_RSA|SGD_PK_SIGN) // FIXME: correct?
|
||||
#define SGD_RSA_ENC (SGD_RSA|SGD_PK_ENC) // FIXME: correct?
|
||||
#define SGD_SM2 0x00020100
|
||||
#define SGD_SM2_1 0x00020200
|
||||
#define SGD_SM2_2 0x00020400
|
||||
#define SGD_SM2_3 0x00020800
|
||||
#define SGD_SM2_1 0x00020200 // SM2 Signature Scheme
|
||||
#define SGD_SM2_2 0x00020400 // SM2 Key Exchange Protocol
|
||||
#define SGD_SM2_3 0x00020800 // SM2 Encryption Scheme
|
||||
|
||||
/* hash */
|
||||
#define SGD_SM3 0x00000001
|
||||
|
||||
Reference in New Issue
Block a user