#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/rand.h>
-#include "rand_lcl.h"
#include "internal/thread_once.h"
-
+#include "internal/thread_once.h"
+#include "rand_lcl.h"
/*
* Implementation of NIST SP 800-90A CTR DRBG.
*/
memcpy(ctr->V, ctr->K + 24, 8);
}
- if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) {
+ if ((drbg->flags & RAND_DRBG_FLAG_CTR_NO_DF) == 0) {
/* If no input reuse existing derived value */
if (in1 != NULL || nonce != NULL || in2 != NULL)
ctr_df(ctr, in1, in1len, nonce, noncelen, in2, in2len);
if (adin != NULL && adinlen != 0) {
ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0);
/* This means we reuse derived value */
- if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) {
+ if ((drbg->flags & RAND_DRBG_FLAG_CTR_NO_DF) == 0) {
adin = NULL;
adinlen = 1;
}
drbg->strength = keylen * 8;
drbg->seedlen = keylen + 16;
- if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) {
+ if ((drbg->flags & RAND_DRBG_FLAG_CTR_NO_DF) == 0) {
/* df initialisation */
static unsigned char df_key[32] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
}
drbg->max_request = 1 << 16;
- drbg->reseed_interval = MAX_RESEED_INTERVAL;
+
return 1;
}