Update 1.1.1-pre8
This commit is contained in:
+37
-13
@@ -2128,25 +2128,48 @@ err:
|
||||
return st;
|
||||
}
|
||||
|
||||
static int test_3_is_prime(void)
|
||||
static int primes[] = { 2, 3, 5, 7, 17863 };
|
||||
|
||||
static int test_is_prime(int i)
|
||||
{
|
||||
int ret = 0;
|
||||
BIGNUM *r = NULL;
|
||||
int trial;
|
||||
|
||||
/*
|
||||
* For a long time, small primes were not considered prime when
|
||||
* do_trial_division was set.
|
||||
*/
|
||||
if (!TEST_ptr(r = BN_new())
|
||||
|| !TEST_true(BN_set_word(r, 3))
|
||||
|| !TEST_int_eq(BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
|
||||
0 /* do_trial_division */, NULL), 1)
|
||||
|| !TEST_int_eq(BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
|
||||
1 /* do_trial_division */, NULL), 1))
|
||||
if (!TEST_ptr(r = BN_new()))
|
||||
goto err;
|
||||
|
||||
ret = 1;
|
||||
for (trial = 0; trial <= 1; ++trial) {
|
||||
if (!TEST_true(BN_set_word(r, primes[i]))
|
||||
|| !TEST_int_eq(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL),
|
||||
1))
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
err:
|
||||
BN_free(r);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int not_primes[] = { -1, 0, 1, 4 };
|
||||
|
||||
static int test_not_prime(int i)
|
||||
{
|
||||
int ret = 0;
|
||||
BIGNUM *r = NULL;
|
||||
int trial;
|
||||
|
||||
if (!TEST_ptr(r = BN_new()))
|
||||
goto err;
|
||||
|
||||
for (trial = 0; trial <= 1; ++trial) {
|
||||
if (!TEST_true(BN_set_word(r, not_primes[i]))
|
||||
|| !TEST_false(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL)))
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
err:
|
||||
BN_free(r);
|
||||
return ret;
|
||||
@@ -2250,7 +2273,8 @@ int setup_tests(void)
|
||||
ADD_TEST(test_gf2m_modsqrt);
|
||||
ADD_TEST(test_gf2m_modsolvequad);
|
||||
#endif
|
||||
ADD_TEST(test_3_is_prime);
|
||||
ADD_ALL_TESTS(test_is_prime, (int)OSSL_NELEM(primes));
|
||||
ADD_ALL_TESTS(test_not_prime, (int)OSSL_NELEM(not_primes));
|
||||
} else {
|
||||
ADD_ALL_TESTS(run_file_tests, n);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1167,7 +1167,7 @@ static int internal_curve_test_method(int n)
|
||||
* implementations of several NIST curves with characteristic > 3.
|
||||
*/
|
||||
struct nistp_test_params {
|
||||
const EC_METHOD *(*meth) ();
|
||||
const EC_METHOD *(*meth) (void);
|
||||
int degree;
|
||||
/*
|
||||
* Qx, Qy and D are taken from
|
||||
|
||||
@@ -19,6 +19,7 @@ use lib bldtop_dir('.');
|
||||
use configdata;
|
||||
|
||||
plan skip_all => "Test only supported in a shared build" if disabled("shared");
|
||||
plan skip_all => "Test is disabled on AIX" if config('target') =~ m|^aix|;
|
||||
|
||||
plan tests => 4;
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ static int test_sm2_crypt(const EC_GROUP *group,
|
||||
|
||||
static int sm2_crypt_test(void)
|
||||
{
|
||||
int testresult = 1;
|
||||
int testresult = 0;
|
||||
EC_GROUP *test_group =
|
||||
create_EC_group
|
||||
("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
typedef struct test_info {
|
||||
const char *test_case_name;
|
||||
int (*test_fn) ();
|
||||
int (*test_fn) (void);
|
||||
int (*param_test_fn)(int idx);
|
||||
int num;
|
||||
|
||||
@@ -74,7 +74,7 @@ int subtest_level(void)
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
static int should_report_leaks()
|
||||
static int should_report_leaks(void)
|
||||
{
|
||||
/*
|
||||
* When compiled with enable-crypto-mdebug, OPENSSL_DEBUG_MEMORY=0
|
||||
|
||||
Reference in New Issue
Block a user