summaryrefslogtreecommitdiffstats
path: root/crypto/pkcs12
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2015-11-30 13:44:28 +0100
committerRichard Levitte <levitte@openssl.org>2015-12-07 17:39:23 +0100
commitbf7c68177b6fbb80406c60136654b6fefe7e3ba2 (patch)
tree16905424df7a7ba3a5ff5f5d9fc305e522f1b948 /crypto/pkcs12
parent3f43aecc599a5a729609deca7d98a677334ab3b8 (diff)
Adapt the rest of the source to the opaque HMAC_CTX
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/pkcs12')
-rw-r--r--crypto/pkcs12/p12_mutl.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c
index 46a04b4944..fda2bc9ea4 100644
--- a/crypto/pkcs12/p12_mutl.c
+++ b/crypto/pkcs12/p12_mutl.c
@@ -59,7 +59,7 @@
# include <stdio.h>
# include "internal/cryptlib.h"
-#include <openssl/crypto.h>
+# include <openssl/crypto.h>
# include <openssl/hmac.h>
# include <openssl/rand.h>
# include <openssl/pkcs12.h>
@@ -91,7 +91,7 @@ int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
unsigned char *mac, unsigned int *maclen)
{
const EVP_MD *md_type;
- HMAC_CTX hmac = HMAC_CTX_EMPTY;
+ HMAC_CTX *hmac = NULL;
unsigned char key[EVP_MAX_MD_SIZE], *salt;
int saltlen, iter;
int md_size = 0;
@@ -133,15 +133,15 @@ int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
PKCS12err(PKCS12_F_PKCS12_GEN_MAC, PKCS12_R_KEY_GEN_ERROR);
return 0;
}
- HMAC_CTX_init(&hmac);
- if (!HMAC_Init_ex(&hmac, key, md_size, md_type, NULL)
- || !HMAC_Update(&hmac, p12->authsafes->d.data->data,
+ hmac = HMAC_CTX_new();
+ if (!HMAC_Init_ex(hmac, key, md_size, md_type, NULL)
+ || !HMAC_Update(hmac, p12->authsafes->d.data->data,
p12->authsafes->d.data->length)
- || !HMAC_Final(&hmac, mac, maclen)) {
- HMAC_CTX_cleanup(&hmac);
+ || !HMAC_Final(hmac, mac, maclen)) {
+ HMAC_CTX_free(hmac);
return 0;
}
- HMAC_CTX_cleanup(&hmac);
+ HMAC_CTX_free(hmac);
return 1;
}