diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-02-26 18:02:36 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-03-03 11:25:39 +0100 |
commit | fb67126ea8a1a9fadb9b60641d84808fc123cd9d (patch) | |
tree | bff46e01abd2dabca35123e422bcbc797a6ef484 /crypto | |
parent | 4e4ae84056133c863860e27ceedae8bd3fb0a402 (diff) |
EVP_PKEY_CTX_get/settable_params: pass provider operation context
This allows making the signature operations return different
settable params when the context is initialized with
EVP_DigestSign/VerifyInit.
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14338)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/evp/asymcipher.c | 4 | ||||
-rw-r--r-- | crypto/evp/exchange.c | 4 | ||||
-rw-r--r-- | crypto/evp/kem.c | 4 | ||||
-rw-r--r-- | crypto/evp/keymgmt_meth.c | 2 | ||||
-rw-r--r-- | crypto/evp/pmeth_lib.c | 32 | ||||
-rw-r--r-- | crypto/evp/signature.c | 4 |
6 files changed, 31 insertions, 19 deletions
diff --git a/crypto/evp/asymcipher.c b/crypto/evp/asymcipher.c index f096c19345..ee8e8662b0 100644 --- a/crypto/evp/asymcipher.c +++ b/crypto/evp/asymcipher.c @@ -452,7 +452,7 @@ const OSSL_PARAM *EVP_ASYM_CIPHER_gettable_ctx_params(const EVP_ASYM_CIPHER *cip return NULL; provctx = ossl_provider_ctx(EVP_ASYM_CIPHER_provider(cip)); - return cip->gettable_ctx_params(provctx); + return cip->gettable_ctx_params(NULL, provctx); } const OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *cip) @@ -463,5 +463,5 @@ const OSSL_PARAM *EVP_ASYM_CIPHER_settable_ctx_params(const EVP_ASYM_CIPHER *cip return NULL; provctx = ossl_provider_ctx(EVP_ASYM_CIPHER_provider(cip)); - return cip->settable_ctx_params(provctx); + return cip->settable_ctx_params(NULL, provctx); } diff --git a/crypto/evp/exchange.c b/crypto/evp/exchange.c index 67f4c5389f..e0f15026c8 100644 --- a/crypto/evp/exchange.c +++ b/crypto/evp/exchange.c @@ -478,7 +478,7 @@ const OSSL_PARAM *EVP_KEYEXCH_gettable_ctx_params(const EVP_KEYEXCH *keyexch) return NULL; provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(keyexch)); - return keyexch->gettable_ctx_params(provctx); + return keyexch->gettable_ctx_params(NULL, provctx); } const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch) @@ -488,5 +488,5 @@ const OSSL_PARAM *EVP_KEYEXCH_settable_ctx_params(const EVP_KEYEXCH *keyexch) if (keyexch == NULL || keyexch->settable_ctx_params == NULL) return NULL; provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(keyexch)); - return keyexch->settable_ctx_params(provctx); + return keyexch->settable_ctx_params(NULL, provctx); } diff --git a/crypto/evp/kem.c b/crypto/evp/kem.c index 2b81cc1586..e26c3502db 100644 --- a/crypto/evp/kem.c +++ b/crypto/evp/kem.c @@ -367,7 +367,7 @@ const OSSL_PARAM *EVP_KEM_gettable_ctx_params(const EVP_KEM *kem) return NULL; provctx = ossl_provider_ctx(EVP_KEM_provider(kem)); - return kem->gettable_ctx_params(provctx); + return kem->gettable_ctx_params(NULL, provctx); } const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem) @@ -378,5 +378,5 @@ const OSSL_PARAM *EVP_KEM_settable_ctx_params(const EVP_KEM *kem) return NULL; provctx = ossl_provider_ctx(EVP_KEM_provider(kem)); - return kem->settable_ctx_params(provctx); + return kem->settable_ctx_params(NULL, provctx); } diff --git a/crypto/evp/keymgmt_meth.c b/crypto/evp/keymgmt_meth.c index aecb7ec368..3142996cab 100644 --- a/crypto/evp/keymgmt_meth.c +++ b/crypto/evp/keymgmt_meth.c @@ -340,7 +340,7 @@ const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt) if (keymgmt->gen_settable_params == NULL) return NULL; - return keymgmt->gen_settable_params(provctx); + return keymgmt->gen_settable_params(NULL, provctx); } void *evp_keymgmt_gen(const EVP_KEYMGMT *keymgmt, void *genctx, diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 478ae40a26..2cc30f1af4 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -744,27 +744,31 @@ const OSSL_PARAM *EVP_PKEY_CTX_gettable_params(EVP_PKEY_CTX *ctx) && ctx->op.kex.exchange != NULL && ctx->op.kex.exchange->gettable_ctx_params != NULL) { provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(ctx->op.kex.exchange)); - return ctx->op.kex.exchange->gettable_ctx_params(provctx); + return ctx->op.kex.exchange->gettable_ctx_params(ctx->op.kex.exchprovctx, + provctx); } if (EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx) && ctx->op.sig.signature != NULL && ctx->op.sig.signature->gettable_ctx_params != NULL) { provctx = ossl_provider_ctx( EVP_SIGNATURE_provider(ctx->op.sig.signature)); - return ctx->op.sig.signature->gettable_ctx_params(provctx); + return ctx->op.sig.signature->gettable_ctx_params(ctx->op.sig.sigprovctx, + provctx); } if (EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx) && ctx->op.ciph.cipher != NULL && ctx->op.ciph.cipher->gettable_ctx_params != NULL) { provctx = ossl_provider_ctx( EVP_ASYM_CIPHER_provider(ctx->op.ciph.cipher)); - return ctx->op.ciph.cipher->gettable_ctx_params(provctx); + return ctx->op.ciph.cipher->gettable_ctx_params(ctx->op.ciph.ciphprovctx, + provctx); } if (EVP_PKEY_CTX_IS_KEM_OP(ctx) && ctx->op.encap.kem != NULL && ctx->op.encap.kem->gettable_ctx_params != NULL) { provctx = ossl_provider_ctx(EVP_KEM_provider(ctx->op.encap.kem)); - return ctx->op.encap.kem->gettable_ctx_params(provctx); + return ctx->op.encap.kem->gettable_ctx_params(ctx->op.encap.kemprovctx, + provctx); } return NULL; } @@ -777,30 +781,38 @@ const OSSL_PARAM *EVP_PKEY_CTX_settable_params(EVP_PKEY_CTX *ctx) && ctx->op.kex.exchange != NULL && ctx->op.kex.exchange->settable_ctx_params != NULL) { provctx = ossl_provider_ctx(EVP_KEYEXCH_provider(ctx->op.kex.exchange)); - return ctx->op.kex.exchange->settable_ctx_params(provctx); + return ctx->op.kex.exchange->settable_ctx_params(ctx->op.kex.exchprovctx, + provctx); } if (EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx) && ctx->op.sig.signature != NULL && ctx->op.sig.signature->settable_ctx_params != NULL) { provctx = ossl_provider_ctx( EVP_SIGNATURE_provider(ctx->op.sig.signature)); - return ctx->op.sig.signature->settable_ctx_params(provctx); + return ctx->op.sig.signature->settable_ctx_params(ctx->op.sig.sigprovctx, + provctx); } if (EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx) && ctx->op.ciph.cipher != NULL && ctx->op.ciph.cipher->settable_ctx_params != NULL) { provctx = ossl_provider_ctx( EVP_ASYM_CIPHER_provider(ctx->op.ciph.cipher)); - return ctx->op.ciph.cipher->settable_ctx_params(provctx); + return ctx->op.ciph.cipher->settable_ctx_params(ctx->op.ciph.ciphprovctx, + provctx); } if (EVP_PKEY_CTX_IS_GEN_OP(ctx) - && ctx->keymgmt != NULL) - return EVP_KEYMGMT_gen_settable_params(ctx->keymgmt); + && ctx->keymgmt != NULL + && ctx->keymgmt->gen_settable_params != NULL) { + provctx = ossl_provider_ctx(EVP_KEYMGMT_provider(ctx->keymgmt)); + return ctx->keymgmt->gen_settable_params(ctx->op.keymgmt.genctx, + provctx); + } if (EVP_PKEY_CTX_IS_KEM_OP(ctx) && ctx->op.encap.kem != NULL && ctx->op.encap.kem->settable_ctx_params != NULL) { provctx = ossl_provider_ctx(EVP_KEM_provider(ctx->op.encap.kem)); - return ctx->op.encap.kem->settable_ctx_params(provctx); + return ctx->op.encap.kem->settable_ctx_params(ctx->op.encap.kemprovctx, + provctx); } return NULL; } diff --git a/crypto/evp/signature.c b/crypto/evp/signature.c index 4a1692ce98..277e972414 100644 --- a/crypto/evp/signature.c +++ b/crypto/evp/signature.c @@ -347,7 +347,7 @@ const OSSL_PARAM *EVP_SIGNATURE_gettable_ctx_params(const EVP_SIGNATURE *sig) return NULL; provctx = ossl_provider_ctx(EVP_SIGNATURE_provider(sig)); - return sig->gettable_ctx_params(provctx); + return sig->gettable_ctx_params(NULL, provctx); } const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig) @@ -358,7 +358,7 @@ const OSSL_PARAM *EVP_SIGNATURE_settable_ctx_params(const EVP_SIGNATURE *sig) return NULL; provctx = ossl_provider_ctx(EVP_SIGNATURE_provider(sig)); - return sig->settable_ctx_params(provctx); + return sig->settable_ctx_params(NULL, provctx); } static int evp_pkey_signature_init(EVP_PKEY_CTX *ctx, int operation) |