diff options
-rw-r--r-- | crypto/ansi_cprng.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c index 0fac8ffc2fb7..74478061ac0c 100644 --- a/crypto/ansi_cprng.c +++ b/crypto/ansi_cprng.c | |||
@@ -338,7 +338,16 @@ static int cprng_init(struct crypto_tfm *tfm) | |||
338 | 338 | ||
339 | spin_lock_init(&ctx->prng_lock); | 339 | spin_lock_init(&ctx->prng_lock); |
340 | 340 | ||
341 | return reset_prng_context(ctx, NULL, DEFAULT_PRNG_KSZ, NULL, NULL); | 341 | if (reset_prng_context(ctx, NULL, DEFAULT_PRNG_KSZ, NULL, NULL) < 0) |
342 | return -EINVAL; | ||
343 | |||
344 | /* | ||
345 | * after allocation, we should always force the user to reset | ||
346 | * so they don't inadvertently use the insecure default values | ||
347 | * without specifying them intentially | ||
348 | */ | ||
349 | ctx->flags |= PRNG_NEED_RESET; | ||
350 | return 0; | ||
342 | } | 351 | } |
343 | 352 | ||
344 | static void cprng_exit(struct crypto_tfm *tfm) | 353 | static void cprng_exit(struct crypto_tfm *tfm) |