Add mfail test for ossl_ffc_params_copy
Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.foundation> Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org> MergeDate: Mon May 11 07:21:47 2026 (Merged from https://github.com/openssl/openssl/pull/31098)
This commit is contained in:
parent
a887f93cc7
commit
df53ee4fa0
1 changed files with 42 additions and 0 deletions
|
|
@ -690,6 +690,47 @@ err:
|
|||
DH_free(dh);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ffc_params_copy_mfail(void)
|
||||
{
|
||||
int ret = 0;
|
||||
FFC_PARAMS params, copy;
|
||||
BIGNUM *p = NULL, *q = NULL, *g = NULL;
|
||||
|
||||
ossl_ffc_params_init(¶ms);
|
||||
ossl_ffc_params_init(©);
|
||||
|
||||
if (!TEST_ptr(p = BN_bin2bn(dsa_2048_224_sha256_p,
|
||||
sizeof(dsa_2048_224_sha256_p), NULL))
|
||||
|| !TEST_ptr(q = BN_bin2bn(dsa_2048_224_sha256_q,
|
||||
sizeof(dsa_2048_224_sha256_q), NULL))
|
||||
|| !TEST_ptr(g = BN_bin2bn(dsa_2048_224_sha256_g,
|
||||
sizeof(dsa_2048_224_sha256_g), NULL)))
|
||||
goto err;
|
||||
|
||||
ossl_ffc_params_set0_pqg(¶ms, p, q, g);
|
||||
p = q = g = NULL;
|
||||
if (!TEST_true(ossl_ffc_params_set_seed(¶ms, dsa_2048_224_sha224_seed,
|
||||
sizeof(dsa_2048_224_sha224_seed))))
|
||||
goto err;
|
||||
|
||||
MFAIL_start();
|
||||
ret = ossl_ffc_params_copy(©, ¶ms);
|
||||
MFAIL_end();
|
||||
|
||||
if (!ret)
|
||||
goto err;
|
||||
|
||||
ret = 1;
|
||||
err:
|
||||
ossl_ffc_params_cleanup(¶ms);
|
||||
if (ret)
|
||||
ossl_ffc_params_cleanup(©);
|
||||
BN_free(p);
|
||||
BN_free(q);
|
||||
BN_free(g);
|
||||
return ret;
|
||||
}
|
||||
#endif /* OPENSSL_NO_DH */
|
||||
|
||||
int setup_tests(void)
|
||||
|
|
@ -706,6 +747,7 @@ int setup_tests(void)
|
|||
ADD_TEST(ffc_private_validate_test);
|
||||
ADD_ALL_TESTS(ffc_private_gen_test, 10);
|
||||
ADD_TEST(ffc_params_copy_test);
|
||||
ADD_MFAIL_TEST(ffc_params_copy_mfail);
|
||||
#endif /* OPENSSL_NO_DH */
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue