summaryrefslogtreecommitdiff
path: root/regress/lib/libcrypto
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-05-25 06:42:16 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-05-25 06:42:16 +0000
commit1f981b2dbb2acc74b35df674e4750f719d30ce4a (patch)
tree5c616f8e1bf688c421dda2ca4f68336dfd321b61 /regress/lib/libcrypto
parent6306f047d35fa18099adaff73feeb2db92f534a3 (diff)
asn1time: another use of gmtime was hiding here
Diffstat (limited to 'regress/lib/libcrypto')
-rw-r--r--regress/lib/libcrypto/asn1/asn1time.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/regress/lib/libcrypto/asn1/asn1time.c b/regress/lib/libcrypto/asn1/asn1time.c
index 7cc6df8a1af..f7df794c549 100644
--- a/regress/lib/libcrypto/asn1/asn1time.c
+++ b/regress/lib/libcrypto/asn1/asn1time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asn1time.c,v 1.26 2024/04/08 19:57:40 beck Exp $ */
+/* $OpenBSD: asn1time.c,v 1.27 2024/05/25 06:42:15 tb Exp $ */
/*
* Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2024 Google Inc.
@@ -280,6 +280,7 @@ asn1_gentime_test(int test_no, const struct asn1_time_test *att)
const unsigned char *der;
unsigned char *p = NULL;
ASN1_GENERALIZEDTIME *gt = NULL;
+ int64_t a;
int failure = 1;
int len;
struct tm tm;
@@ -307,11 +308,16 @@ asn1_gentime_test(int test_no, const struct asn1_time_test *att)
goto done;
}
- if (timegm(&tm) != att->time) {
+ if (!OPENSSL_timegm(&tm, &a)) {
+ fprintf(stderr, "FAIL: test %d - OPENSSL_timegm falied '%s'\n",
+ test_no, att->str);
+ goto done;
+ }
+ if (a != att->time) {
/* things with crappy time_t should die in fire */
- int64_t a = timegm(&tm);
int64_t b = att->time;
- fprintf(stderr, "FAIL: test %d - times don't match, expected %lld got %lld\n",
+ fprintf(stderr, "FAIL: test %d - times don't match, "
+ "expected %lld got %lld\n",
test_no, (long long)b, (long long)a);
goto done;
}