|| !TEST_ptr_eq(DH_get0_priv_key(dh), priv_key2))
goto err3;
- /* now generate a key pair ... */
- if (!DH_generate_key(dh))
+ /* now generate a key pair (expect failure since modulus is too small) */
+ if (!TEST_false(DH_generate_key(dh)))
goto err3;
- /* ... and check whether the private key was reused: */
-
- /* test it with the combined getter for pub_key and priv_key */
- DH_get0_key(dh, &pub_key2, &priv_key2);
- if (!TEST_ptr(pub_key2)
- || !TEST_ptr_eq(priv_key2, priv_key))
- goto err3;
-
- /* test it the simple getters for pub_key and priv_key */
- if (!TEST_ptr_eq(DH_get0_pub_key(dh), pub_key2)
- || !TEST_ptr_eq(DH_get0_priv_key(dh), priv_key2))
- goto err3;
-
- /* check whether the public key was calculated correctly */
- TEST_uint_eq(BN_get_word(pub_key2), 3331L);
+ /* We'll have a stale error on the queue from the above test so clear it */
+ ERR_clear_error();
/*
* II) key generation
goto err3;
BN_GENCB_set(_cb, &cb, NULL);
if (!TEST_ptr(a = DH_new())
- || !TEST_true(DH_generate_parameters_ex(a, 64,
+ || !TEST_true(DH_generate_parameters_ex(a, 512,
DH_GENERATOR_5, _cb)))
goto err3;
|| !TEST_true((cout = DH_compute_key(cbuf, apub_key, c)) != -1))
goto err3;
- if (!TEST_true(aout >= 4)
+ if (!TEST_true(aout >= 20)
|| !TEST_mem_eq(abuf, aout, bbuf, bout)
|| !TEST_mem_eq(abuf, aout, cbuf, cout))
goto err3;