diff options
author | jsing <> | 2014-10-22 13:02:04 +0000 |
---|---|---|
committer | jsing <> | 2014-10-22 13:02:04 +0000 |
commit | a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8 (patch) | |
tree | 32d920c77e1ecf12be5fad632b9ae71343194a7c /src/lib/libcrypto/des/enc_writ.c | |
parent | 5a6d7fd5a10b0ad084948463b25822d91091b325 (diff) | |
download | openbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.tar.gz openbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.tar.bz2 openbsd-a2960bc2e14b4c5f7d8f78d2a69ebb537ca4afa8.zip |
Use arc4random_buf() instead of RAND_bytes() or RAND_pseudo_bytes().
arc4random_buf() is guaranteed to always succeed - it is worth noting
that a number of the replaced function calls were already missing return
value checks.
ok deraadt@
Diffstat (limited to 'src/lib/libcrypto/des/enc_writ.c')
-rw-r--r-- | src/lib/libcrypto/des/enc_writ.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libcrypto/des/enc_writ.c b/src/lib/libcrypto/des/enc_writ.c index a7049ff44e..0130c2c6d9 100644 --- a/src/lib/libcrypto/des/enc_writ.c +++ b/src/lib/libcrypto/des/enc_writ.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: enc_writ.c,v 1.12 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: enc_writ.c,v 1.13 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 | * |
@@ -58,12 +58,11 @@ | |||
58 | 58 | ||
59 | #include <errno.h> | 59 | #include <errno.h> |
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | #include <stdlib.h> | ||
61 | #include <time.h> | 62 | #include <time.h> |
62 | 63 | ||
63 | #include <openssl/opensslconf.h> | 64 | #include <openssl/opensslconf.h> |
64 | 65 | ||
65 | #include <openssl/rand.h> | ||
66 | |||
67 | #include "des_locl.h" | 66 | #include "des_locl.h" |
68 | 67 | ||
69 | /* | 68 | /* |
@@ -136,7 +135,7 @@ int DES_enc_write(int fd, const void *_buf, int len, | |||
136 | { | 135 | { |
137 | cp=shortbuf; | 136 | cp=shortbuf; |
138 | memcpy(shortbuf,buf,len); | 137 | memcpy(shortbuf,buf,len); |
139 | RAND_pseudo_bytes(shortbuf+len, 8-len); | 138 | arc4random_buf(shortbuf+len, 8-len); |
140 | rnum=8; | 139 | rnum=8; |
141 | } | 140 | } |
142 | else | 141 | else |