summaryrefslogtreecommitdiff
path: root/test/evp_pkey_provided_test.c
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 /test/evp_pkey_provided_test.c
parent9e537cd2ad01b172f2700a670e9269075078a426 (diff)
downloadopenssl-new-738ee1819e3bb94723701fb505ce2971afe47a9b.tar.gz
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 'test/evp_pkey_provided_test.c')
-rw-r--r--test/evp_pkey_provided_test.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c
index 7b61cbe11f..1ded0d9f9e 100644
--- a/test/evp_pkey_provided_test.c
+++ b/test/evp_pkey_provided_test.c
@@ -408,7 +408,8 @@ static int test_fromdata_dh_named_group(void)
/*
* DH key data was generated using the following:
- * openssl genpkey -algorithm DH -pkeyopt group:ffdhe2048 -text
+ * openssl genpkey -algorithm DH -pkeyopt group:ffdhe2048
+ * -pkeyopt priv_len:224 -text
*/
static const unsigned char priv_data[] = {
0x88, 0x85, 0xe7, 0x9f, 0xee, 0x6d, 0xc5, 0x7c, 0x78, 0xaf, 0x63, 0x5d,
@@ -547,7 +548,8 @@ static int test_fromdata_dh_fips186_4(void)
/*
* DH key data was generated using the following:
- * openssl genpkey -algorithm DH -pkeyopt group:ffdhe2048 -text
+ * openssl genpkey -algorithm DH
+ * -pkeyopt group:ffdhe2048 -pkeyopt priv_len:224 -text
*/
static const unsigned char priv_data[] = {
0x88, 0x85, 0xe7, 0x9f, 0xee, 0x6d, 0xc5, 0x7c, 0x78, 0xaf, 0x63, 0x5d,