summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiod <>2015-02-14 15:10:39 +0000
committermiod <>2015-02-14 15:10:39 +0000
commita50ada071c44ffc00ef0d3ed509d23aa02005dd5 (patch)
treeb9a19a97c2ebad3afbecf7d9352250124866c745
parent6a4ab9711b4115f8a6cc669e925100cfef113829 (diff)
downloadopenbsd-a50ada071c44ffc00ef0d3ed509d23aa02005dd5.tar.gz
openbsd-a50ada071c44ffc00ef0d3ed509d23aa02005dd5.tar.bz2
openbsd-a50ada071c44ffc00ef0d3ed509d23aa02005dd5.zip
Check for allocation error in RSA_eay_mod_exp(). Coverity CID 25217.
ok jsing@
-rw-r--r--src/lib/libcrypto/rsa/rsa.h3
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c6
-rw-r--r--src/lib/libssl/src/crypto/rsa/rsa.h3
-rw-r--r--src/lib/libssl/src/crypto/rsa/rsa_eay.c6
4 files changed, 14 insertions, 4 deletions
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index 8139db0b7d..4045a6cbf3 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa.h,v 1.26 2014/07/12 16:03:37 miod Exp $ */ 1/* $OpenBSD: rsa.h,v 1.27 2015/02/14 15:10:39 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -444,6 +444,7 @@ void ERR_load_RSA_strings(void);
444#define RSA_F_PKEY_RSA_VERIFYRECOVER 141 444#define RSA_F_PKEY_RSA_VERIFYRECOVER 141
445#define RSA_F_RSA_BUILTIN_KEYGEN 129 445#define RSA_F_RSA_BUILTIN_KEYGEN 129
446#define RSA_F_RSA_CHECK_KEY 123 446#define RSA_F_RSA_CHECK_KEY 123
447#define RSA_F_RSA_EAY_MOD_EXP 157
447#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 448#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101
448#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102 449#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102
449#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103 450#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index 0eb18cf3c7..74d40611ee 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_eay.c,v 1.37 2015/02/09 15:49:22 jsing Exp $ */ 1/* $OpenBSD: rsa_eay.c,v 1.38 2015/02/14 15:10:39 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -730,6 +730,10 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
730 r1 = BN_CTX_get(ctx); 730 r1 = BN_CTX_get(ctx);
731 m1 = BN_CTX_get(ctx); 731 m1 = BN_CTX_get(ctx);
732 vrfy = BN_CTX_get(ctx); 732 vrfy = BN_CTX_get(ctx);
733 if (r1 == NULL || m1 == NULL || vrfy == NULL) {
734 RSAerr(RSA_F_RSA_EAY_MOD_EXP, ERR_R_MALLOC_FAILURE);
735 goto err;
736 }
733 737
734 { 738 {
735 BIGNUM local_p, local_q; 739 BIGNUM local_p, local_q;
diff --git a/src/lib/libssl/src/crypto/rsa/rsa.h b/src/lib/libssl/src/crypto/rsa/rsa.h
index 8139db0b7d..4045a6cbf3 100644
--- a/src/lib/libssl/src/crypto/rsa/rsa.h
+++ b/src/lib/libssl/src/crypto/rsa/rsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa.h,v 1.26 2014/07/12 16:03:37 miod Exp $ */ 1/* $OpenBSD: rsa.h,v 1.27 2015/02/14 15:10:39 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -444,6 +444,7 @@ void ERR_load_RSA_strings(void);
444#define RSA_F_PKEY_RSA_VERIFYRECOVER 141 444#define RSA_F_PKEY_RSA_VERIFYRECOVER 141
445#define RSA_F_RSA_BUILTIN_KEYGEN 129 445#define RSA_F_RSA_BUILTIN_KEYGEN 129
446#define RSA_F_RSA_CHECK_KEY 123 446#define RSA_F_RSA_CHECK_KEY 123
447#define RSA_F_RSA_EAY_MOD_EXP 157
447#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101 448#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101
448#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102 449#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102
449#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103 450#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_eay.c b/src/lib/libssl/src/crypto/rsa/rsa_eay.c
index 0eb18cf3c7..74d40611ee 100644
--- a/src/lib/libssl/src/crypto/rsa/rsa_eay.c
+++ b/src/lib/libssl/src/crypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_eay.c,v 1.37 2015/02/09 15:49:22 jsing Exp $ */ 1/* $OpenBSD: rsa_eay.c,v 1.38 2015/02/14 15:10:39 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -730,6 +730,10 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
730 r1 = BN_CTX_get(ctx); 730 r1 = BN_CTX_get(ctx);
731 m1 = BN_CTX_get(ctx); 731 m1 = BN_CTX_get(ctx);
732 vrfy = BN_CTX_get(ctx); 732 vrfy = BN_CTX_get(ctx);
733 if (r1 == NULL || m1 == NULL || vrfy == NULL) {
734 RSAerr(RSA_F_RSA_EAY_MOD_EXP, ERR_R_MALLOC_FAILURE);
735 goto err;
736 }
733 737
734 { 738 {
735 BIGNUM local_p, local_q; 739 BIGNUM local_p, local_q;