Implement crypt RNG wrapper (for FIPS mode), use it for SALT and KEY RNG levels.

This commit is contained in:
Milan Broz
2012-05-21 14:32:39 +02:00
parent 45e0942755
commit cf1e6fb847
8 changed files with 52 additions and 1 deletions

View File

@@ -177,9 +177,16 @@ int crypt_random_get(struct crypt_device *ctx, char *buf, size_t len, int qualit
status = _get_urandom(ctx, buf, len);
break;
case CRYPT_RND_SALT:
status = _get_urandom(ctx, buf, len);
if (crypt_fips_mode())
status = crypt_backend_fips_rng(buf, len, quality);
else
status = _get_urandom(ctx, buf, len);
break;
case CRYPT_RND_KEY:
if (crypt_fips_mode()) {
status = crypt_backend_fips_rng(buf, len, quality);
break;
}
rng_type = ctx ? crypt_get_rng_type(ctx) :
crypt_random_default_key_rng();
switch (rng_type) {