summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-05-25 06:42:15 +0000
committertb <>2024-05-25 06:42:15 +0000
commit0b18503b8e8261f13127e58a3aa7b003be49cc0e (patch)
treed3161430c963457185e30ed51695f46acf5d78f3 /src
parent06f53edf241fb11cf4679708d5a59f1e31363ac4 (diff)
downloadopenbsd-0b18503b8e8261f13127e58a3aa7b003be49cc0e.tar.gz
openbsd-0b18503b8e8261f13127e58a3aa7b003be49cc0e.tar.bz2
openbsd-0b18503b8e8261f13127e58a3aa7b003be49cc0e.zip
asn1time: another use of gmtime was hiding here
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/asn1/asn1time.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/regress/lib/libcrypto/asn1/asn1time.c b/src/regress/lib/libcrypto/asn1/asn1time.c
index 7cc6df8a1a..f7df794c54 100644
--- a/src/regress/lib/libcrypto/asn1/asn1time.c
+++ b/src/regress/lib/libcrypto/asn1/asn1time.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1time.c,v 1.26 2024/04/08 19:57:40 beck Exp $ */ 1/* $OpenBSD: asn1time.c,v 1.27 2024/05/25 06:42:15 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2024 Google Inc. 4 * Copyright (c) 2024 Google Inc.
@@ -280,6 +280,7 @@ asn1_gentime_test(int test_no, const struct asn1_time_test *att)
280 const unsigned char *der; 280 const unsigned char *der;
281 unsigned char *p = NULL; 281 unsigned char *p = NULL;
282 ASN1_GENERALIZEDTIME *gt = NULL; 282 ASN1_GENERALIZEDTIME *gt = NULL;
283 int64_t a;
283 int failure = 1; 284 int failure = 1;
284 int len; 285 int len;
285 struct tm tm; 286 struct tm tm;
@@ -307,11 +308,16 @@ asn1_gentime_test(int test_no, const struct asn1_time_test *att)
307 goto done; 308 goto done;
308 } 309 }
309 310
310 if (timegm(&tm) != att->time) { 311 if (!OPENSSL_timegm(&tm, &a)) {
312 fprintf(stderr, "FAIL: test %d - OPENSSL_timegm falied '%s'\n",
313 test_no, att->str);
314 goto done;
315 }
316 if (a != att->time) {
311 /* things with crappy time_t should die in fire */ 317 /* things with crappy time_t should die in fire */
312 int64_t a = timegm(&tm);
313 int64_t b = att->time; 318 int64_t b = att->time;
314 fprintf(stderr, "FAIL: test %d - times don't match, expected %lld got %lld\n", 319 fprintf(stderr, "FAIL: test %d - times don't match, "
320 "expected %lld got %lld\n",
315 test_no, (long long)b, (long long)a); 321 test_no, (long long)b, (long long)a);
316 goto done; 322 goto done;
317 } 323 }