mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-11 08:23:50 +08:00
first step of v2 final release
This commit is contained in:
@@ -176,8 +176,16 @@ int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,
|
||||
unsigned int maclen;
|
||||
ASN1_OCTET_STRING *macoct;
|
||||
|
||||
if (!md_type)
|
||||
if (!md_type) {
|
||||
#ifndef OPENSSL_NO_SHA
|
||||
md_type = EVP_sha1();
|
||||
#elif !defined(OPENSSL_NO_SM3)
|
||||
md_type = EVP_sm3();
|
||||
#else
|
||||
PKCS12err(PKCS12_F_PKCS12_SET_MAC, PKCS12_R_NO_AVAIABLE_DIGEST);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
if (PKCS12_setup_mac(p12, iter, salt, saltlen, md_type) == PKCS12_ERROR) {
|
||||
PKCS12err(PKCS12_F_PKCS12_SET_MAC, PKCS12_R_MAC_SETUP_ERROR);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user