diff options
author | tb <> | 2022-05-05 08:14:14 +0000 |
---|---|---|
committer | tb <> | 2022-05-05 08:14:14 +0000 |
commit | b06d1d1bb0d6160981d03e7d84fc54f140121397 (patch) | |
tree | 27ff9313c48993c1bc35210a1079e7531416616d /src/lib | |
parent | 814afe4b90a7c4ffcfd25c1cea43f87cd35aef58 (diff) | |
download | openbsd-b06d1d1bb0d6160981d03e7d84fc54f140121397.tar.gz openbsd-b06d1d1bb0d6160981d03e7d84fc54f140121397.tar.bz2 openbsd-b06d1d1bb0d6160981d03e7d84fc54f140121397.zip |
Translate from OpenSSL's HKDF API to BoringSSL API.
ok beck jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/kdf/hkdf_evp.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/libcrypto/kdf/hkdf_evp.c b/src/lib/libcrypto/kdf/hkdf_evp.c index 37cdd92ba6..36eae19e2b 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.13 2022/05/05 08:10:39 tb Exp $ */ | 1 | /* $OpenBSD: hkdf_evp.c,v 1.14 2022/05/05 08:14:14 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 | * |
@@ -242,21 +242,20 @@ pkey_hkdf_derive(EVP_PKEY_CTX *ctx, unsigned char *key, | |||
242 | 242 | ||
243 | switch (kctx->mode) { | 243 | switch (kctx->mode) { |
244 | case EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND: | 244 | case EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND: |
245 | return HKDF(kctx->md, kctx->salt, kctx->salt_len, kctx->key, | 245 | return HKDF(key, *keylen, kctx->md, kctx->salt, kctx->salt_len, |
246 | kctx->key_len, kctx->info, kctx->info_len, key, | 246 | kctx->key, kctx->key_len, kctx->info, kctx->info_len); |
247 | *keylen) != NULL; | ||
248 | 247 | ||
249 | case EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY: | 248 | case EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY: |
250 | if (key == NULL) { | 249 | if (key == NULL) { |
251 | *keylen = EVP_MD_size(kctx->md); | 250 | *keylen = EVP_MD_size(kctx->md); |
252 | return 1; | 251 | return 1; |
253 | } | 252 | } |
254 | return HKDF_Extract(kctx->md, kctx->salt, kctx->salt_len, | 253 | return HKDF_extract(key, keylen, kctx->md, kctx->salt, |
255 | kctx->key, kctx->key_len, key, keylen) != NULL; | 254 | kctx->salt_len, kctx->key, kctx->key_len); |
256 | 255 | ||
257 | case EVP_PKEY_HKDEF_MODE_EXPAND_ONLY: | 256 | case EVP_PKEY_HKDEF_MODE_EXPAND_ONLY: |
258 | return HKDF_Expand(kctx->md, kctx->key, kctx->key_len, | 257 | return HKDF_expand(key, *keylen, kctx->md, kctx->key, |
259 | kctx->info, kctx->info_len, key, *keylen) != NULL; | 258 | kctx->key_len, kctx->info, kctx->info_len); |
260 | 259 | ||
261 | default: | 260 | default: |
262 | return 0; | 261 | return 0; |