aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto/drbg.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/crypto/drbg.h')
-rw-r--r--include/crypto/drbg.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
index 3d8e73a1a1c7..5186f750c713 100644
--- a/include/crypto/drbg.h
+++ b/include/crypto/drbg.h
@@ -154,13 +154,26 @@ static inline size_t drbg_max_request_bytes(struct drbg_state *drbg)
static inline size_t drbg_max_addtl(struct drbg_state *drbg)
{
/* SP800-90A requires 2**35 bytes additional info str / pers str */
+#if (__BITS_PER_LONG == 32)
+ /*
+ * SP800-90A allows smaller maximum numbers to be returned -- we
+ * return SIZE_MAX - 1 to allow the verification of the enforcement
+ * of this value in drbg_healthcheck_sanity.
+ */
+ return (SIZE_MAX - 1);
+#else
return (1UL<<35);
+#endif
}
static inline size_t drbg_max_requests(struct drbg_state *drbg)
{
/* SP800-90A requires 2**48 maximum requests before reseeding */
+#if (__BITS_PER_LONG == 32)
+ return SIZE_MAX;
+#else
return (1UL<<48);
+#endif
}
/*