mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 08:56:17 +08:00
Update SM4 build options
This commit is contained in:
@@ -290,22 +290,6 @@ if (ENABLE_TLS_DEBUG)
|
||||
endif()
|
||||
|
||||
|
||||
#option(ENABLE_SM3_AVX_BMI2 "Enable SM3 AVX+BMI2 assembly implementation" OFF)
|
||||
#if (ENABLE_SM3_AVX_BMI2)
|
||||
# message(STATUS "ENABLE_SM3_AVX_BMI2 is ON")
|
||||
# add_definitions(-DENABLE_SM3_AVX_BMI2)
|
||||
# enable_language(ASM)
|
||||
# list(APPEND src src/sm3_avx_bmi2.s)
|
||||
#endif()
|
||||
|
||||
option (ENABLE_SM4_TBOX "Enable SM4 merged S-Box implementation" ON)
|
||||
if (ENABLE_SM4_TBOX)
|
||||
message(STATUS "ENABLE_SM4_TBOX is ON")
|
||||
list(FIND src src/sm4.c sm4_index)
|
||||
list(REMOVE_AT src ${sm4_index})
|
||||
list(INSERT src ${sm4_index} src/sm4_tbox.c)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SM3_SSE "Enable SM3 SSE assembly implementation" OFF)
|
||||
if (ENABLE_SM3_SSE)
|
||||
message(STATUS "ENABLE_SM3_SSE is ON")
|
||||
@@ -314,6 +298,22 @@ if (ENABLE_SM3_SSE)
|
||||
list(INSERT src ${sm3_index} src/sm3_sse.c)
|
||||
endif()
|
||||
|
||||
option (ENABLE_SM4_TBOX "Enable SM4 merged S-Box implementation" OFF)
|
||||
if (ENABLE_SM4_TBOX)
|
||||
message(STATUS "ENABLE_SM4_TBOX is ON")
|
||||
list(FIND src src/sm4.c sm4_index)
|
||||
list(REMOVE_AT src ${sm4_index})
|
||||
list(INSERT src ${sm4_index} src/sm4_tbox.c)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SM4_AARCH64 "Enable SM4 AARCH64 assembly implementation" OFF)
|
||||
if (ENABLE_SM4_AARCH64)
|
||||
message(STATUS "ENABLE_SM4_AARCH64 is ON")
|
||||
list(FIND src src/sm4.c sm4_index)
|
||||
list(REMOVE_AT src ${sm4_index})
|
||||
list(INSERT src ${sm4_index} src/sm4_aarch64.S)
|
||||
enable_language(ASM)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SM4_AESNI_AVX "Enable SM4 AESNI+AVX assembly implementation" OFF)
|
||||
if (ENABLE_SM4_AESNI_AVX)
|
||||
@@ -324,14 +324,6 @@ if (ENABLE_SM4_AESNI_AVX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
|
||||
endif()
|
||||
|
||||
option(ENABLE_SM4_AARCH64 "Enable SM4 AARCH64 assembly implementation" OFF)
|
||||
if (ENABLE_SM4_AARCH64)
|
||||
message(STATUS "ENABLE_SM4_AARCH64 is ON")
|
||||
add_definitions(-DENABLE_SM4_AARCH64)
|
||||
enable_language(ASM)
|
||||
list(APPEND src src/sm4_aarch64.S)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SM4_ECB "Enable SM4 ECB mode" OFF)
|
||||
if (ENABLE_SM4_ECB)
|
||||
message(STATUS "ENABLE_SM4_ECB is ON")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
out/*
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
@@ -94,7 +94,6 @@ const uint8_t S[256] = {
|
||||
(S[((A)) & 0xff]))
|
||||
|
||||
|
||||
#ifndef ENABLE_SM4_AARCH64
|
||||
void sm4_set_encrypt_key(SM4_KEY *key, const uint8_t user_key[16])
|
||||
{
|
||||
uint32_t X0, X1, X2, X3, X4;
|
||||
@@ -172,4 +171,3 @@ void sm4_encrypt(const SM4_KEY *key, const unsigned char in[16], unsigned char o
|
||||
PUTU32(out + 8, X1);
|
||||
PUTU32(out + 12, X0);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -161,7 +161,6 @@ const uint32_t T[256] = {
|
||||
(S[((A)) & 0xff]))
|
||||
|
||||
|
||||
#ifndef ENABLE_SM4_AARCH64
|
||||
void sm4_set_encrypt_key(SM4_KEY *key, const uint8_t user_key[16])
|
||||
{
|
||||
uint32_t X0, X1, X2, X3, X4;
|
||||
@@ -243,4 +242,3 @@ void sm4_encrypt(const SM4_KEY *key, const unsigned char in[16], unsigned char o
|
||||
PUTU32(out + 8, X1);
|
||||
PUTU32(out + 12, X0);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user