Fix possible null pointer dereference of evp_pkey_get_legacy()
authorZhou Qingyang <zhou1615@umn.edu>
Fri, 25 Mar 2022 12:28:32 +0000 (20:28 +0800)
committerTomas Mraz <tomas@openssl.org>
Thu, 2 Jun 2022 10:06:08 +0000 (12:06 +0200)
commitb9a86d5dd8b5bd33be42390bcbb5121fe0ae71a1
tree53c1b7060e1819d6de264e2b3e4e33e37568073e
parentc4ed6f6f0ee700e0473def049659061dd52fd3fc
Fix possible null pointer dereference of evp_pkey_get_legacy()

evp_pkey_get_legacy() will return NULL on failure, however several
uses of it or its wrappers does not check the return value of
evp_pkey_get_legacy(), which could lead to NULL pointer dereference.

Fix those possible bugs by adding NULL checking.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17967)
crypto/dh/dh_ameth.c
crypto/ec/ecx_meth.c
crypto/evp/p_dec.c
crypto/evp/p_enc.c