Browse Source

prov: add extra params argument to KDF implementations

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14383)
master
Pauli 1 year ago
parent
commit
c983a0e521
10 changed files with 29 additions and 0 deletions
  1. +3
    -0
      providers/implementations/kdfs/hkdf.c
  2. +3
    -0
      providers/implementations/kdfs/kbkdf.c
  3. +3
    -0
      providers/implementations/kdfs/krb5kdf.c
  4. +3
    -0
      providers/implementations/kdfs/pbkdf2.c
  5. +3
    -0
      providers/implementations/kdfs/pkcs12kdf.c
  6. +3
    -0
      providers/implementations/kdfs/scrypt.c
  7. +3
    -0
      providers/implementations/kdfs/sshkdf.c
  8. +3
    -0
      providers/implementations/kdfs/sskdf.c
  9. +3
    -0
      providers/implementations/kdfs/tls1_prf.c
  10. +2
    -0
      providers/implementations/kdfs/x942kdf.c

+ 3
- 0
providers/implementations/kdfs/hkdf.c View File

@ -172,6 +172,9 @@ static int kdf_hkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
int n;
if (params == NULL)
return 1;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
return 0;


+ 3
- 0
providers/implementations/kdfs/kbkdf.c View File

@ -282,6 +282,9 @@ static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
const OSSL_PARAM *p;
if (params == NULL)
return 1;
if (!ossl_prov_macctx_load_from_params(&ctx->ctx_init, params, NULL,
NULL, NULL, libctx))
return 0;


+ 3
- 0
providers/implementations/kdfs/krb5kdf.c View File

@ -136,6 +136,9 @@ static int krb5kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
KRB5KDF_CTX *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
if (params == NULL)
return 1;
if (!ossl_prov_cipher_load_from_params(&ctx->cipher, params, provctx))
return 0;


+ 3
- 0
providers/implementations/kdfs/pbkdf2.c View File

@ -172,6 +172,9 @@ static int kdf_pbkdf2_set_ctx_params(void *vctx, const OSSL_PARAM params[])
int pkcs5;
uint64_t iter, min_iter;
if (params == NULL)
return 1;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
return 0;


+ 3
- 0
providers/implementations/kdfs/pkcs12kdf.c View File

@ -225,6 +225,9 @@ static int kdf_pkcs12_set_ctx_params(void *vctx, const OSSL_PARAM params[])
KDF_PKCS12 *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
if (params == NULL)
return 1;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
return 0;


+ 3
- 0
providers/implementations/kdfs/scrypt.c View File

@ -185,6 +185,9 @@ static int kdf_scrypt_set_ctx_params(void *vctx, const OSSL_PARAM params[])
KDF_SCRYPT *ctx = vctx;
uint64_t u64_value;
if (params == NULL)
return 1;
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_PASSWORD)) != NULL)
if (!scrypt_set_membuf(&ctx->pass, &ctx->pass_len, p))
return 0;


+ 3
- 0
providers/implementations/kdfs/sshkdf.c View File

@ -136,6 +136,9 @@ static int kdf_sshkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
KDF_SSHKDF *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
if (params == NULL)
return 1;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
return 0;


+ 3
- 0
providers/implementations/kdfs/sskdf.c View File

@ -449,6 +449,9 @@ static int sskdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
size_t sz;
if (params == NULL)
return 1;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, libctx))
return 0;


+ 3
- 0
providers/implementations/kdfs/tls1_prf.c View File

@ -168,6 +168,9 @@ static int kdf_tls1_prf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
TLS1_PRF *ctx = vctx;
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
if (params == NULL)
return 1;
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_DIGEST)) != NULL) {
if (strcasecmp(p->data, SN_md5_sha1) == 0) {
if (!ossl_prov_macctx_load_from_params(&ctx->P_hash, params,


+ 2
- 0
providers/implementations/kdfs/x942kdf.c View File

@ -472,6 +472,8 @@ static int x942kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
const char *propq = NULL;
size_t id;
if (params == NULL)
return 1;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
return 0;


Loading…
Cancel
Save