diff options
author | Richard Levitte <levitte@openssl.org> | 2015-11-30 13:44:28 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-12-07 17:39:23 +0100 |
commit | bf7c68177b6fbb80406c60136654b6fefe7e3ba2 (patch) | |
tree | 16905424df7a7ba3a5ff5f5d9fc305e522f1b948 /apps/speed.c | |
parent | 3f43aecc599a5a729609deca7d98a677334ab3b8 (diff) |
Adapt the rest of the source to the opaque HMAC_CTX
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/speed.c')
-rw-r--r-- | apps/speed.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/speed.c b/apps/speed.c index 1434a95ba9..8e1fe840c6 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -1298,24 +1298,28 @@ int speed_main(int argc, char **argv) #if !defined(OPENSSL_NO_MD5) if (doit[D_HMAC]) { - HMAC_CTX hctx = HMAC_CTX_EMPTY; + HMAC_CTX *hctx = NULL; - HMAC_CTX_init(&hctx); - HMAC_Init_ex(&hctx, (unsigned char *)"This is a key...", + hctx = HMAC_CTX_new(); + if (hctx == NULL) { + BIO_printf(bio_err, "HMAC malloc failure, exiting..."); + exit(1); + } + HMAC_Init_ex(hctx, (unsigned char *)"This is a key...", 16, EVP_md5(), NULL); for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) { - HMAC_Init_ex(&hctx, NULL, 0, NULL, NULL); - HMAC_Update(&hctx, buf, lengths[j]); - HMAC_Final(&hctx, &(hmac[0]), NULL); + HMAC_Init_ex(hctx, NULL, 0, NULL, NULL); + HMAC_Update(hctx, buf, lengths[j]); + HMAC_Final(hctx, &(hmac[0]), NULL); } d = Time_F(STOP); print_result(D_HMAC, j, count, d); } - HMAC_CTX_cleanup(&hctx); + HMAC_CTX_free(hctx); } #endif if (doit[D_SHA1]) { |