forked from pool/libgcrypt
e37716ed54
- FIPS: libgcrypt DSA PQG parameter generation: Missing value [bsc#1161219] - FIPS: libgcrypt DSA PQG verification incorrect results [bsc#1161215] - FIPS: libgcrypt RSA siggen/keygen: 4k not supported [bsc#1161220] * Add patch from Fedora libgcrypt-1.8.4-fips-keygen.patch - FIPS: RSA/DSA/ECDSA are missing hashing operation [bsc#1155337] * Add libgcrypt-FIPS-RSA-DSA-ECDSA-hashing-operation.patch - Fix tests in FIPS mode: * Fix tests: basic benchmark bench-slope pubkey t-cv25519 t-secmem * Add patch libgcrypt-fix-tests-fipsmode.patch - Fix test dsa-rfc6979 in FIPS mode: * Disable tests in elliptic curves with 192 bits which are not recommended in FIPS mode * Add patch libgcrypt-dsa-rfc6979-test-fix.patch - CMAC AES and TDES FIPS self-tests: * CMAC AES self test missing [bsc#1155339] * CMAC TDES self test missing [bsc#1155338] - Add libgcrypt-CMAC-AES-TDES-selftest.patch OBS-URL: https://build.opensuse.org/request/show/766877 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libgcrypt?expand=0&rev=132
68 lines
2.6 KiB
Diff
68 lines
2.6 KiB
Diff
Index: libgcrypt-1.8.2/cipher/dsa.c
|
|
===================================================================
|
|
--- libgcrypt-1.8.2.orig/cipher/dsa.c
|
|
+++ libgcrypt-1.8.2/cipher/dsa.c
|
|
@@ -457,11 +457,22 @@ generate_fips186 (DSA_secret_key *sk, un
|
|
&prime_q, &prime_p,
|
|
r_counter,
|
|
r_seed, r_seedlen);
|
|
- else
|
|
- ec = _gcry_generate_fips186_3_prime (nbits, qbits, NULL, 0,
|
|
+ else if (!domain->p || !domain->q)
|
|
+ ec = _gcry_generate_fips186_3_prime (nbits, qbits,
|
|
+ initial_seed.seed,
|
|
+ initial_seed.seedlen,
|
|
&prime_q, &prime_p,
|
|
r_counter,
|
|
r_seed, r_seedlen, NULL);
|
|
+ else
|
|
+ {
|
|
+ /* Domain parameters p and q are given; use them. */
|
|
+ prime_p = mpi_copy (domain->p);
|
|
+ prime_q = mpi_copy (domain->q);
|
|
+ gcry_assert (mpi_get_nbits (prime_p) == nbits);
|
|
+ gcry_assert (mpi_get_nbits (prime_q) == qbits);
|
|
+ ec = 0;
|
|
+ }
|
|
sexp_release (initial_seed.sexp);
|
|
if (ec)
|
|
goto leave;
|
|
@@ -857,13 +868,12 @@ dsa_generate (const gcry_sexp_t genparms
|
|
sexp_release (l1);
|
|
sexp_release (domainsexp);
|
|
|
|
- /* Check that all domain parameters are available. */
|
|
- if (!domain.p || !domain.q || !domain.g)
|
|
+ /* Check that p and q domain parameters are available. */
|
|
+ if (!domain.p || !domain.q || (!domain.g && !(flags & PUBKEY_FLAG_USE_FIPS186)))
|
|
{
|
|
_gcry_mpi_release (domain.p);
|
|
_gcry_mpi_release (domain.q);
|
|
_gcry_mpi_release (domain.g);
|
|
- sexp_release (deriveparms);
|
|
return GPG_ERR_MISSING_VALUE;
|
|
}
|
|
|
|
Index: libgcrypt-1.8.2/cipher/rsa.c
|
|
===================================================================
|
|
--- libgcrypt-1.8.2.orig/cipher/rsa.c
|
|
+++ libgcrypt-1.8.2/cipher/rsa.c
|
|
@@ -389,7 +389,7 @@ generate_fips (RSA_secret_key *sk, unsig
|
|
|
|
if (nbits < 1024 || (nbits & 0x1FF))
|
|
return GPG_ERR_INV_VALUE;
|
|
- if (fips_mode() && nbits != 2048 && nbits != 3072)
|
|
+ if (fips_mode() && nbits < 2048)
|
|
return GPG_ERR_INV_VALUE;
|
|
|
|
/* The random quality depends on the transient_key flag. */
|
|
@@ -696,7 +696,7 @@ generate_x931 (RSA_secret_key *sk, unsig
|
|
|
|
*swapped = 0;
|
|
|
|
- if (e_value == 1) /* Alias for a secure value. */
|
|
+ if (e_value == 1 || e_value == 0) /* Alias for a secure value. */
|
|
e_value = 65537;
|
|
|
|
/* Point 1 of section 4.1: k = 1024 + 256s with S >= 0 */
|