diff options
author | tb <> | 2022-05-05 08:05:58 +0000 |
---|---|---|
committer | tb <> | 2022-05-05 08:05:58 +0000 |
commit | 9686a747de8432bf02f35760df72f966ab0e6df6 (patch) | |
tree | 1bce923b96d7a8cbc319b8601243a6a00feb5972 /src/lib | |
parent | 5dacca056519d91bbe99d9d310061fb9ee99a68e (diff) | |
download | openbsd-9686a747de8432bf02f35760df72f966ab0e6df6.tar.gz openbsd-9686a747de8432bf02f35760df72f966ab0e6df6.tar.bz2 openbsd-9686a747de8432bf02f35760df72f966ab0e6df6.zip |
Inline OPENSSL_memdup() using malloc() + memcpy()
ok beck jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/kdf/hkdf_evp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libcrypto/kdf/hkdf_evp.c b/src/lib/libcrypto/kdf/hkdf_evp.c index 9aad4f1295..d67c5f41b8 100644 --- a/src/lib/libcrypto/kdf/hkdf_evp.c +++ b/src/lib/libcrypto/kdf/hkdf_evp.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: hkdf_evp.c,v 1.10 2022/05/05 08:03:11 tb Exp $ */ | 1 | /* $OpenBSD: hkdf_evp.c,v 1.11 2022/05/05 08:05:58 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2016-2018 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -124,9 +124,10 @@ pkey_hkdf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | |||
124 | if (kctx->salt != NULL) | 124 | if (kctx->salt != NULL) |
125 | freezero(kctx->salt, kctx->salt_len); | 125 | freezero(kctx->salt, kctx->salt_len); |
126 | 126 | ||
127 | kctx->salt = OPENSSL_memdup(p2, p1); | 127 | kctx->salt = malloc(p1); |
128 | if (kctx->salt == NULL) | 128 | if (kctx->salt == NULL) |
129 | return 0; | 129 | return 0; |
130 | memcpy(ktx->salt, p2, p1); | ||
130 | 131 | ||
131 | kctx->salt_len = p1; | 132 | kctx->salt_len = p1; |
132 | return 1; | 133 | return 1; |
@@ -138,9 +139,10 @@ pkey_hkdf_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | |||
138 | if (kctx->key != NULL) | 139 | if (kctx->key != NULL) |
139 | freezero(kctx->key, kctx->key_len); | 140 | freezero(kctx->key, kctx->key_len); |
140 | 141 | ||
141 | kctx->key = OPENSSL_memdup(p2, p1); | 142 | kctx->key = malloc(p1); |
142 | if (kctx->key == NULL) | 143 | if (kctx->key == NULL) |
143 | return 0; | 144 | return 0; |
145 | memcpy(kctx->key, p2, p1); | ||
144 | 146 | ||
145 | kctx->key_len = p1; | 147 | kctx->key_len = p1; |
146 | return 1; | 148 | return 1; |