Fix X509_ALGOR_set0() usage in rsa_alg_set_oaep_padding()
authortb <tb@openbsd.org>
Thu, 9 Nov 2023 08:29:53 +0000 (08:29 +0000)
committertb <tb@openbsd.org>
Thu, 9 Nov 2023 08:29:53 +0000 (08:29 +0000)
commitadf90ca0f0e59cd2bbe98f5a8353dac76aa39e2b
tree917d1835d26be96cda0e1f25383fac66b28fabbc
parent6b23e18ab46e2a89db1d0a4515dee5986511cf9b
Fix X509_ALGOR_set0() usage in rsa_alg_set_oaep_padding()

Replace X509_ALGOR_set0() with X509_ALGOR_set0_by_nid(). This way there
is no missing error checking for OBJ_nid2obj() and no nested functions.
Slightly more importantly, this plugs two long standing potential leaks
in this function (or previously rsa_cms_encrypt()) due to missing error
checking: in the unlikely event that X509_ALGOR_set0() failed, astr/ostr
would leak.

ok jsing
lib/libcrypto/rsa/rsa_ameth.c