summaryrefslogtreecommitdiffstats
path: root/crypto/evp/e_aria.c
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2017-11-05 14:37:15 +0100
committerKurt Roeckx <kurt@roeckx.be>2018-02-28 21:20:01 +0100
commitd91f45688c2d0bfcc5b3b57fb20cc80b010eef0b (patch)
tree8d1b6a41dcd33ac56b261d46d6fbad7675f0fd58 /crypto/evp/e_aria.c
parentb3f9064cc66324d2359dba5350c71540ce869ceb (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_aria.c')
-rw-r--r--crypto/evp/e_aria.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/crypto/evp/e_aria.c b/crypto/evp/e_aria.c
index 00e008a368..10525a84d9 100644
--- a/crypto/evp/e_aria.c
+++ b/crypto/evp/e_aria.c
@@ -15,6 +15,7 @@
# include <openssl/rand.h>
# include "internal/aria.h"
# include "internal/evp_int.h"
+# include "internal/rand.h"
# include "modes_lcl.h"
# include "evp_locl.h"
@@ -301,9 +302,14 @@ static int aria_gcm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
return 0;
if (arg)
memcpy(gctx->iv, ptr, arg);
- if (EVP_CIPHER_CTX_encrypting(c)
- && RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0)
- return 0;
+ if (EVP_CIPHER_CTX_encrypting(c)) {
+ if (c->drbg != NULL) {
+ if (RAND_DRBG_bytes(c->drbg, gctx->iv + arg, gctx->ivlen - arg) == 0)
+ return 0;
+ } else if (RAND_bytes(gctx->iv + arg, gctx->ivlen - arg) <= 0) {
+ return 0;
+ }
+ }
gctx->iv_gen = 1;
return 1;