diff options
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_pk1.c')
| -rw-r--r-- | src/lib/libcrypto/rsa/rsa_pk1.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_pk1.c b/src/lib/libcrypto/rsa/rsa_pk1.c index 4f82bf6768..6c3e7fb846 100644 --- a/src/lib/libcrypto/rsa/rsa_pk1.c +++ b/src/lib/libcrypto/rsa/rsa_pk1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa_pk1.c,v 1.13 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: rsa_pk1.c,v 1.14 2014/10/22 13:02:04 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 | * |
| @@ -57,12 +57,12 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | ||
| 60 | #include <string.h> | 61 | #include <string.h> |
| 61 | 62 | ||
| 62 | #include <openssl/bn.h> | 63 | #include <openssl/bn.h> |
| 63 | #include <openssl/err.h> | 64 | #include <openssl/err.h> |
| 64 | #include <openssl/rsa.h> | 65 | #include <openssl/rsa.h> |
| 65 | #include <openssl/rand.h> | ||
| 66 | 66 | ||
| 67 | int | 67 | int |
| 68 | RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, | 68 | RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, |
| @@ -167,13 +167,10 @@ RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, | |||
| 167 | /* pad out with non-zero random data */ | 167 | /* pad out with non-zero random data */ |
| 168 | j = tlen - 3 - flen; | 168 | j = tlen - 3 - flen; |
| 169 | 169 | ||
| 170 | if (RAND_bytes(p, j) <= 0) | 170 | arc4random_buf(p, j); |
| 171 | return 0; | ||
| 172 | for (i = 0; i < j; i++) { | 171 | for (i = 0; i < j; i++) { |
| 173 | while (*p == '\0') { | 172 | while (*p == '\0') |
| 174 | if (RAND_bytes(p, 1) <= 0) | 173 | arc4random_buf(p, 1); |
| 175 | return 0; | ||
| 176 | } | ||
| 177 | p++; | 174 | p++; |
| 178 | } | 175 | } |
| 179 | 176 | ||
