diff options
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_crpt.c | 11 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_eay.c | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_gen.c | 14 |
3 files changed, 17 insertions, 14 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_crpt.c b/src/lib/libcrypto/rsa/rsa_crpt.c index b057dd2201..cf7f9a328b 100644 --- a/src/lib/libcrypto/rsa/rsa_crpt.c +++ b/src/lib/libcrypto/rsa/rsa_crpt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_crpt.c,v 1.12 2014/10/18 17:20:40 jsing Exp $ */ | 1 | /* $OpenBSD: rsa_crpt.c,v 1.13 2015/02/09 15:49:22 jsing 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 | * |
@@ -145,10 +145,11 @@ rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p, const BIGNUM *q, | |||
145 | return NULL; | 145 | return NULL; |
146 | 146 | ||
147 | BN_CTX_start(ctx); | 147 | BN_CTX_start(ctx); |
148 | r0 = BN_CTX_get(ctx); | 148 | if ((r0 = BN_CTX_get(ctx)) == NULL) |
149 | r1 = BN_CTX_get(ctx); | 149 | goto err; |
150 | r2 = BN_CTX_get(ctx); | 150 | if ((r1 = BN_CTX_get(ctx)) == NULL) |
151 | if (r2 == NULL) | 151 | goto err; |
152 | if ((r2 = BN_CTX_get(ctx)) == NULL) | ||
152 | goto err; | 153 | goto err; |
153 | 154 | ||
154 | if (!BN_sub(r1, p, BN_value_one())) | 155 | if (!BN_sub(r1, p, BN_value_one())) |
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index f8031c87a2..0eb18cf3c7 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.36 2014/10/18 17:20:40 jsing Exp $ */ | 1 | /* $OpenBSD: rsa_eay.c,v 1.37 2015/02/09 15:49:22 jsing 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 | * |
@@ -181,7 +181,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
181 | ret = BN_CTX_get(ctx); | 181 | ret = BN_CTX_get(ctx); |
182 | num = BN_num_bytes(rsa->n); | 182 | num = BN_num_bytes(rsa->n); |
183 | buf = malloc(num); | 183 | buf = malloc(num); |
184 | if (!f || !ret || !buf) { | 184 | if (f == NULL || ret == NULL || buf == NULL) { |
185 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, ERR_R_MALLOC_FAILURE); | 185 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, ERR_R_MALLOC_FAILURE); |
186 | goto err; | 186 | goto err; |
187 | } | 187 | } |
@@ -366,7 +366,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
366 | ret = BN_CTX_get(ctx); | 366 | ret = BN_CTX_get(ctx); |
367 | num = BN_num_bytes(rsa->n); | 367 | num = BN_num_bytes(rsa->n); |
368 | buf = malloc(num); | 368 | buf = malloc(num); |
369 | if (!f || !ret || !buf) { | 369 | if (f == NULL || ret == NULL || buf == NULL) { |
370 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, ERR_R_MALLOC_FAILURE); | 370 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, ERR_R_MALLOC_FAILURE); |
371 | goto err; | 371 | goto err; |
372 | } | 372 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_gen.c b/src/lib/libcrypto/rsa/rsa_gen.c index a3b9da4856..f6f051c442 100644 --- a/src/lib/libcrypto/rsa/rsa_gen.c +++ b/src/lib/libcrypto/rsa/rsa_gen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_gen.c,v 1.16 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: rsa_gen.c,v 1.17 2015/02/09 15:49:22 jsing 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 | * |
@@ -99,11 +99,13 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
99 | if (ctx == NULL) | 99 | if (ctx == NULL) |
100 | goto err; | 100 | goto err; |
101 | BN_CTX_start(ctx); | 101 | BN_CTX_start(ctx); |
102 | r0 = BN_CTX_get(ctx); | 102 | if ((r0 = BN_CTX_get(ctx)) == NULL) |
103 | r1 = BN_CTX_get(ctx); | 103 | goto err; |
104 | r2 = BN_CTX_get(ctx); | 104 | if ((r1 = BN_CTX_get(ctx)) == NULL) |
105 | r3 = BN_CTX_get(ctx); | 105 | goto err; |
106 | if (r3 == NULL) | 106 | if ((r2 = BN_CTX_get(ctx)) == NULL) |
107 | goto err; | ||
108 | if ((r3 = BN_CTX_get(ctx)) == NULL) | ||
107 | goto err; | 109 | goto err; |
108 | 110 | ||
109 | bitsp = (bits + 1) / 2; | 111 | bitsp = (bits + 1) / 2; |