diff options
Diffstat (limited to 'src/lib/libcrypto/man')
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_TIME_set.3 | 150 |
1 files changed, 139 insertions, 11 deletions
diff --git a/src/lib/libcrypto/man/ASN1_TIME_set.3 b/src/lib/libcrypto/man/ASN1_TIME_set.3 index cd6ab937d0..b8a567ece0 100644 --- a/src/lib/libcrypto/man/ASN1_TIME_set.3 +++ b/src/lib/libcrypto/man/ASN1_TIME_set.3 | |||
| @@ -1,8 +1,25 @@ | |||
| 1 | .\" $OpenBSD: ASN1_TIME_set.3,v 1.17 2022/03/31 17:27:16 naddy Exp $ | 1 | .\" $OpenBSD: ASN1_TIME_set.3,v 1.18 2022/11/10 17:44:05 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | 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 | .\" |
| 5 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org> | 5 | .\" This file is a derived work. |
| 6 | .\" The changes are covered by the following Copyright and license: | ||
| 7 | .\" | ||
| 8 | .\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org> | ||
| 9 | .\" | ||
| 10 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 11 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 12 | .\" copyright notice and this permission notice appear in all copies. | ||
| 13 | .\" | ||
| 14 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 15 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 16 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 17 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 18 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 19 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 20 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 21 | .\" | ||
| 22 | .\" The original file was written by Dr. Stephen Henson <steve@openssl.org> | ||
| 6 | .\" and Todd Short <tshort@akamai.com>. | 23 | .\" and Todd Short <tshort@akamai.com>. |
| 7 | .\" Copyright (c) 2015, 2017 The OpenSSL Project. All rights reserved. | 24 | .\" Copyright (c) 2015, 2017 The OpenSSL Project. All rights reserved. |
| 8 | .\" | 25 | .\" |
| @@ -50,7 +67,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 69 | .\" |
| 53 | .Dd $Mdocdate: March 31 2022 $ | 70 | .Dd $Mdocdate: November 10 2022 $ |
| 54 | .Dt ASN1_TIME_SET 3 | 71 | .Dt ASN1_TIME_SET 3 |
| 55 | .Os | 72 | .Os |
| 56 | .Sh NAME | 73 | .Sh NAME |
| @@ -61,16 +78,21 @@ | |||
| 61 | .Nm ASN1_UTCTIME_adj , | 78 | .Nm ASN1_UTCTIME_adj , |
| 62 | .Nm ASN1_GENERALIZEDTIME_adj , | 79 | .Nm ASN1_GENERALIZEDTIME_adj , |
| 63 | .Nm ASN1_TIME_set_string , | 80 | .Nm ASN1_TIME_set_string , |
| 81 | .Nm ASN1_TIME_set_string_X509 , | ||
| 64 | .Nm ASN1_UTCTIME_set_string , | 82 | .Nm ASN1_UTCTIME_set_string , |
| 65 | .Nm ASN1_GENERALIZEDTIME_set_string , | 83 | .Nm ASN1_GENERALIZEDTIME_set_string , |
| 84 | .Nm ASN1_TIME_normalize , | ||
| 66 | .Nm ASN1_TIME_check , | 85 | .Nm ASN1_TIME_check , |
| 67 | .Nm ASN1_UTCTIME_check , | 86 | .Nm ASN1_UTCTIME_check , |
| 68 | .Nm ASN1_GENERALIZEDTIME_check , | 87 | .Nm ASN1_GENERALIZEDTIME_check , |
| 69 | .Nm ASN1_TIME_print , | 88 | .Nm ASN1_TIME_print , |
| 70 | .Nm ASN1_UTCTIME_print , | 89 | .Nm ASN1_UTCTIME_print , |
| 71 | .Nm ASN1_GENERALIZEDTIME_print , | 90 | .Nm ASN1_GENERALIZEDTIME_print , |
| 91 | .Nm ASN1_TIME_to_tm , | ||
| 72 | .Nm ASN1_TIME_diff , | 92 | .Nm ASN1_TIME_diff , |
| 93 | .Nm ASN1_TIME_cmp_time_t , | ||
| 73 | .Nm ASN1_UTCTIME_cmp_time_t , | 94 | .Nm ASN1_UTCTIME_cmp_time_t , |
| 95 | .Nm ASN1_TIME_compare , | ||
| 74 | .Nm ASN1_TIME_to_generalizedtime | 96 | .Nm ASN1_TIME_to_generalizedtime |
| 75 | .Nd ASN.1 Time functions | 97 | .Nd ASN.1 Time functions |
| 76 | .Sh SYNOPSIS | 98 | .Sh SYNOPSIS |
| @@ -117,6 +139,11 @@ | |||
| 117 | .Fa "const char *str" | 139 | .Fa "const char *str" |
| 118 | .Fc | 140 | .Fc |
| 119 | .Ft int | 141 | .Ft int |
| 142 | .Fo ASN1_TIME_set_string_X509 | ||
| 143 | .Fa "ASN1_TIME *s" | ||
| 144 | .Fa "const char *str" | ||
| 145 | .Fc | ||
| 146 | .Ft int | ||
| 120 | .Fo ASN1_UTCTIME_set_string | 147 | .Fo ASN1_UTCTIME_set_string |
| 121 | .Fa "ASN1_UTCTIME *s" | 148 | .Fa "ASN1_UTCTIME *s" |
| 122 | .Fa "const char *str" | 149 | .Fa "const char *str" |
| @@ -127,6 +154,10 @@ | |||
| 127 | .Fa "const char *str" | 154 | .Fa "const char *str" |
| 128 | .Fc | 155 | .Fc |
| 129 | .Ft int | 156 | .Ft int |
| 157 | .Fo ASN1_TIME_normalize | ||
| 158 | .Fa "ASN1_TIME *s" | ||
| 159 | .Fc | ||
| 160 | .Ft int | ||
| 130 | .Fo ASN1_TIME_check | 161 | .Fo ASN1_TIME_check |
| 131 | .Fa "const ASN1_TIME *t" | 162 | .Fa "const ASN1_TIME *t" |
| 132 | .Fc | 163 | .Fc |
| @@ -154,6 +185,11 @@ | |||
| 154 | .Fa "const ASN1_GENERALIZEDTIME *s" | 185 | .Fa "const ASN1_GENERALIZEDTIME *s" |
| 155 | .Fc | 186 | .Fc |
| 156 | .Ft int | 187 | .Ft int |
| 188 | .Fo ASN1_TIME_to_tm | ||
| 189 | .Fa "const ASN1_TIME *s" | ||
| 190 | .Fa "struct tm *tm" | ||
| 191 | .Fc | ||
| 192 | .Ft int | ||
| 157 | .Fo ASN1_TIME_diff | 193 | .Fo ASN1_TIME_diff |
| 158 | .Fa "int *pday" | 194 | .Fa "int *pday" |
| 159 | .Fa "int *psec" | 195 | .Fa "int *psec" |
| @@ -161,10 +197,20 @@ | |||
| 161 | .Fa "const ASN1_TIME *to" | 197 | .Fa "const ASN1_TIME *to" |
| 162 | .Fc | 198 | .Fc |
| 163 | .Ft int | 199 | .Ft int |
| 200 | .Fo ASN1_TIME_cmp_time_t | ||
| 201 | .Fa "const ASN1_TIME *s" | ||
| 202 | .Fa "time_t t" | ||
| 203 | .Fc | ||
| 204 | .Ft int | ||
| 164 | .Fo ASN1_UTCTIME_cmp_time_t | 205 | .Fo ASN1_UTCTIME_cmp_time_t |
| 165 | .Fa "const ASN1_UTCTIME *s" | 206 | .Fa "const ASN1_UTCTIME *s" |
| 166 | .Fa "time_t t" | 207 | .Fa "time_t t" |
| 167 | .Fc | 208 | .Fc |
| 209 | .Ft int | ||
| 210 | .Fo ASN1_TIME_compare | ||
| 211 | .Fa "const ASN1_TIME *s" | ||
| 212 | .Fa "const ASN1_TIME *t" | ||
| 213 | .Fc | ||
| 168 | .Ft ASN1_GENERALIZEDTIME * | 214 | .Ft ASN1_GENERALIZEDTIME * |
| 169 | .Fo ASN1_TIME_to_generalizedtime | 215 | .Fo ASN1_TIME_to_generalizedtime |
| 170 | .Fa "const ASN1_TIME *t" | 216 | .Fa "const ASN1_TIME *t" |
| @@ -232,6 +278,7 @@ do not modify the type of the return structure. | |||
| 232 | .Pp | 278 | .Pp |
| 233 | The functions | 279 | The functions |
| 234 | .Fn ASN1_TIME_set_string , | 280 | .Fn ASN1_TIME_set_string , |
| 281 | .Fn ASN1_TIME_set_string_X509 , | ||
| 235 | .Fn ASN1_UTCTIME_set_string , | 282 | .Fn ASN1_UTCTIME_set_string , |
| 236 | and | 283 | and |
| 237 | .Fn ASN1_GENERALIZEDTIME_set_string | 284 | .Fn ASN1_GENERALIZEDTIME_set_string |
| @@ -239,8 +286,13 @@ set the time structure | |||
| 239 | .Fa s | 286 | .Fa s |
| 240 | to the time represented by the string | 287 | to the time represented by the string |
| 241 | .Fa str , | 288 | .Fa str , |
| 242 | which must be in appropriate ASN.1 time format (for example | 289 | which must be in appropriate ASN.1 time format: |
| 243 | YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ). | 290 | YYMMDDHHMMSSZ for |
| 291 | .Vt ASN1_UTCTIME , | ||
| 292 | YYYYMMDDHHMMSSZ for | ||
| 293 | .Vt ASN1_GENERALIZEDTIME , | ||
| 294 | or either of the two for | ||
| 295 | .Vt ASN1_TIME . | ||
| 244 | The string | 296 | The string |
| 245 | .Fa str | 297 | .Fa str |
| 246 | is copied into | 298 | is copied into |
| @@ -252,6 +304,30 @@ is | |||
| 252 | these functions only perform a format check on | 304 | these functions only perform a format check on |
| 253 | .Fa str . | 305 | .Fa str . |
| 254 | .Pp | 306 | .Pp |
| 307 | In LibreSSL, | ||
| 308 | .Fn ASN1_TIME_set_string | ||
| 309 | and | ||
| 310 | .Fn ASN1_TIME_set_string_X509 | ||
| 311 | behave identically. | ||
| 312 | In other implementations, | ||
| 313 | .Fn ASN1_TIME_set_string , | ||
| 314 | .Fn ASN1_UTCTIME_set_string , | ||
| 315 | and | ||
| 316 | .Fn ASN1_GENERALIZEDTIME_set_string | ||
| 317 | may accept additional formats that violate RFC 5280. | ||
| 318 | .Pp | ||
| 319 | The function | ||
| 320 | .Fn ASN1_TIME_normalize | ||
| 321 | converts an | ||
| 322 | .Vt ASN1_GENERALIZEDTIME | ||
| 323 | or | ||
| 324 | .Vt ASN1_UTCTIME | ||
| 325 | into a time value that can be used in a certificate. | ||
| 326 | It is intended to be used after the | ||
| 327 | .Fn ASN1_TIME_set_string | ||
| 328 | functions to ensure the value is valid for use as an | ||
| 329 | .Vt ASN1_TIME . | ||
| 330 | .Pp | ||
| 255 | The functions | 331 | The functions |
| 256 | .Fn ASN1_TIME_check , | 332 | .Fn ASN1_TIME_check , |
| 257 | .Fn ASN1_UTCTIME_check , | 333 | .Fn ASN1_UTCTIME_check , |
| @@ -281,6 +357,35 @@ The output of | |||
| 281 | may include a fractional part following the second. | 357 | may include a fractional part following the second. |
| 282 | .Pp | 358 | .Pp |
| 283 | The function | 359 | The function |
| 360 | .Fn ASN1_TIME_to_tm | ||
| 361 | converts the time | ||
| 362 | .Fa s | ||
| 363 | to the standard | ||
| 364 | .Vt tm | ||
| 365 | structure. | ||
| 366 | If | ||
| 367 | .Fa s | ||
| 368 | is | ||
| 369 | .Dv NULL , | ||
| 370 | then the current time is converted. | ||
| 371 | The output time is GMT. | ||
| 372 | The | ||
| 373 | .Fa tm_sec , tm_min , tm_hour , tm_mday , tm_mon , | ||
| 374 | and | ||
| 375 | .Fa tm_year | ||
| 376 | fields of the | ||
| 377 | .Vt tm | ||
| 378 | structure are set to the proper values, | ||
| 379 | whereas all other fields are set to 0. | ||
| 380 | If | ||
| 381 | .Fa tm | ||
| 382 | is | ||
| 383 | .Dv NULL , | ||
| 384 | this function performs a format check on | ||
| 385 | .Fa s | ||
| 386 | only. | ||
| 387 | .Pp | ||
| 388 | The function | ||
| 284 | .Fn ASN1_TIME_diff | 389 | .Fn ASN1_TIME_diff |
| 285 | sets | 390 | sets |
| 286 | .Pf * Fa pday | 391 | .Pf * Fa pday |
| @@ -333,9 +438,12 @@ is | |||
| 333 | .Dv NULL , | 438 | .Dv NULL , |
| 334 | the current time is used. | 439 | the current time is used. |
| 335 | .Pp | 440 | .Pp |
| 336 | The function | 441 | The functions |
| 337 | .Fn ASN1_UTCTIME_cmp_time_t | 442 | .Fn ASN1_TIME_cmp_time_t , |
| 338 | compares the two times represented by | 443 | .Fn ASN1_UTCTIME_cmp_time_t , |
| 444 | and | ||
| 445 | .Fn ASN1_TIME_compare | ||
| 446 | compare the two times represented by | ||
| 339 | .Fa s | 447 | .Fa s |
| 340 | and | 448 | and |
| 341 | .Fa t . | 449 | .Fa t . |
| @@ -411,11 +519,15 @@ return a pointer to a time structure or | |||
| 411 | if an error occurred. | 519 | if an error occurred. |
| 412 | .Pp | 520 | .Pp |
| 413 | .Fn ASN1_TIME_set_string , | 521 | .Fn ASN1_TIME_set_string , |
| 522 | .Fn ASN1_TIME_set_string_X509 , | ||
| 414 | .Fn ASN1_UTCTIME_set_string , | 523 | .Fn ASN1_UTCTIME_set_string , |
| 415 | and | 524 | and |
| 416 | .Fn ASN1_GENERALIZEDTIME_set_string | 525 | .Fn ASN1_GENERALIZEDTIME_set_string |
| 417 | return 1 if the time value is successfully set or 0 otherwise. | 526 | return 1 if the time value is successfully set or 0 otherwise. |
| 418 | .Pp | 527 | .Pp |
| 528 | .Fn ASN1_TIME_normalize | ||
| 529 | returns 1 on success or 0 on error. | ||
| 530 | .Pp | ||
| 419 | .Fn ASN1_TIME_check , | 531 | .Fn ASN1_TIME_check , |
| 420 | .Fn ASN1_UTCTIME_check , | 532 | .Fn ASN1_UTCTIME_check , |
| 421 | and | 533 | and |
| @@ -429,12 +541,19 @@ and | |||
| 429 | return 1 if the time is successfully printed or 0 if an error | 541 | return 1 if the time is successfully printed or 0 if an error |
| 430 | occurred (I/O error or invalid time format). | 542 | occurred (I/O error or invalid time format). |
| 431 | .Pp | 543 | .Pp |
| 544 | .Fn ASN1_TIME_to_tm | ||
| 545 | returns 1 if the time is successfully parsed | ||
| 546 | or 0 if an error occurred, usually due to an invalid time format. | ||
| 547 | .Pp | ||
| 432 | .Fn ASN1_TIME_diff | 548 | .Fn ASN1_TIME_diff |
| 433 | returns 1 for success or 0 for failure. | 549 | returns 1 for success or 0 for failure. |
| 434 | It can for example fail if a time structure passed in has invalid syntax. | 550 | It can for example fail if a time structure passed in has invalid syntax. |
| 435 | .Pp | 551 | .Pp |
| 436 | .Fn ASN1_UTCTIME_cmp_time_t | 552 | .Fn ASN1_TIME_cmp_time_t , |
| 437 | returns \-1 if | 553 | .Fn ASN1_UTCTIME_cmp_time_t , |
| 554 | and | ||
| 555 | .Fn ASN1_TIME_compare | ||
| 556 | return \-1 if | ||
| 438 | .Fa s | 557 | .Fa s |
| 439 | is earlier than | 558 | is earlier than |
| 440 | .Fa t , | 559 | .Fa t , |
| @@ -508,6 +627,15 @@ first appeared in OpenSSL 1.0.0 and have been available since | |||
| 508 | .Fn ASN1_TIME_diff | 627 | .Fn ASN1_TIME_diff |
| 509 | first appeared in OpenSSL 1.0.2 and have been available since | 628 | first appeared in OpenSSL 1.0.2 and have been available since |
| 510 | .Ox 7.1 . | 629 | .Ox 7.1 . |
| 630 | .Pp | ||
| 631 | .Fn ASN1_TIME_set_string_X509 , | ||
| 632 | .Fn ASN1_TIME_normalize , | ||
| 633 | .Fn ASN1_TIME_to_tm , | ||
| 634 | .Fn ASN1_TIME_cmp_time_t , | ||
| 635 | and | ||
| 636 | .Fn ASN1_TIME_compare | ||
| 637 | first appeared in OpenSSL 1.1.1 and have been available since | ||
| 638 | .Ox 7.2 . | ||
| 511 | .Sh CAVEATS | 639 | .Sh CAVEATS |
| 512 | Some applications add offset times directly to a | 640 | Some applications add offset times directly to a |
| 513 | .Vt time_t | 641 | .Vt time_t |
