diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-02 22:01:12 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-12 08:27:11 +1000 |
commit | 5a084c5f0b5ebd9be6de0e09b75215e9c3094db1 (patch) | |
tree | c2b91fdb553351c16e9521adece8e47151222c86 /providers | |
parent | 2b2f4f9b1bba61e989adddc7affcdbe5d89c7c05 (diff) |
prov: update KEM to support params on init()
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14383)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/kem/rsa_kem.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/providers/implementations/kem/rsa_kem.c b/providers/implementations/kem/rsa_kem.c index 559d7d0c52..36bcea3506 100644 --- a/providers/implementations/kem/rsa_kem.c +++ b/providers/implementations/kem/rsa_kem.c @@ -117,7 +117,8 @@ static void *rsakem_dupctx(void *vprsactx) return dstctx; } -static int rsakem_init(void *vprsactx, void *vrsa, int operation) +static int rsakem_init(void *vprsactx, void *vrsa, + const OSSL_PARAM params[], int operation) { PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx; @@ -130,26 +131,26 @@ static int rsakem_init(void *vprsactx, void *vrsa, int operation) ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH); return 0; } - return 1; + return rsakem_set_ctx_params(prsactx, params); } -static int rsakem_encapsulate_init(void *vprsactx, void *vrsa) +static int rsakem_encapsulate_init(void *vprsactx, void *vrsa, + const OSSL_PARAM params[]) { - return rsakem_init(vprsactx, vrsa, EVP_PKEY_OP_ENCAPSULATE); + return rsakem_init(vprsactx, vrsa, params, EVP_PKEY_OP_ENCAPSULATE); } -static int rsakem_decapsulate_init(void *vprsactx, void *vrsa) +static int rsakem_decapsulate_init(void *vprsactx, void *vrsa, + const OSSL_PARAM params[]) { - return rsakem_init(vprsactx, vrsa, EVP_PKEY_OP_DECAPSULATE); + return rsakem_init(vprsactx, vrsa, params, EVP_PKEY_OP_DECAPSULATE); } static int rsakem_get_ctx_params(void *vprsactx, OSSL_PARAM *params) { PROV_RSA_CTX *ctx = (PROV_RSA_CTX *)vprsactx; - if (ctx == NULL || params == NULL) - return 0; - return 1; + return ctx != NULL; } static const OSSL_PARAM known_gettable_rsakem_ctx_params[] = { @@ -168,8 +169,11 @@ static int rsakem_set_ctx_params(void *vprsactx, const OSSL_PARAM params[]) const OSSL_PARAM *p; int op; - if (prsactx == NULL || params == NULL) + if (prsactx == NULL) return 0; + if (params == NULL) + return 1; + p = OSSL_PARAM_locate_const(params, OSSL_KEM_PARAM_OPERATION); if (p != NULL) { |