|
|
5bcc82 |
diff -up libgcrypt-1.7.3/src/visibility.c.fips-reqs libgcrypt-1.7.3/src/visibility.c
|
|
|
5bcc82 |
--- libgcrypt-1.7.3/src/visibility.c.fips-reqs 2016-03-23 12:59:34.000000000 +0100
|
|
|
5bcc82 |
+++ libgcrypt-1.7.3/src/visibility.c 2016-11-22 16:29:36.992042480 +0100
|
|
|
5bcc82 |
@@ -1288,6 +1288,8 @@ gcry_kdf_derive (const void *passphrase,
|
|
|
5bcc82 |
unsigned long iterations,
|
|
|
5bcc82 |
size_t keysize, void *keybuffer)
|
|
|
5bcc82 |
{
|
|
|
5bcc82 |
+ if (!fips_is_operational ())
|
|
|
5bcc82 |
+ return gpg_error (fips_not_operational ());
|
|
|
5bcc82 |
return gpg_error (_gcry_kdf_derive (passphrase, passphraselen, algo, hashalgo,
|
|
|
5bcc82 |
salt, saltlen, iterations,
|
|
|
5bcc82 |
keysize, keybuffer));
|
|
|
5bcc82 |
@@ -1343,6 +1345,13 @@ void
|
|
|
5bcc82 |
gcry_mpi_randomize (gcry_mpi_t w,
|
|
|
5bcc82 |
unsigned int nbits, enum gcry_random_level level)
|
|
|
5bcc82 |
{
|
|
|
5bcc82 |
+ if (!fips_is_operational ())
|
|
|
5bcc82 |
+ {
|
|
|
5bcc82 |
+ (void)fips_not_operational ();
|
|
|
5bcc82 |
+ fips_signal_fatal_error ("called in non-operational state");
|
|
|
5bcc82 |
+ fips_noreturn ();
|
|
|
5bcc82 |
+ }
|
|
|
5bcc82 |
+
|
|
|
5bcc82 |
_gcry_mpi_randomize (w, nbits, level);
|
|
|
5bcc82 |
}
|
|
|
5bcc82 |
|
|
|
5bcc82 |
@@ -1368,6 +1377,8 @@ gcry_prime_generate (gcry_mpi_t *prime,
|
|
|
5bcc82 |
gcry_random_level_t random_level,
|
|
|
5bcc82 |
unsigned int flags)
|
|
|
5bcc82 |
{
|
|
|
5bcc82 |
+ if (!fips_is_operational ())
|
|
|
5bcc82 |
+ return gpg_error (fips_not_operational ());
|
|
|
5bcc82 |
return gpg_error (_gcry_prime_generate (prime, prime_bits, factor_bits,
|
|
|
5bcc82 |
factors, cb_func, cb_arg,
|
|
|
5bcc82 |
random_level, flags));
|