From db4f0c111d3d2ec9fb666f340137159c7cbf1030 Mon Sep 17 00:00:00 2001 From: beck <> Date: Mon, 13 Nov 2023 12:46:07 +0000 Subject: Prepare to expose OPENSSL_gmtime and OPENSSL_timegm as public This matches when BoringSSL has done, and allows for getting rid of the dependency on system timegm() and gmtime() in libtls. which will make life easier for portable, and remove our dependency on the potentially very slow system versions. ok tb@ - tb will handle the minor bump bits and expose on the next minor bump CVS :---------------------------------------------------------------------- --- src/lib/libcrypto/man/ASN1_TIME_set.3 | 44 +++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'src/lib/libcrypto/man') diff --git a/src/lib/libcrypto/man/ASN1_TIME_set.3 b/src/lib/libcrypto/man/ASN1_TIME_set.3 index 4f6a99673a..3b649e05be 100644 --- a/src/lib/libcrypto/man/ASN1_TIME_set.3 +++ b/src/lib/libcrypto/man/ASN1_TIME_set.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ASN1_TIME_set.3,v 1.19 2022/11/13 22:11:44 schwarze Exp $ +.\" $OpenBSD: ASN1_TIME_set.3,v 1.20 2023/11/13 12:46:07 beck Exp $ .\" full merge up to: OpenSSL 3d0f1cb9 Jul 11 03:01:24 2017 +0800 .\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 .\" @@ -68,7 +68,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: November 13 2022 $ +.Dd $Mdocdate: November 13 2023 $ .Dt ASN1_TIME_SET 3 .Os .Sh NAME @@ -95,6 +95,8 @@ .Nm ASN1_UTCTIME_cmp_time_t , .Nm ASN1_TIME_compare , .Nm ASN1_TIME_to_generalizedtime +.Nm OPENSSL_gmtime, +.Nm OPENSSL_timegm, .Nd ASN.1 Time functions .Sh SYNOPSIS .In openssl/asn1.h @@ -217,6 +219,16 @@ .Fa "const ASN1_TIME *t" .Fa "ASN1_GENERALIZEDTIME **out" .Fc +.Ft struct tm * +.Fo OPENSSL_gmtime +.Fa "const time_t *time" +.Fa "struct tm *out_tm" +.Fc +.Ft int +.Fo OPENSSL_timegm +.Fa "const struct tm *tm" +.Fa "time_t *out_time" +.Fc .Sh DESCRIPTION An .Vt ASN1_TIME @@ -562,6 +574,28 @@ is earlier than is later than .Fa t , or \-2 on error. +.Pp +.Fn OPENSSL_timegm +converts a time structure in UTC time in +.Fa tm +to a time_t value in +.Fa out_time +.Fn OPENSSL_timegm +returns 1 for success or 0 for failure. +It can fail if the time is not representable in a time_t, +or falls outside the range allowed in RFC 5280 times. +.Pp +.Fn OPENSSL_gmtime +converts a time_t value in +.Fa time +to a struct tm in +.Fa out_tm +.Fn OPENSSL_gmtime +returns +.Fa out_tm +on success or NULL for failure. +It can fail if the time is not representable in a struct tm, +or falls outside the range allowed in RFC 5280 times. .Sh EXAMPLES Set a time object to one hour after the current time and print it out: @@ -651,6 +685,12 @@ and .Fn ASN1_TIME_compare first appeared in OpenSSL 1.1.1 and have been available since .Ox 7.2 . +.Pp +.Fn OPENSSL_gmtime +and +.Fn OPENSSL_timegm +first appeared in BoringSSL and have been available since +.Ox 7.5 . .Sh CAVEATS Some applications add offset times directly to a .Vt time_t -- cgit v1.2.3-55-g6feb