|
@@ -338,7 +338,16 @@ static int cprng_init(struct crypto_tfm *tfm)
|
|
|
|
|
|
spin_lock_init(&ctx->prng_lock);
|
|
spin_lock_init(&ctx->prng_lock);
|
|
|
|
|
|
- return reset_prng_context(ctx, NULL, DEFAULT_PRNG_KSZ, NULL, NULL);
|
|
|
|
|
|
+ if (reset_prng_context(ctx, NULL, DEFAULT_PRNG_KSZ, NULL, NULL) < 0)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * after allocation, we should always force the user to reset
|
|
|
|
+ * so they don't inadvertently use the insecure default values
|
|
|
|
+ * without specifying them intentially
|
|
|
|
+ */
|
|
|
|
+ ctx->flags |= PRNG_NEED_RESET;
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static void cprng_exit(struct crypto_tfm *tfm)
|
|
static void cprng_exit(struct crypto_tfm *tfm)
|