diff options
author | jsing <> | 2014-10-18 16:13:16 +0000 |
---|---|---|
committer | jsing <> | 2014-10-18 16:13:16 +0000 |
commit | c7ab256a26b40c83b42c202488c01636a208c01c (patch) | |
tree | 0ec0407532b236ff11b9134f214f8db715d84e63 /src/lib/libssl/s3_both.c | |
parent | dd127b6b5a62ebd88f0cbb2e6d7d749d20363a16 (diff) | |
download | openbsd-c7ab256a26b40c83b42c202488c01636a208c01c.tar.gz openbsd-c7ab256a26b40c83b42c202488c01636a208c01c.tar.bz2 openbsd-c7ab256a26b40c83b42c202488c01636a208c01c.zip |
Use arc4random_buf() instead of RAND_bytes() or RAND_pseudo_bytes().
arc4random provides high quality pseudo-random numbers, hence there is no
need to differentiate between "strong" and "pseudo". Furthermore, the
arc4random_buf() function is guaranteed to succeed, which avoids the need
to check for and handle failure, simplifying the code.
It is worth noting that a number of the replaced RAND_bytes() and
RAND_pseudo_bytes() calls were missing return value checks and these
functions can fail for a number of reasons (at least in OpenSSL -
thankfully they were converted to wrappers around arc4random_buf() some
time ago in LibreSSL).
ok beck@ deraadt@ miod@
Diffstat (limited to '')
-rw-r--r-- | src/lib/libssl/s3_both.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lib/libssl/s3_both.c b/src/lib/libssl/s3_both.c index 6d108c295b..cd0a4b8013 100644 --- a/src/lib/libssl/s3_both.c +++ b/src/lib/libssl/s3_both.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s3_both.c,v 1.30 2014/09/22 13:18:50 jsing Exp $ */ | 1 | /* $OpenBSD: s3_both.c,v 1.31 2014/10/18 16:13:16 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 | * |
@@ -119,7 +119,6 @@ | |||
119 | #include <stdio.h> | 119 | #include <stdio.h> |
120 | #include "ssl_locl.h" | 120 | #include "ssl_locl.h" |
121 | #include <openssl/buffer.h> | 121 | #include <openssl/buffer.h> |
122 | #include <openssl/rand.h> | ||
123 | #include <openssl/objects.h> | 122 | #include <openssl/objects.h> |
124 | #include <openssl/evp.h> | 123 | #include <openssl/evp.h> |
125 | #include <openssl/x509.h> | 124 | #include <openssl/x509.h> |