summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2024-02-18 16:30:17 +0000
committertb <>2024-02-18 16:30:17 +0000
commite6f7b0b1226a54f33775814024ebcb3dc28a6c32 (patch)
tree892fc8cd4039bf5602ed3b2f74a7d81d80e7a76d /src/lib
parentf3cff8b6438de90dfb152c94ee691fd4b59b0890 (diff)
downloadopenbsd-e6f7b0b1226a54f33775814024ebcb3dc28a6c32.tar.gz
openbsd-e6f7b0b1226a54f33775814024ebcb3dc28a6c32.tar.bz2
openbsd-e6f7b0b1226a54f33775814024ebcb3dc28a6c32.zip
Update ASN1_TIME_set(3)
Document OPENSSL_{posix_to_tm,tm_to_posix}() and fix the documentation of OPENSSL_{gmtime,timegm}(). ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/ASN1_TIME_set.349
1 files changed, 44 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/ASN1_TIME_set.3 b/src/lib/libcrypto/man/ASN1_TIME_set.3
index cf8dadbb32..b5ed51567b 100644
--- a/src/lib/libcrypto/man/ASN1_TIME_set.3
+++ b/src/lib/libcrypto/man/ASN1_TIME_set.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_TIME_set.3,v 1.21 2023/11/16 14:20:49 tb Exp $ 1.\" $OpenBSD: ASN1_TIME_set.3,v 1.22 2024/02/18 16:30:17 tb Exp $
2.\" full merge up to: OpenSSL 3d0f1cb9 Jul 11 03:01:24 2017 +0800 2.\" full merge up to: OpenSSL 3d0f1cb9 Jul 11 03:01:24 2017 +0800
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
@@ -68,7 +68,7 @@
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE. 69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\" 70.\"
71.Dd $Mdocdate: November 16 2023 $ 71.Dd $Mdocdate: February 18 2024 $
72.Dt ASN1_TIME_SET 3 72.Dt ASN1_TIME_SET 3
73.Os 73.Os
74.Sh NAME 74.Sh NAME
@@ -96,7 +96,9 @@
96.Nm ASN1_TIME_compare , 96.Nm ASN1_TIME_compare ,
97.Nm ASN1_TIME_to_generalizedtime , 97.Nm ASN1_TIME_to_generalizedtime ,
98.Nm OPENSSL_gmtime , 98.Nm OPENSSL_gmtime ,
99.Nm OPENSSL_timegm 99.Nm OPENSSL_timegm ,
100.Nm OPENSSL_posix_to_tm ,
101.Nm OPENSSL_tm_to_posix
100.Nd ASN.1 Time functions 102.Nd ASN.1 Time functions
101.Sh SYNOPSIS 103.Sh SYNOPSIS
102.In openssl/asn1.h 104.In openssl/asn1.h
@@ -219,16 +221,28 @@
219.Fa "const ASN1_TIME *t" 221.Fa "const ASN1_TIME *t"
220.Fa "ASN1_GENERALIZEDTIME **out" 222.Fa "ASN1_GENERALIZEDTIME **out"
221.Fc 223.Fc
224.In openssl/crypto.h
222.Ft struct tm * 225.Ft struct tm *
223.Fo OPENSSL_gmtime 226.Fo OPENSSL_gmtime
224.Fa "const time_t *time" 227.Fa "const time_t *time"
225.Fa "struct tm *out_tm" 228.Fa "struct tm *out_tm"
226.Fc 229.Fc
230.In openssl/posix_time.h
227.Ft int 231.Ft int
228.Fo OPENSSL_timegm 232.Fo OPENSSL_timegm
229.Fa "const struct tm *tm" 233.Fa "const struct tm *tm"
230.Fa "time_t *out_time" 234.Fa "time_t *out_time"
231.Fc 235.Fc
236.Ft int
237.Fo OPENSSL_posix_to_tm
238.Fa "int64_t time"
239.Fa "struct tm *out_tm"
240.Fc
241.Ft int
242.Fo OPENSSL_tm_to_posix
243.Fa "struct tm *t_tm"
244.Fa "int64_t *out"
245.Fc
232.Sh DESCRIPTION 246.Sh DESCRIPTION
233An 247An
234.Vt ASN1_TIME 248.Vt ASN1_TIME
@@ -529,6 +543,21 @@ converts a time structure in UTC time in
529.Fa tm 543.Fa tm
530to a time_t value in 544to a time_t value in
531.Fa out_time . 545.Fa out_time .
546.Pp
547.Fn OPENSSL_posix_to_tm
548converts an
549.Vt int64_t
550POSIX time value in
551.Fa time ,
552which must be in the range of year 0 to 9999,
553to a broken out time value in
554.Fa tm .
555.Pp
556.Fn OPENSSL_tm_to_posix
557converts a time value between the years 0 and 9999 in
558.Fa tm
559to a POSIX time value in
560.Fa out .
532.Sh RETURN VALUES 561.Sh RETURN VALUES
533.Fn ASN1_TIME_set , 562.Fn ASN1_TIME_set ,
534.Fn ASN1_UTCTIME_set , 563.Fn ASN1_UTCTIME_set ,
@@ -599,6 +628,12 @@ returns
599on success or NULL for failure. 628on success or NULL for failure.
600It can fail if the time is not representable in a struct tm, 629It can fail if the time is not representable in a struct tm,
601or falls outside the range allowed in RFC 5280 times. 630or falls outside the range allowed in RFC 5280 times.
631.Pp
632.Fn OPENSSL_posix_to_tm
633and
634.Fn OPENSSL_tm_to_posix
635return 1 for success or 0 on failure.
636It is a failure if the year is less than 0 or more than 9999.
602.Sh EXAMPLES 637.Sh EXAMPLES
603Set a time object to one hour after the current time and print it 638Set a time object to one hour after the current time and print it
604out: 639out:
@@ -690,9 +725,13 @@ first appeared in OpenSSL 1.1.1 and have been available since
690.Ox 7.2 . 725.Ox 7.2 .
691.Pp 726.Pp
692.Fn OPENSSL_gmtime 727.Fn OPENSSL_gmtime
728first appeared in OpenSSL 0.9.7.
729.Fn OPENSSL_timegm ,
730.Fn OPENSSL_posix_to_tm ,
693and 731and
694.Fn OPENSSL_timegm 732.Fn OPENSSL_tm_to_posix
695first appeared in BoringSSL and have been available since 733first appeared in BoringSSL;
734all these functions have been available since
696.Ox 7.5 . 735.Ox 7.5 .
697.Sh CAVEATS 736.Sh CAVEATS
698Some applications add offset times directly to a 737Some applications add offset times directly to a