diff options
| -rw-r--r-- | crypto/drbg.c | 3 | ||||
| -rw-r--r-- | include/crypto/drbg.h | 13 |
2 files changed, 13 insertions, 3 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c index 7894db9ca90b..a53ee099e281 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c | |||
| @@ -1922,9 +1922,6 @@ static inline int __init drbg_healthcheck_sanity(void) | |||
| 1922 | /* overflow max addtllen with personalization string */ | 1922 | /* overflow max addtllen with personalization string */ |
| 1923 | ret = drbg_instantiate(drbg, &addtl, coreref, pr); | 1923 | ret = drbg_instantiate(drbg, &addtl, coreref, pr); |
| 1924 | BUG_ON(0 == ret); | 1924 | BUG_ON(0 == ret); |
| 1925 | /* test uninstantated DRBG */ | ||
| 1926 | len = drbg_generate(drbg, buf, (max_request_bytes + 1), NULL); | ||
| 1927 | BUG_ON(0 < len); | ||
| 1928 | /* all tests passed */ | 1925 | /* all tests passed */ |
| 1929 | rc = 0; | 1926 | rc = 0; |
| 1930 | 1927 | ||
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h index 831d786976c5..882675e7c055 100644 --- a/include/crypto/drbg.h +++ b/include/crypto/drbg.h | |||
| @@ -162,12 +162,25 @@ static inline size_t drbg_max_request_bytes(struct drbg_state *drbg) | |||
| 162 | 162 | ||
| 163 | static inline size_t drbg_max_addtl(struct drbg_state *drbg) | 163 | static inline size_t drbg_max_addtl(struct drbg_state *drbg) |
| 164 | { | 164 | { |
| 165 | #if (__BITS_PER_LONG == 32) | ||
| 166 | /* | ||
| 167 | * SP800-90A allows smaller maximum numbers to be returned -- we | ||
| 168 | * return SIZE_MAX - 1 to allow the verification of the enforcement | ||
| 169 | * of this value in drbg_healthcheck_sanity. | ||
| 170 | */ | ||
| 171 | return (SIZE_MAX - 1); | ||
| 172 | #else | ||
| 165 | return (1UL<<(drbg->core->max_addtllen)); | 173 | return (1UL<<(drbg->core->max_addtllen)); |
| 174 | #endif | ||
| 166 | } | 175 | } |
| 167 | 176 | ||
| 168 | static inline size_t drbg_max_requests(struct drbg_state *drbg) | 177 | static inline size_t drbg_max_requests(struct drbg_state *drbg) |
| 169 | { | 178 | { |
| 179 | #if (__BITS_PER_LONG == 32) | ||
| 180 | return SIZE_MAX; | ||
| 181 | #else | ||
| 170 | return (1UL<<(drbg->core->max_req)); | 182 | return (1UL<<(drbg->core->max_req)); |
| 183 | #endif | ||
| 171 | } | 184 | } |
| 172 | 185 | ||
| 173 | /* | 186 | /* |
