summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2022-03-30 07:12:30 +0000
committertb <>2022-03-30 07:12:30 +0000
commit61f74e26e813f57f5d3216e979c10957e0548893 (patch)
tree39ee27a3d0b95b662ce493411a2b928ec9e63a4c
parentb2def5a862cad077ba6f95830e83c6479d96cf0c (diff)
downloadopenbsd-61f74e26e813f57f5d3216e979c10957e0548893.tar.gz
openbsd-61f74e26e813f57f5d3216e979c10957e0548893.tar.bz2
openbsd-61f74e26e813f57f5d3216e979c10957e0548893.zip
pkey_hmac_init(): use calloc()
Instead of using malloc() and setting most struct members to 0, simply use calloc(). ok bcook jsing
-rw-r--r--src/lib/libcrypto/hmac/hm_pmeth.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/libcrypto/hmac/hm_pmeth.c b/src/lib/libcrypto/hmac/hm_pmeth.c
index 8964c64871..676305fdcb 100644
--- a/src/lib/libcrypto/hmac/hm_pmeth.c
+++ b/src/lib/libcrypto/hmac/hm_pmeth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hm_pmeth.c,v 1.11 2021/12/12 21:27:38 tb Exp $ */ 1/* $OpenBSD: hm_pmeth.c,v 1.12 2022/03/30 07:12:30 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2007. 3 * project 2007.
4 */ 4 */
@@ -80,13 +80,9 @@ pkey_hmac_init(EVP_PKEY_CTX *ctx)
80{ 80{
81 HMAC_PKEY_CTX *hctx; 81 HMAC_PKEY_CTX *hctx;
82 82
83 hctx = malloc(sizeof(HMAC_PKEY_CTX)); 83 if ((hctx = calloc(1, sizeof(HMAC_PKEY_CTX))) == NULL)
84 if (!hctx)
85 return 0; 84 return 0;
86 hctx->md = NULL; 85
87 hctx->ktmp.data = NULL;
88 hctx->ktmp.length = 0;
89 hctx->ktmp.flags = 0;
90 hctx->ktmp.type = V_ASN1_OCTET_STRING; 86 hctx->ktmp.type = V_ASN1_OCTET_STRING;
91 HMAC_CTX_init(&hctx->ctx); 87 HMAC_CTX_init(&hctx->ctx);
92 88