summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Yang <yang.yang@baishancloud.com>2017-07-11 03:01:24 +0800
committerPauli <paul.dale@oracle.com>2017-07-24 08:27:27 +1000
commit3d0f1cb9fdd630c6c920bc97bf496538717e7705 (patch)
tree9158a0ff2ce5d7385fd441d6ecd5eb05bcd1d63a /test
parenta1099821f9937717f92464056d80f2e303a73a4d (diff)
Add asn1_time_to_tm function and check days in month
Based on discussion in PR #3566. Reduce duplicated code in original asn1_utctime_to_tm and asn1_generalizedtime_to_tm, and introduce a new internal function asn1_time_to_tm. This function also checks if the days in the input time string is valid or not for the corresponding month. Test cases are also added. Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/3905)
Diffstat (limited to 'test')
-rw-r--r--test/x509_time_test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/x509_time_test.c b/test/x509_time_test.c
index 6812805847..21f6980a49 100644
--- a/test/x509_time_test.c
+++ b/test/x509_time_test.c
@@ -56,6 +56,14 @@ static TESTDATA_FORMAT x509_format_tests[] = {
"20170217180105Z", 0, 1, -1, NULL,
},
{
+ /* not leap year, check only */
+ "20170229180105Z", 0, 0, -1, NULL,
+ },
+ {
+ /* leap year, check only */
+ "20160229180105Z", 0, 1, -1, NULL,
+ },
+ {
/* SS is missing, check only */
"201702171801Z", 0, 0, -1, NULL,
},
@@ -97,6 +105,14 @@ static TESTDATA_FORMAT x509_format_tests[] = {
"1702171801Z", 0, 0, -1, NULL,
},
{
+ /* not leap year, check only */
+ "050229180101Z", 0, 0, -1, NULL,
+ },
+ {
+ /* leap year, check only */
+ "040229180101Z", 0, 1, -1, NULL,
+ },
+ {
/* time zone, check only */
"170217180154+0800", 0, 0, -1, NULL,
},