summaryrefslogtreecommitdiff
path: root/lib/libcrypto/pkcs12/p12_mutl.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2000-03-19 11:13:56 +0000
committerBob Beck <beck@cvs.openbsd.org>2000-03-19 11:13:56 +0000
commit49f56637dd22e4a7b21187190845bdf93f225b6c (patch)
tree53fb7836f5f49958bff0a86c3daad74163301583 /lib/libcrypto/pkcs12/p12_mutl.c
parent3fcaa7468f9b0354a53219db5fef7803a96ef49e (diff)
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2 if you are using the ssl26 packages for ssh and other things to work you will need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'lib/libcrypto/pkcs12/p12_mutl.c')
-rw-r--r--lib/libcrypto/pkcs12/p12_mutl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libcrypto/pkcs12/p12_mutl.c b/lib/libcrypto/pkcs12/p12_mutl.c
index bac558d6b9a..f1094b3840e 100644
--- a/lib/libcrypto/pkcs12/p12_mutl.c
+++ b/lib/libcrypto/pkcs12/p12_mutl.c
@@ -131,7 +131,7 @@ int PKCS12_set_mac (PKCS12 *p12, const char *pass, int passlen,
PKCS12err(PKCS12_F_PKCS12_SET_MAC,PKCS12_R_MAC_GENERATION_ERROR);
return 0;
}
- if (!(ASN1_OCTET_STRING_set (p12->mac->dinfo->digest, mac, maclen))) {
+ if (!(M_ASN1_OCTET_STRING_set (p12->mac->dinfo->digest, mac, maclen))) {
PKCS12err(PKCS12_F_PKCS12_SET_MAC,PKCS12_R_MAC_STRING_SET_ERROR);
return 0;
}
@@ -142,13 +142,13 @@ int PKCS12_set_mac (PKCS12 *p12, const char *pass, int passlen,
int PKCS12_setup_mac (PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
EVP_MD *md_type)
{
- if (!(p12->mac = PKCS12_MAC_DATA_new ())) return PKCS12_ERROR;
+ if (!(p12->mac = PKCS12_MAC_DATA_new())) return PKCS12_ERROR;
if (iter > 1) {
- if(!(p12->mac->iter = ASN1_INTEGER_new())) {
+ if(!(p12->mac->iter = M_ASN1_INTEGER_new())) {
PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE);
return 0;
}
- ASN1_INTEGER_set (p12->mac->iter, iter);
+ ASN1_INTEGER_set(p12->mac->iter, iter);
}
if (!saltlen) saltlen = PKCS12_SALT_LEN;
p12->mac->salt->length = saltlen;
@@ -156,7 +156,10 @@ int PKCS12_setup_mac (PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE);
return 0;
}
- if (!salt) RAND_bytes (p12->mac->salt->data, saltlen);
+ if (!salt) {
+ if (RAND_bytes (p12->mac->salt->data, saltlen) <= 0)
+ return 0;
+ }
else memcpy (p12->mac->salt->data, salt, saltlen);
p12->mac->dinfo->algor->algorithm = OBJ_nid2obj(EVP_MD_type(md_type));
if (!(p12->mac->dinfo->algor->parameter = ASN1_TYPE_new())) {