mirror of
https://github.com/openssl/openssl.git
synced 2025-02-17 14:32:04 +08:00
Check return value of ossl_parse_property()
Also check if we have d2i_public_key() function pointer. Fixes https://github.com/openssl/openssl/pull/18355#issuecomment-1144893289 Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18462)
This commit is contained in:
parent
697d0b5ba1
commit
4fa5ed5ce5
@ -191,8 +191,11 @@ void *ossl_decoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef,
|
||||
return NULL;
|
||||
}
|
||||
decoder->base.algodef = algodef;
|
||||
decoder->base.parsed_propdef
|
||||
= ossl_parse_property(libctx, algodef->property_definition);
|
||||
if ((decoder->base.parsed_propdef
|
||||
= ossl_parse_property(libctx, algodef->property_definition)) == NULL) {
|
||||
OSSL_DECODER_free(decoder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (; fns->function_id != 0; fns++) {
|
||||
switch (fns->function_id) {
|
||||
|
@ -191,8 +191,11 @@ static void *encoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef,
|
||||
return NULL;
|
||||
}
|
||||
encoder->base.algodef = algodef;
|
||||
encoder->base.parsed_propdef
|
||||
= ossl_parse_property(libctx, algodef->property_definition);
|
||||
if ((encoder->base.parsed_propdef
|
||||
= ossl_parse_property(libctx, algodef->property_definition)) == NULL) {
|
||||
OSSL_ENCODER_free(encoder);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (; fns->function_id != 0; fns++) {
|
||||
switch (fns->function_id) {
|
||||
|
@ -227,7 +227,7 @@ static int der2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection,
|
||||
derp = der;
|
||||
if (ctx->desc->d2i_PUBKEY != NULL)
|
||||
key = ctx->desc->d2i_PUBKEY(NULL, &derp, der_len);
|
||||
else
|
||||
else if (ctx->desc->d2i_public_key != NULL)
|
||||
key = ctx->desc->d2i_public_key(NULL, &derp, der_len);
|
||||
if (key == NULL && ctx->selection != 0) {
|
||||
ERR_clear_last_mark();
|
||||
|
Loading…
Reference in New Issue
Block a user