summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-02-26 10:08:45 +1000
committerPauli <ppzgs1@gmail.com>2021-02-28 17:25:49 +1000
commit36fae6e85a12c46b48d82762911c74e53ec0cc13 (patch)
treec7807d0bb33d82ee69931bc54f3ab9c7cd2f790e
parentbb0ab821f38427576e4f25bb66818bc297ee8b22 (diff)
crypto: add additional argument to KDF derive calls
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14310)
-rw-r--r--crypto/dh/dh_kdf.c3
-rw-r--r--crypto/ec/ecdh_kdf.c3
-rw-r--r--crypto/evp/p5_crpt2.c3
-rw-r--r--crypto/evp/pbe_scrypt.c3
-rw-r--r--crypto/pkcs12/p12_key.c2
5 files changed, 5 insertions, 9 deletions
diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c
index e1753b0b69..03e45aead9 100644
--- a/crypto/dh/dh_kdf.c
+++ b/crypto/dh/dh_kdf.c
@@ -53,8 +53,7 @@ int ossl_dh_kdf_X9_42_asn1(unsigned char *out, size_t outlen,
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_CEK_ALG,
(char *)cek_alg, 0);
*p = OSSL_PARAM_construct_end();
- ret = EVP_KDF_CTX_set_params(kctx, params) > 0
- && EVP_KDF_derive(kctx, out, outlen) > 0;
+ ret = EVP_KDF_derive(kctx, out, outlen, params) > 0;
err:
EVP_KDF_CTX_free(kctx);
EVP_KDF_free(kdf);
diff --git a/crypto/ec/ecdh_kdf.c b/crypto/ec/ecdh_kdf.c
index 60e976a95f..450e2a872b 100644
--- a/crypto/ec/ecdh_kdf.c
+++ b/crypto/ec/ecdh_kdf.c
@@ -42,8 +42,7 @@ int ossl_ecdh_kdf_X9_63(unsigned char *out, size_t outlen,
(void *)sinfo, sinfolen);
*p = OSSL_PARAM_construct_end();
- ret = EVP_KDF_CTX_set_params(kctx, params) > 0
- && EVP_KDF_derive(kctx, out, outlen) > 0;
+ ret = EVP_KDF_derive(kctx, out, outlen, params) > 0;
EVP_KDF_CTX_free(kctx);
}
EVP_KDF_free(kdf);
diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c
index c097210bd4..dff3310ded 100644
--- a/crypto/evp/p5_crpt2.c
+++ b/crypto/evp/p5_crpt2.c
@@ -55,8 +55,7 @@ int pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen,
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
(char *)mdname, 0);
*p = OSSL_PARAM_construct_end();
- if (EVP_KDF_CTX_set_params(kctx, params) != 1
- || EVP_KDF_derive(kctx, out, keylen) != 1)
+ if (EVP_KDF_derive(kctx, out, keylen, params) != 1)
rv = 0;
EVP_KDF_CTX_free(kctx);
diff --git a/crypto/evp/pbe_scrypt.c b/crypto/evp/pbe_scrypt.c
index f7656324f6..be881b32fb 100644
--- a/crypto/evp/pbe_scrypt.c
+++ b/crypto/evp/pbe_scrypt.c
@@ -79,8 +79,7 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen,
*z++ = OSSL_PARAM_construct_uint64(OSSL_KDF_PARAM_SCRYPT_P, &p);
*z++ = OSSL_PARAM_construct_uint64(OSSL_KDF_PARAM_SCRYPT_MAXMEM, &maxmem);
*z = OSSL_PARAM_construct_end();
- if (EVP_KDF_CTX_set_params(kctx, params) != 1
- || EVP_KDF_derive(kctx, key, keylen) != 1)
+ if (EVP_KDF_derive(kctx, key, keylen, params) != 1)
rv = 0;
EVP_KDF_CTX_free(kctx);
diff --git a/crypto/pkcs12/p12_key.c b/crypto/pkcs12/p12_key.c
index 7c4056a8f8..8c7be88cd2 100644
--- a/crypto/pkcs12/p12_key.c
+++ b/crypto/pkcs12/p12_key.c
@@ -105,7 +105,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
BIO_printf(trc_out, "\n");
} OSSL_TRACE_END(PKCS12_KEYGEN);
- if (EVP_KDF_derive(ctx, out, (size_t)n)) {
+ if (EVP_KDF_derive(ctx, out, (size_t)n, NULL)) {
res = 1;
OSSL_TRACE_BEGIN(PKCS12_KEYGEN) {
BIO_printf(trc_out, "Output KEY (length %d)\n", n);