summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-09-22 15:57:19 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-09-23 17:31:40 +1000
commite771249c4f6bfb5b49d2c018447bcaa0039fd862 (patch)
treecec250bc21e19fc21d9ddab0b46955e0b5479cad /providers
parent0ecec0fa081a717db49d2ae10135cf285b95409d (diff)
Fix propq in x942kdf
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12944)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/kdfs/x942kdf.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/providers/implementations/kdfs/x942kdf.c b/providers/implementations/kdfs/x942kdf.c
index 9dfa8693de..4410ed8dd9 100644
--- a/providers/implementations/kdfs/x942kdf.c
+++ b/providers/implementations/kdfs/x942kdf.c
@@ -67,13 +67,14 @@ static const struct {
#endif
};
-static int find_alg_id(OPENSSL_CTX *libctx, const char *algname, size_t *id)
+static int find_alg_id(OPENSSL_CTX *libctx, const char *algname,
+ const char *propq, size_t *id)
{
int ret = 1;
size_t i;
EVP_CIPHER *cipher;
- cipher = EVP_CIPHER_fetch(libctx, algname, NULL);
+ cipher = EVP_CIPHER_fetch(libctx, algname, propq);
if (cipher != NULL) {
for (i = 0; i < OSSL_NELEM(kek_algs); i++) {
if (EVP_CIPHER_is_a(cipher, kek_algs[i].name)) {
@@ -381,9 +382,10 @@ static int x942kdf_derive(void *vctx, unsigned char *key, size_t keylen)
static int x942kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
- const OSSL_PARAM *p;
+ const OSSL_PARAM *p, *pq;
KDF_X942 *ctx = vctx;
OPENSSL_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
+ const char *propq = NULL;
size_t id;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
@@ -401,7 +403,14 @@ static int x942kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_CEK_ALG)) != NULL) {
if (p->data_type != OSSL_PARAM_UTF8_STRING)
return 0;
- if (find_alg_id(provctx, p->data, &id) == 0)
+ pq = OSSL_PARAM_locate_const(params, OSSL_ALG_PARAM_PROPERTIES);
+ /*
+ * We already grab the properties during ossl_prov_digest_load_from_params()
+ * so there is no need to check the validity again..
+ */
+ if (pq != NULL)
+ propq = p->data;
+ if (find_alg_id(provctx, p->data, propq, &id) == 0)
return 0;
ctx->cek_oid = kek_algs[id].oid;
ctx->cek_oid_len = kek_algs[id].oid_len;