diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-14 15:10:40 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-14 15:10:40 +0000 |
commit | 1744238599e41009da007cce7ee10086870fd8fc (patch) | |
tree | b203d3751cd149efc4ce96eff8bb40703061e5b5 /lib | |
parent | dbae4175486044c483b95a0ddc22c8cb56a1773e (diff) |
Check for allocation error in RSA_eay_mod_exp(). Coverity CID 25217.
ok jsing@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libssl/src/crypto/rsa/rsa.h | 3 | ||||
-rw-r--r-- | lib/libssl/src/crypto/rsa/rsa_eay.c | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/libssl/src/crypto/rsa/rsa.h b/lib/libssl/src/crypto/rsa/rsa.h index 8139db0b7d3..4045a6cbf37 100644 --- a/lib/libssl/src/crypto/rsa/rsa.h +++ b/lib/libssl/src/crypto/rsa/rsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa.h,v 1.26 2014/07/12 16:03:37 miod Exp $ */ +/* $OpenBSD: rsa.h,v 1.27 2015/02/14 15:10:39 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -444,6 +444,7 @@ void ERR_load_RSA_strings(void); #define RSA_F_PKEY_RSA_VERIFYRECOVER 141 #define RSA_F_RSA_BUILTIN_KEYGEN 129 #define RSA_F_RSA_CHECK_KEY 123 +#define RSA_F_RSA_EAY_MOD_EXP 157 #define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 #define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102 #define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103 diff --git a/lib/libssl/src/crypto/rsa/rsa_eay.c b/lib/libssl/src/crypto/rsa/rsa_eay.c index 0eb18cf3c79..74d40611ee5 100644 --- a/lib/libssl/src/crypto/rsa/rsa_eay.c +++ b/lib/libssl/src/crypto/rsa/rsa_eay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_eay.c,v 1.37 2015/02/09 15:49:22 jsing Exp $ */ +/* $OpenBSD: rsa_eay.c,v 1.38 2015/02/14 15:10:39 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -730,6 +730,10 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) r1 = BN_CTX_get(ctx); m1 = BN_CTX_get(ctx); vrfy = BN_CTX_get(ctx); + if (r1 == NULL || m1 == NULL || vrfy == NULL) { + RSAerr(RSA_F_RSA_EAY_MOD_EXP, ERR_R_MALLOC_FAILURE); + goto err; + } { BIGNUM local_p, local_q; |