diff options
author | Richard Levitte <levitte@openssl.org> | 2020-10-26 13:58:30 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-11-11 11:42:06 +0100 |
commit | 4f2abe4378ce561c60674f3ac0642d3fb22da550 (patch) | |
tree | 1323103417d4e0a995723bf97a3fa1e5f14398ae /crypto/cms | |
parent | 2c090c1d1b00fe49dd2911674e26c629f123c44f (diff) |
Adapt libcrypto functionality to specify the desired input structure
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13248)
Diffstat (limited to 'crypto/cms')
-rw-r--r-- | crypto/cms/cms_ec.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/crypto/cms/cms_ec.c b/crypto/cms/cms_ec.c index 9a602bb81d..5dac7f0683 100644 --- a/crypto/cms/cms_ec.c +++ b/crypto/cms/cms_ec.c @@ -24,23 +24,16 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval, if (ptype == V_ASN1_SEQUENCE) { const ASN1_STRING *pstr = pval; const unsigned char *pm = pstr->data; - int pmlen = pstr->length; + size_t pmlen = (size_t)pstr->length; OSSL_DECODER_CTX *ctx = NULL; - BIO *membio = NULL; + int selection = OSSL_KEYMGMT_SELECT_ALL_PARAMETERS; - /* TODO(3.0): Need to be able to specify here that only params will do */ - ctx = OSSL_DECODER_CTX_new_by_EVP_PKEY(&pkey, "DER", "EC", libctx, - propq); + ctx = OSSL_DECODER_CTX_new_by_EVP_PKEY(&pkey, "DER", NULL, "EC", + selection, libctx, propq); if (ctx == NULL) goto err; - membio = BIO_new_mem_buf(pm, pmlen); - if (membio == NULL) { - OSSL_DECODER_CTX_free(ctx); - goto err; - } - OSSL_DECODER_from_bio(ctx, membio); - BIO_free(membio); + OSSL_DECODER_from_data(ctx, &pm, &pmlen); OSSL_DECODER_CTX_free(ctx); } else if (ptype == V_ASN1_OBJECT) { const ASN1_OBJECT *poid = pval; |