summaryrefslogtreecommitdiffstats
path: root/crypto/evp/m_sigver.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-09-02 15:54:13 +0200
committerRichard Levitte <levitte@openssl.org>2020-09-08 12:06:35 +0200
commit86df26b3943509219057ae87f8764b3c15e0d8b8 (patch)
tree8e30eef381d0c2a77af161894bb4d9f7d0663b00 /crypto/evp/m_sigver.c
parentNew GOST PKCS12 standard support (diff)
downloadopenssl-86df26b3943509219057ae87f8764b3c15e0d8b8.tar.xz
openssl-86df26b3943509219057ae87f8764b3c15e0d8b8.zip
EVP: Add support for delayed EVP_PKEY operation parameters
They get called "delayed parameters" because they may make it to the implementation at a later time than when they're given. This currently only covers the distinguished ID, as that's the only EVP_PKEY operation parameter so far that has been possible to give before the operation has been initialized. This includes a re-implementation of EVP_PKEY_CTX_set1_id(), EVP_PKEY_CTX_get1_id(), and EVP_PKEY_CTX_get1_id_len(). Also, the more rigorous controls of keytype and optype are restored. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12789)
Diffstat (limited to 'crypto/evp/m_sigver.c')
-rw-r--r--crypto/evp/m_sigver.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/crypto/evp/m_sigver.c b/crypto/evp/m_sigver.c
index 0278d9ca09..a60d6e770b 100644
--- a/crypto/evp/m_sigver.c
+++ b/crypto/evp/m_sigver.c
@@ -204,7 +204,8 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
mdname, provkey);
}
- return ret ? 1 : 0;
+ goto end;
+
err:
evp_pkey_ctx_free_old_ops(locpctx);
locpctx->operation = EVP_PKEY_OP_UNDEFINED;
@@ -279,7 +280,15 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
if (ctx->pctx->pmeth->digest_custom != NULL)
ctx->pctx->flag_call_digest_custom = 1;
- return 1;
+ ret = 1;
+
+ end:
+#ifndef FIPS_MODULE
+ if (ret > 0)
+ ret = evp_pkey_ctx_use_cached_data(locpctx);
+#endif
+
+ return ret > 0 ? 1 : 0;
}
int EVP_DigestSignInit_with_libctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,