summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_time_posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_time_posix.c')
-rw-r--r--src/lib/libcrypto/asn1/a_time_posix.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/a_time_posix.c b/src/lib/libcrypto/asn1/a_time_posix.c
index 9327aa8bf0..5d10d21d3c 100644
--- a/src/lib/libcrypto/asn1/a_time_posix.c
+++ b/src/lib/libcrypto/asn1/a_time_posix.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_time_posix.c,v 1.3 2023/01/01 16:58:23 miod Exp $ */ 1/* $OpenBSD: a_time_posix.c,v 1.4 2023/11/13 12:46:07 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2022, Google Inc. 3 * Copyright (c) 2022, Google Inc.
4 * Copyright (c) 2022, Bob Beck <beck@obtuse.com> 4 * Copyright (c) 2022, Bob Beck <beck@obtuse.com>
@@ -26,6 +26,8 @@
26#include <string.h> 26#include <string.h>
27#include <time.h> 27#include <time.h>
28 28
29#include <openssl/asn1.h>
30
29#define SECS_PER_HOUR (int64_t)(60 * 60) 31#define SECS_PER_HOUR (int64_t)(60 * 60)
30#define SECS_PER_DAY (int64_t)(24 * SECS_PER_HOUR) 32#define SECS_PER_DAY (int64_t)(24 * SECS_PER_HOUR)
31 33
@@ -221,6 +223,20 @@ asn1_time_time_t_to_tm(const time_t *time, struct tm *out_tm)
221} 223}
222 224
223int 225int
226OPENSSL_timegm(const struct tm *tm, time_t *out) {
227 return asn1_time_tm_to_time_t(tm, out);
228}
229LCRYPTO_ALIAS(OPENSSL_timegm);
230
231struct tm *
232OPENSSL_gmtime(const time_t *time, struct tm *out_tm) {
233 if (!asn1_time_time_t_to_tm(time, out_tm))
234 return NULL;
235 return out_tm;
236}
237LCRYPTO_ALIAS(OPENSSL_gmtime);
238
239int
224OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec) 240OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec)
225{ 241{
226 int64_t posix_time; 242 int64_t posix_time;