diff options
Diffstat (limited to 'src/lib/libcrypto/des')
-rw-r--r-- | src/lib/libcrypto/des/enc_writ.c | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/des/rand_key.c | 8 |
2 files changed, 7 insertions, 8 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 |
diff --git a/src/lib/libcrypto/des/rand_key.c b/src/lib/libcrypto/des/rand_key.c index 727d36f488..7abb811df4 100644 --- a/src/lib/libcrypto/des/rand_key.c +++ b/src/lib/libcrypto/des/rand_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rand_key.c,v 1.7 2014/07/22 18:09:20 miod Exp $ */ | 1 | /* $OpenBSD: rand_key.c,v 1.8 2014/10/22 13:02:04 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -53,15 +53,15 @@ | |||
53 | * | 53 | * |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include <stdlib.h> | ||
57 | |||
56 | #include <openssl/des.h> | 58 | #include <openssl/des.h> |
57 | #include <openssl/rand.h> | ||
58 | 59 | ||
59 | int | 60 | int |
60 | DES_random_key(DES_cblock *ret) | 61 | DES_random_key(DES_cblock *ret) |
61 | { | 62 | { |
62 | do { | 63 | do { |
63 | if (RAND_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1) | 64 | arc4random_buf(ret, sizeof(DES_cblock)); |
64 | return (0); | ||
65 | DES_set_odd_parity(ret); | 65 | DES_set_odd_parity(ret); |
66 | } while (DES_is_weak_key(ret)); | 66 | } while (DES_is_weak_key(ret)); |
67 | return (1); | 67 | return (1); |