summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/rsa/rsa_ameth.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c
index 228793b05c..b2f6b2f79b 100644
--- a/src/lib/libcrypto/rsa/rsa_ameth.c
+++ b/src/lib/libcrypto/rsa/rsa_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_ameth.c,v 1.51 2023/11/09 08:29:53 tb Exp $ */ 1/* $OpenBSD: rsa_ameth.c,v 1.52 2023/12/28 21:57:08 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -204,13 +204,22 @@ static int
204old_rsa_priv_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) 204old_rsa_priv_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen)
205{ 205{
206 RSA *rsa; 206 RSA *rsa;
207 int ret = 0;
207 208
208 if ((rsa = d2i_RSAPrivateKey(NULL, pder, derlen)) == NULL) { 209 if ((rsa = d2i_RSAPrivateKey(NULL, pder, derlen)) == NULL) {
209 RSAerror(ERR_R_RSA_LIB); 210 RSAerror(ERR_R_RSA_LIB);
210 return 0; 211 goto err;
211 } 212 }
212 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa); 213 if (!EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa))
213 return 1; 214 goto err;
215 rsa = NULL;
216
217 ret = 1;
218
219 err:
220 RSA_free(rsa);
221
222 return ret;
214} 223}
215 224
216static int 225static int