diff options
author | Ulf Möller <ulf@openssl.org> | 2000-01-13 20:59:17 +0000 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 2000-01-13 20:59:17 +0000 |
commit | eb952088f0d5da59e569ae2aa33e9b96bc3b586d (patch) | |
tree | 1d722a423148a6b568a1e6d42f01943aed6cfb2a /crypto/rsa/rsa_ssl.c | |
parent | 22e219d90f1ea5d3b2f4abb72c846a436ea33eff (diff) |
Precautions against using the PRNG uninitialized: RAND_bytes() now
returns int (1 = ok, 0 = not seeded). New function RAND_add() is the
same as RAND_seed() but takes an estimate of the entropy as an additional
argument.
Diffstat (limited to 'crypto/rsa/rsa_ssl.c')
-rw-r--r-- | crypto/rsa/rsa_ssl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/rsa/rsa_ssl.c b/crypto/rsa/rsa_ssl.c index 1050844f8d..83dfc80c1d 100644 --- a/crypto/rsa/rsa_ssl.c +++ b/crypto/rsa/rsa_ssl.c @@ -82,12 +82,14 @@ int RSA_padding_add_SSLv23(unsigned char *to, int tlen, unsigned char *from, /* pad out with non-zero random data */ j=tlen-3-8-flen; - RAND_bytes(p,j); + if (RAND_bytes(p,j) <= 0) + return(0); for (i=0; i<j; i++) { if (*p == '\0') do { - RAND_bytes(p,1); + if (RAND_bytes(p,1) <= 0) + return(0); } while (*p == '\0'); p++; } |