diff options
Diffstat (limited to 'src/lib/libcrypto/asn1')
| -rw-r--r-- | src/lib/libcrypto/asn1/a_time_posix.c | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1.h | 7 |
2 files changed, 23 insertions, 2 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 | ||
| 223 | int | 225 | int |
| 226 | OPENSSL_timegm(const struct tm *tm, time_t *out) { | ||
| 227 | return asn1_time_tm_to_time_t(tm, out); | ||
| 228 | } | ||
| 229 | LCRYPTO_ALIAS(OPENSSL_timegm); | ||
| 230 | |||
| 231 | struct tm * | ||
| 232 | OPENSSL_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 | } | ||
| 237 | LCRYPTO_ALIAS(OPENSSL_gmtime); | ||
| 238 | |||
| 239 | int | ||
| 224 | OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec) | 240 | OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec) |
| 225 | { | 241 | { |
| 226 | int64_t posix_time; | 242 | int64_t posix_time; |
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index 5eeee3317b..0816f2ac9a 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1.h,v 1.80 2023/07/28 10:33:13 tb Exp $ */ | 1 | /* $OpenBSD: asn1.h,v 1.81 2023/11/13 12:46:07 beck Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -914,6 +914,11 @@ int SMIME_text(BIO *in, BIO *out); | |||
| 914 | 914 | ||
| 915 | void ERR_load_ASN1_strings(void); | 915 | void ERR_load_ASN1_strings(void); |
| 916 | 916 | ||
| 917 | #if defined(LIBRESSL_INTERNAL) || defined(LIBRESSL_NEXT_API) | ||
| 918 | int OPENSSL_timegm(const struct tm *tm, time_t *out); | ||
| 919 | struct tm *OPENSSL_gmtime(const time_t *time, struct tm *out_tm); | ||
| 920 | #endif | ||
| 921 | |||
| 917 | /* Error codes for the ASN1 functions. */ | 922 | /* Error codes for the ASN1 functions. */ |
| 918 | 923 | ||
| 919 | /* Function codes. */ | 924 | /* Function codes. */ |
