return sz;
}
-static int kdf_hkdf_derive(void *vctx, unsigned char *key, size_t keylen)
+static int kdf_hkdf_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KDF_HKDF *ctx = (KDF_HKDF *)vctx;
const EVP_MD *md;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !kdf_hkdf_set_ctx_params(ctx, params))
return 0;
md = ossl_prov_digest_md(&ctx->digest);
return ret;
}
-static int kbkdf_derive(void *vctx, unsigned char *key, size_t keylen)
+static int kbkdf_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KBKDF *ctx = (KBKDF *)vctx;
int ret = 0;
uint32_t l = 0;
size_t h = 0;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !kbkdf_set_ctx_params(ctx, params))
return 0;
/* label, context, and iv are permitted to be empty. Check everything
return OSSL_PARAM_get_octet_string(p, (void **)dst, 0, dst_len);
}
-static int krb5kdf_derive(void *vctx, unsigned char *key,
- size_t keylen)
+static int krb5kdf_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KRB5KDF_CTX *ctx = (KRB5KDF_CTX *)vctx;
const EVP_CIPHER *cipher;
ENGINE *engine;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !krb5kdf_set_ctx_params(ctx, params))
return 0;
cipher = ossl_prov_cipher_cipher(&ctx->cipher);
return 1;
}
-static int kdf_pbkdf2_derive(void *vctx, unsigned char *key,
- size_t keylen)
+static int kdf_pbkdf2_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KDF_PBKDF2 *ctx = (KDF_PBKDF2 *)vctx;
const EVP_MD *md;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !kdf_pbkdf2_set_ctx_params(ctx, params))
return 0;
if (ctx->pass == NULL) {
return 1;
}
-static int kdf_pkcs12_derive(void *vctx, unsigned char *key,
- size_t keylen)
+static int kdf_pkcs12_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KDF_PKCS12 *ctx = (KDF_PKCS12 *)vctx;
const EVP_MD *md;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !kdf_pkcs12_set_ctx_params(ctx, params))
return 0;
if (ctx->pass == NULL) {
return 1;
}
-static int kdf_scrypt_derive(void *vctx, unsigned char *key,
- size_t keylen)
+static int kdf_scrypt_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KDF_SCRYPT *ctx = (KDF_SCRYPT *)vctx;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !kdf_scrypt_set_ctx_params(ctx, params))
return 0;
if (ctx->pass == NULL) {
return OSSL_PARAM_get_octet_string(p, (void **)dst, 0, dst_len);
}
-static int kdf_sshkdf_derive(void *vctx, unsigned char *key,
- size_t keylen)
+static int kdf_sshkdf_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KDF_SSHKDF *ctx = (KDF_SSHKDF *)vctx;
const EVP_MD *md;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !kdf_sshkdf_set_ctx_params(ctx, params))
return 0;
md = ossl_prov_digest_md(&ctx->digest);
return (len <= 0) ? 0 : (size_t)len;
}
-static int sskdf_derive(void *vctx, unsigned char *key, size_t keylen)
+static int sskdf_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
const EVP_MD *md;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !sskdf_set_ctx_params(ctx, params))
return 0;
if (ctx->secret == NULL) {
ERR_raise(ERR_LIB_PROV, PROV_R_MISSING_SECRET);
}
}
-static int x963kdf_derive(void *vctx, unsigned char *key, size_t keylen)
+static int x963kdf_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KDF_SSKDF *ctx = (KDF_SSKDF *)vctx;
const EVP_MD *md;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !sskdf_set_ctx_params(ctx, params))
return 0;
if (ctx->secret == NULL) {
ctx->provctx = provctx;
}
-static int kdf_tls1_prf_derive(void *vctx, unsigned char *key,
- size_t keylen)
+static int kdf_tls1_prf_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
TLS1_PRF *ctx = (TLS1_PRF *)vctx;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !kdf_tls1_prf_set_ctx_params(ctx, params))
return 0;
if (ctx->P_hash == NULL) {
return (len <= 0) ? 0 : (size_t)len;
}
-static int x942kdf_derive(void *vctx, unsigned char *key, size_t keylen)
+static int x942kdf_derive(void *vctx, unsigned char *key, size_t keylen,
+ const OSSL_PARAM params[])
{
KDF_X942 *ctx = (KDF_X942 *)vctx;
const EVP_MD *md;
unsigned char *der = NULL;
size_t der_len = 0;
- if (!ossl_prov_is_running())
+ if (!ossl_prov_is_running() || !x942kdf_set_ctx_params(ctx, params))
return 0;
/*