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/hidden/openssl/posix_time.h | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/lib/libcrypto/hidden/openssl/posix_time.h (limited to 'src/lib/libcrypto/hidden/openssl/posix_time.h') diff --git a/src/lib/libcrypto/hidden/openssl/posix_time.h b/src/lib/libcrypto/hidden/openssl/posix_time.h new file mode 100644 index 0000000000..306d43eae5 --- /dev/null +++ b/src/lib/libcrypto/hidden/openssl/posix_time.h @@ -0,0 +1,32 @@ +/* $OpenBSD: posix_time.h,v 1.1 2024/02/18 16:28:38 tb Exp $ */ +/* + * Copyright (c) 2024 Bob Beck + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBCRYPTO_POSIX_TIME_H +#define _LIBCRYPTO_POSIX_TIME_H + +#ifndef _MSC_VER +#include_next +#else +#include "../include/openssl/posix_time.h" +#endif +#include "crypto_namespace.h" + +LCRYPTO_USED(OPENSSL_posix_to_tm); +LCRYPTO_USED(OPENSSL_tm_to_posix); +LCRYPTO_USED(OPENSSL_timegm); + +#endif /* _LIBCRYPTO_POSIX_TIME_H */ -- cgit v1.2.3-55-g6feb