From f3cff8b6438de90dfb152c94ee691fd4b59b0890 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sun, 18 Feb 2024 16:28:38 +0000 Subject: Add posix_time.h from BoringSSL This is prepares to expose some internal API as OPENSSL_tm_to_posix() and OPENSSL_posix_to_tm(). They will be used in libtls and ocspcheck(8) to get rid of the portability nightmare that is timegm(). Also fix the location of OPENSSL_gmtime() and OPENSSL_timegm() (this API is not yet exposed). The former is from OpenSSL and surprisingly lives in crypto.h, not asn1.h, and the latter is BoringSSL API and lives in the new posix_time.h. Initial diff from beck, this pulls in further upstream work after review feedback. ok jsing --- src/lib/libcrypto/crypto.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lib/libcrypto/crypto.h') diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h index 07a55ec1f6..47e7eff37c 100644 --- a/src/lib/libcrypto/crypto.h +++ b/src/lib/libcrypto/crypto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.h,v 1.63 2023/07/28 10:19:20 tb Exp $ */ +/* $OpenBSD: crypto.h,v 1.64 2024/02/18 16:28:37 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -522,6 +522,14 @@ int CRYPTO_memcmp(const void *a, const void *b, size_t len); int OPENSSL_init_crypto(uint64_t opts, const void *settings); void OPENSSL_cleanup(void); +/* + * OpenSSL helpfully put OPENSSL_gmtime() here because all other time related + * functions are in asn1.h. + */ +#if defined(LIBRESSL_INTERNAL) || defined(LIBRESSL_NEXT_API) +struct tm *OPENSSL_gmtime(const time_t *time, struct tm *out_tm); +#endif + void ERR_load_CRYPTO_strings(void); /* Error codes for the CRYPTO functions. */ -- cgit v1.2.3-55-g6feb