Fix from HEAD.
This commit is contained in:
parent
b723a7b11b
commit
986ad56124
@ -69,7 +69,7 @@ int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
|
|||||||
{
|
{
|
||||||
const EVP_MD *md_type;
|
const EVP_MD *md_type;
|
||||||
HMAC_CTX hmac;
|
HMAC_CTX hmac;
|
||||||
unsigned char key[PKCS12_MAC_KEY_LENGTH], *salt;
|
unsigned char key[EVP_MAX_MD_SIZE], *salt;
|
||||||
int saltlen, iter;
|
int saltlen, iter;
|
||||||
|
|
||||||
if (!PKCS7_type_is_data(p12->authsafes))
|
if (!PKCS7_type_is_data(p12->authsafes))
|
||||||
@ -88,12 +88,12 @@ int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter,
|
if(!PKCS12_key_gen (pass, passlen, salt, saltlen, PKCS12_MAC_ID, iter,
|
||||||
PKCS12_MAC_KEY_LENGTH, key, md_type)) {
|
EVP_MD_size(md_type), key, md_type)) {
|
||||||
PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_KEY_GEN_ERROR);
|
PKCS12err(PKCS12_F_PKCS12_GEN_MAC,PKCS12_R_KEY_GEN_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
HMAC_CTX_init(&hmac);
|
HMAC_CTX_init(&hmac);
|
||||||
HMAC_Init_ex(&hmac, key, PKCS12_MAC_KEY_LENGTH, md_type, NULL);
|
HMAC_Init_ex(&hmac, key, EVP_MD_size(md_type), md_type, NULL);
|
||||||
HMAC_Update(&hmac, p12->authsafes->d.data->data,
|
HMAC_Update(&hmac, p12->authsafes->d.data->data,
|
||||||
p12->authsafes->d.data->length);
|
p12->authsafes->d.data->length);
|
||||||
HMAC_Final(&hmac, mac, maclen);
|
HMAC_Final(&hmac, mac, maclen);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user