From f960a8fa27a070d3f6498c5dcf205a025081a6dc Mon Sep 17 00:00:00 2001 From: Zhi Guan Date: Sat, 8 Sep 2018 10:38:43 +0800 Subject: [PATCH] Add sm3/sm4 as pbe algorithms --- crypto/evp/e_sms4.c | 4 ++-- crypto/evp/evp_pbe.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto/evp/e_sms4.c b/crypto/evp/e_sms4.c index afb0e743..83935402 100644 --- a/crypto/evp/e_sms4.c +++ b/crypto/evp/e_sms4.c @@ -96,8 +96,8 @@ static int sms4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, } IMPLEMENT_BLOCK_CIPHER(sms4, ks, sms4, EVP_SMS4_KEY, NID_sms4, - SMS4_BLOCK_SIZE, SMS4_KEY_LENGTH, SMS4_IV_LENGTH, 128, 0, - sms4_init_key, NULL, NULL, NULL, NULL) + SMS4_BLOCK_SIZE, SMS4_KEY_LENGTH, SMS4_IV_LENGTH, 128, + EVP_CIPH_FLAG_DEFAULT_ASN1, sms4_init_key, NULL, NULL, NULL, NULL) # define MAXBITCHUNK ((size_t)1<<(sizeof(size_t)*8-4)) diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c index a2bcc572..fe08c92c 100644 --- a/crypto/evp/evp_pbe.c +++ b/crypto/evp/evp_pbe.c @@ -68,6 +68,9 @@ static const EVP_PBE_CTL builtin_pbe[] = { {EVP_PBE_TYPE_PRF, NID_hmacWithSHA256, -1, NID_sha256, 0}, {EVP_PBE_TYPE_PRF, NID_hmacWithSHA384, -1, NID_sha384, 0}, {EVP_PBE_TYPE_PRF, NID_hmacWithSHA512, -1, NID_sha512, 0}, +#ifndef OPENSSL_NO_SM3 + {EVP_PBE_TYPE_PRF, NID_hmac_sm3, -1, NID_sm3, 0}, +#endif {EVP_PBE_TYPE_PRF, NID_id_HMACGostR3411_94, -1, NID_id_GostR3411_94, 0}, {EVP_PBE_TYPE_PRF, NID_id_tc26_hmac_gost_3411_2012_256, -1, NID_id_GostR3411_2012_256, 0},