summaryrefslogtreecommitdiffstats
path: root/crypto/dsa
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-04-20 11:07:38 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-04-20 11:07:38 +1000
commit738ee1819e3bb94723701fb505ce2971afe47a9b (patch)
tree2fd8588534087594f2371060c20bc6890d39a33a /crypto/dsa
parent9e537cd2ad01b172f2700a670e9269075078a426 (diff)
Fix DH_get_nid() so that it does not cache values.
DH_set0_pqg() is now responsible for caching the nid, q and length. DH with or without named safe prime groups now default to using the maximum private key length (BN_num_bits(q) - 1) when generating a DH private key. The code is now shared between fips and non fips mode for DH key generation. The OSSL_PKEY_PARAM_DH_PRIV_LEN parameter can be used during keygen to override the maximum private key length to be in the range (2 * strength ... bits(q) - 1). Where the strength depends on the length of p. Added q = (p - 1) / 2 safe prime BIGNUMS so that the code is data driven (To simplify adding new names). The BIGNUMS were code generated. Fix error in documented return value for DH_get_nid Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11562)
Diffstat (limited to 'crypto/dsa')
-rw-r--r--crypto/dsa/dsa_key.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/dsa/dsa_key.c b/crypto/dsa/dsa_key.c
index 1d625272e5..f9bb3470f6 100644
--- a/crypto/dsa/dsa_key.c
+++ b/crypto/dsa/dsa_key.c
@@ -74,6 +74,11 @@ static int dsa_keygen(DSA *dsa, int pairwise_test)
priv_key = dsa->priv_key;
}
+ /*
+ * For FFC FIPS 186-4 keygen
+ * security strength s = 112,
+ * Max Private key size N = len(q)
+ */
if (!ffc_generate_private_key(ctx, &dsa->params, BN_num_bits(dsa->params.q),
MIN_STRENGTH, priv_key))
goto err;