diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ansi_cprng.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c index 45bd2182cb36..2bc332142849 100644 --- a/crypto/ansi_cprng.c +++ b/crypto/ansi_cprng.c | |||
@@ -357,14 +357,6 @@ static int cprng_get_random(struct crypto_rng *tfm, u8 *rdata, | |||
357 | return get_prng_bytes(rdata, dlen, prng, 0); | 357 | return get_prng_bytes(rdata, dlen, prng, 0); |
358 | } | 358 | } |
359 | 359 | ||
360 | static int fips_cprng_get_random(struct crypto_rng *tfm, u8 *rdata, | ||
361 | unsigned int dlen) | ||
362 | { | ||
363 | struct prng_context *prng = crypto_rng_ctx(tfm); | ||
364 | |||
365 | return get_prng_bytes(rdata, dlen, prng, 1); | ||
366 | } | ||
367 | |||
368 | /* | 360 | /* |
369 | * This is the cprng_registered reset method the seed value is | 361 | * This is the cprng_registered reset method the seed value is |
370 | * interpreted as the tuple { V KEY DT} | 362 | * interpreted as the tuple { V KEY DT} |
@@ -390,26 +382,6 @@ static int cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) | |||
390 | return 0; | 382 | return 0; |
391 | } | 383 | } |
392 | 384 | ||
393 | static int fips_cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) | ||
394 | { | ||
395 | u8 rdata[DEFAULT_BLK_SZ]; | ||
396 | int rc; | ||
397 | |||
398 | struct prng_context *prng = crypto_rng_ctx(tfm); | ||
399 | |||
400 | rc = cprng_reset(tfm, seed, slen); | ||
401 | |||
402 | if (!rc) | ||
403 | goto out; | ||
404 | |||
405 | /* this primes our continuity test */ | ||
406 | rc = get_prng_bytes(rdata, DEFAULT_BLK_SZ, prng, 0); | ||
407 | prng->rand_data_valid = DEFAULT_BLK_SZ; | ||
408 | |||
409 | out: | ||
410 | return rc; | ||
411 | } | ||
412 | |||
413 | static struct crypto_alg rng_alg = { | 385 | static struct crypto_alg rng_alg = { |
414 | .cra_name = "stdrng", | 386 | .cra_name = "stdrng", |
415 | .cra_driver_name = "ansi_cprng", | 387 | .cra_driver_name = "ansi_cprng", |
@@ -431,6 +403,34 @@ static struct crypto_alg rng_alg = { | |||
431 | }; | 403 | }; |
432 | 404 | ||
433 | #ifdef CONFIG_CRYPTO_FIPS | 405 | #ifdef CONFIG_CRYPTO_FIPS |
406 | static int fips_cprng_get_random(struct crypto_rng *tfm, u8 *rdata, | ||
407 | unsigned int dlen) | ||
408 | { | ||
409 | struct prng_context *prng = crypto_rng_ctx(tfm); | ||
410 | |||
411 | return get_prng_bytes(rdata, dlen, prng, 1); | ||
412 | } | ||
413 | |||
414 | static int fips_cprng_reset(struct crypto_rng *tfm, u8 *seed, unsigned int slen) | ||
415 | { | ||
416 | u8 rdata[DEFAULT_BLK_SZ]; | ||
417 | int rc; | ||
418 | |||
419 | struct prng_context *prng = crypto_rng_ctx(tfm); | ||
420 | |||
421 | rc = cprng_reset(tfm, seed, slen); | ||
422 | |||
423 | if (!rc) | ||
424 | goto out; | ||
425 | |||
426 | /* this primes our continuity test */ | ||
427 | rc = get_prng_bytes(rdata, DEFAULT_BLK_SZ, prng, 0); | ||
428 | prng->rand_data_valid = DEFAULT_BLK_SZ; | ||
429 | |||
430 | out: | ||
431 | return rc; | ||
432 | } | ||
433 | |||
434 | static struct crypto_alg fips_rng_alg = { | 434 | static struct crypto_alg fips_rng_alg = { |
435 | .cra_name = "fips(ansi_cprng)", | 435 | .cra_name = "fips(ansi_cprng)", |
436 | .cra_driver_name = "fips_ansi_cprng", | 436 | .cra_driver_name = "fips_ansi_cprng", |