Remove duplicated definition of CTX_MODE_NUM.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- src/uadk_dh.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/src/uadk_dh.c b/src/uadk_dh.c index 6065160..a14d215 100644 --- a/src/uadk_dh.c +++ b/src/uadk_dh.c @@ -39,7 +39,6 @@ #define CHAR_BIT_SIZE 3 #define DH_PARAMS_CNT 3 #define CTX_MODE_NUM 2 -#define CTX_MODE_NUM 2 #define UN_SET 0 #define IS_SET 1 #define CTX_ASYNC 1
Convert immediate numbers to macros in digest.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- src/uadk_digest.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/src/uadk_digest.c b/src/uadk_digest.c index ba0876e..8ce9fd1 100644 --- a/src/uadk_digest.c +++ b/src/uadk_digest.c @@ -20,8 +20,9 @@ #include <string.h> #include <dlfcn.h> #include <openssl/engine.h> -#include <openssl/md5.h> #include <openssl/evp.h> +#include <openssl/md5.h> +#include <openssl/sha.h> #include <uadk/wd_cipher.h> #include <uadk/wd_digest.h> #include <uadk/wd_sched.h> @@ -42,6 +43,9 @@
#define SM3_DIGEST_LENGTH 32 #define SM3_CBLOCK 64 +#define SHA1_CBLOCK 64 +#define SHA224_CBLOCK 64 +#define SHA384_CBLOCK 128 #define SM3_SMALL_PACKET_OFFLOAD_THRESHOLD_DEFAULT (512) #define MD5_SMALL_PACKET_OFFLOAD_THRESHOLD_DEFAULT (8 * 1024) #define SHA_SMALL_PACKET_OFFLOAD_THRESHOLD_DEFAULT (512) @@ -126,13 +130,13 @@ static struct digest_threshold_table digest_pkt_threshold_table[] = { };
static struct digest_info digest_info_table[] = { - {NID_md5, WD_DIGEST_NORMAL, WD_DIGEST_MD5, 16}, - {NID_sm3, WD_DIGEST_NORMAL, WD_DIGEST_SM3, 32}, - {NID_sha1, WD_DIGEST_NORMAL, WD_DIGEST_SHA1, 20}, - {NID_sha224, WD_DIGEST_NORMAL, WD_DIGEST_SHA224, 28}, - {NID_sha256, WD_DIGEST_NORMAL, WD_DIGEST_SHA256, 32}, - {NID_sha384, WD_DIGEST_NORMAL, WD_DIGEST_SHA384, 48}, - {NID_sha512, WD_DIGEST_NORMAL, WD_DIGEST_SHA512, 64}, + {NID_md5, WD_DIGEST_NORMAL, WD_DIGEST_MD5, MD5_DIGEST_LENGTH}, + {NID_sm3, WD_DIGEST_NORMAL, WD_DIGEST_SM3, SM3_DIGEST_LENGTH}, + {NID_sha1, WD_DIGEST_NORMAL, WD_DIGEST_SHA1, SHA_DIGEST_LENGTH}, + {NID_sha224, WD_DIGEST_NORMAL, WD_DIGEST_SHA224, SHA224_DIGEST_LENGTH}, + {NID_sha256, WD_DIGEST_NORMAL, WD_DIGEST_SHA256, SHA256_DIGEST_LENGTH}, + {NID_sha384, WD_DIGEST_NORMAL, WD_DIGEST_SHA384, SHA384_DIGEST_LENGTH}, + {NID_sha512, WD_DIGEST_NORMAL, WD_DIGEST_SHA512, SHA512_DIGEST_LENGTH}, };
static EVP_MD *uadk_md5; @@ -849,32 +853,32 @@ int uadk_e_bind_digest(ENGINE *e) uadk_e_digest_init, uadk_e_digest_update, uadk_e_digest_final, uadk_e_digest_cleanup, uadk_e_digest_copy); - UADK_DIGEST_DESCR(sha1, sha1WithRSAEncryption, 20, - EVP_MD_FLAG_FIPS, 64, + UADK_DIGEST_DESCR(sha1, sha1WithRSAEncryption, SHA_DIGEST_LENGTH, + EVP_MD_FLAG_FIPS, SHA1_CBLOCK, sizeof(EVP_MD *) + sizeof(struct digest_priv_ctx), uadk_e_digest_init, uadk_e_digest_update, uadk_e_digest_final, uadk_e_digest_cleanup, uadk_e_digest_copy); - UADK_DIGEST_DESCR(sha224, sha224WithRSAEncryption, 28, - EVP_MD_FLAG_FIPS, 64, + UADK_DIGEST_DESCR(sha224, sha224WithRSAEncryption, SHA224_DIGEST_LENGTH, + EVP_MD_FLAG_FIPS, SHA224_CBLOCK, sizeof(EVP_MD *) + sizeof(struct digest_priv_ctx), uadk_e_digest_init, uadk_e_digest_update, uadk_e_digest_final, uadk_e_digest_cleanup, uadk_e_digest_copy); - UADK_DIGEST_DESCR(sha256, sha256WithRSAEncryption, 32, - EVP_MD_FLAG_FIPS, 64, + UADK_DIGEST_DESCR(sha256, sha256WithRSAEncryption, SHA256_DIGEST_LENGTH, + EVP_MD_FLAG_FIPS, SHA256_CBLOCK, sizeof(EVP_MD *) + sizeof(struct digest_priv_ctx), uadk_e_digest_init, uadk_e_digest_update, uadk_e_digest_final, uadk_e_digest_cleanup, uadk_e_digest_copy); - UADK_DIGEST_DESCR(sha384, sha384WithRSAEncryption, 48, - EVP_MD_FLAG_FIPS, 128, + UADK_DIGEST_DESCR(sha384, sha384WithRSAEncryption, SHA384_DIGEST_LENGTH, + EVP_MD_FLAG_FIPS, SHA384_CBLOCK, sizeof(EVP_MD *) + sizeof(struct digest_priv_ctx), uadk_e_digest_init, uadk_e_digest_update, uadk_e_digest_final, uadk_e_digest_cleanup, uadk_e_digest_copy); - UADK_DIGEST_DESCR(sha512, sha512WithRSAEncryption, 64, - EVP_MD_FLAG_FIPS, 128, + UADK_DIGEST_DESCR(sha512, sha512WithRSAEncryption, SHA512_DIGEST_LENGTH, + EVP_MD_FLAG_FIPS, SHA512_CBLOCK, sizeof(EVP_MD *) + sizeof(struct digest_priv_ctx), uadk_e_digest_init, uadk_e_digest_update, uadk_e_digest_final, uadk_e_digest_cleanup,
Fix the wrong command of openssl config file in README.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- README | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/README b/README index e02de8f..cd27ccb 100644 --- a/README +++ b/README @@ -180,17 +180,17 @@ Usage 1. Firstly, modify the openssl.cnf file, add the following settings at the beginning of this file:
``` -openssl_cnf = openssl_def +openssl_cnf=openssl_def [openssl_def] -engines = engine_section +engines=engine_section [engine_section] -uadk = uadk_section +uadk=uadk_section [uadk_section] -UADK_CMD_ENABLE_RSA_ENV = 1 -UADK_CMD_ENABLE_DH_ENV = 1 -UADK_CMD_ENABLE_CIPHER_ENV = 1 -UADK_CMD_ENABLE_DIGEST_ENV = 1 -UADK_CMD_ENABLE_ECC_ENV = 1 +UADK_CMD_ENABLE_RSA_ENV=1 +UADK_CMD_ENABLE_DH_ENV=1 +UADK_CMD_ENABLE_CIPHER_ENV=1 +UADK_CMD_ENABLE_DIGEST_ENV=1 +UADK_CMD_ENABLE_ECC_ENV=1 ``` Note: * The number 1 for enable environment variable, and 0 for disable environment variable. * By default, you can find openssl.cnf file under /usr/local/ssl/ path.