diff options
author | Kurt Roeckx <kurt@roeckx.be> | 2017-11-05 14:37:15 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2018-02-28 21:20:01 +0100 |
commit | d91f45688c2d0bfcc5b3b57fb20cc80b010eef0b (patch) | |
tree | 8d1b6a41dcd33ac56b261d46d6fbad7675f0fd58 /crypto/evp/e_des.c | |
parent | b3f9064cc66324d2359dba5350c71540ce869ceb (diff) |
Tell the ciphers which DRBG to use for generating random bytes.
Reviewed-by: Richard Levitte <levitte@openssl.org>
GH: #4672
Diffstat (limited to 'crypto/evp/e_des.c')
-rw-r--r-- | crypto/evp/e_des.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/evp/e_des.c b/crypto/evp/e_des.c index 9b2facfecf..d8c4afa886 100644 --- a/crypto/evp/e_des.c +++ b/crypto/evp/e_des.c @@ -15,6 +15,8 @@ # include "internal/evp_int.h" # include <openssl/des.h> # include <openssl/rand.h> +# include <internal/rand.h> +# include "evp_locl.h" typedef struct { union { @@ -229,8 +231,12 @@ static int des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) switch (type) { case EVP_CTRL_RAND_KEY: - if (RAND_bytes(ptr, 8) <= 0) + if (c->drbg != NULL) { + if (RAND_DRBG_bytes(c->drbg, ptr, 8) == 0) + return 0; + } else if (RAND_bytes(ptr, 8) <= 0) { return 0; + } DES_set_odd_parity((DES_cblock *)ptr); return 1; |