Latest update.

This commit is contained in:
2020-01-17 19:45:12 +09:00
parent 016df9f433
commit 0f7abb4eb6
1100 changed files with 47785 additions and 16292 deletions
+60
View File
@@ -320,6 +320,65 @@ static int test_table_compare(int idx)
return TEST_int_eq(ASN1_TIME_compare(&td->t1, &td->t2), td->result);
}
static int test_time_dup(void)
{
int ret = 0;
ASN1_TIME *asn1_time = NULL;
ASN1_TIME *asn1_time_dup = NULL;
ASN1_TIME *asn1_gentime = NULL;
asn1_time = ASN1_TIME_adj(NULL, time(NULL), 0, 0);
if (asn1_time == NULL) {
TEST_info("Internal error.");
goto err;
}
asn1_gentime = ASN1_TIME_to_generalizedtime(asn1_time, NULL);
if (asn1_gentime == NULL) {
TEST_info("Internal error.");
goto err;
}
asn1_time_dup = ASN1_TIME_dup(asn1_time);
if (!TEST_ptr_ne(asn1_time_dup, NULL)) {
TEST_info("ASN1_TIME_dup() failed.");
goto err;
}
if (!TEST_int_eq(ASN1_TIME_compare(asn1_time, asn1_time_dup), 0)) {
TEST_info("ASN1_TIME_dup() duplicated non-identical value.");
goto err;
}
ASN1_STRING_free(asn1_time_dup);
asn1_time_dup = ASN1_UTCTIME_dup(asn1_time);
if (!TEST_ptr_ne(asn1_time_dup, NULL)) {
TEST_info("ASN1_UTCTIME_dup() failed.");
goto err;
}
if (!TEST_int_eq(ASN1_TIME_compare(asn1_time, asn1_time_dup), 0)) {
TEST_info("ASN1_UTCTIME_dup() duplicated non-identical UTCTIME value.");
goto err;
}
ASN1_STRING_free(asn1_time_dup);
asn1_time_dup = ASN1_GENERALIZEDTIME_dup(asn1_gentime);
if (!TEST_ptr_ne(asn1_time_dup, NULL)) {
TEST_info("ASN1_GENERALIZEDTIME_dup() failed.");
goto err;
}
if (!TEST_int_eq(ASN1_TIME_compare(asn1_gentime, asn1_time_dup), 0)) {
TEST_info("ASN1_GENERALIZEDTIME_dup() dup'ed non-identical value.");
goto err;
}
ret = 1;
err:
ASN1_STRING_free(asn1_time);
ASN1_STRING_free(asn1_gentime);
ASN1_STRING_free(asn1_time_dup);
return ret;
}
int setup_tests(void)
{
/*
@@ -354,5 +413,6 @@ int setup_tests(void)
#endif
}
ADD_ALL_TESTS(test_table_compare, OSSL_NELEM(tbl_compare_testdata));
ADD_TEST(test_time_dup);
return 1;
}