mirror of
https://github.com/openssl/openssl.git
synced 2024-11-28 04:25:31 +08:00
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)
This commit is contained in:
parent
bb0ab821f3
commit
36fae6e85a
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user