summaryrefslogtreecommitdiffstats
path: root/fips/rand/fips_drbg_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'fips/rand/fips_drbg_lib.c')
-rw-r--r--fips/rand/fips_drbg_lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fips/rand/fips_drbg_lib.c b/fips/rand/fips_drbg_lib.c
index 46e42e2947..7892a02b60 100644
--- a/fips/rand/fips_drbg_lib.c
+++ b/fips/rand/fips_drbg_lib.c
@@ -153,7 +153,10 @@ static size_t fips_get_entropy(DRBG_CTX *dctx, unsigned char **pout,
return 0;
}
}
- return rv - bl;
+ rv -= bl;
+ if (rv > max_len)
+ return max_len;
+ return rv;
}
static void fips_cleanup_entropy(DRBG_CTX *dctx,