summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ts/ts_conf.c
diff options
context:
space:
mode:
authorbeck <>2024-03-26 00:39:22 +0000
committerbeck <>2024-03-26 00:39:22 +0000
commit2e1f12635b32ea18eabebe5ea32396d52baf0a45 (patch)
tree6dd26637f37e838317ca1c60102598aac9f0db14 /src/lib/libcrypto/ts/ts_conf.c
parent524d4c4cfbabb48b87f3e55e544ecee35b5b6539 (diff)
downloadopenbsd-2e1f12635b32ea18eabebe5ea32396d52baf0a45.tar.gz
openbsd-2e1f12635b32ea18eabebe5ea32396d52baf0a45.tar.bz2
openbsd-2e1f12635b32ea18eabebe5ea32396d52baf0a45.zip
Change ts to only support one second precision.
RFC 3631 allows for sub second ASN1 GENERALIZED times, if you choose to support sub second time precison. It does not indicate that an implementation must support them. Supporting sub second timestamps is just silly and unrealistic, so set our maximum to one second of precision. We then simplify this code by removing some nasty eye-bleed that made artisinally hand crafted strings and jammed them into an ASN1_GENERALIZEDTIME. ok tb@, jsing@, with one second precision tested by kn@
Diffstat (limited to 'src/lib/libcrypto/ts/ts_conf.c')
-rw-r--r--src/lib/libcrypto/ts/ts_conf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/ts/ts_conf.c b/src/lib/libcrypto/ts/ts_conf.c
index 5d27a8bbc3..ef8569ef04 100644
--- a/src/lib/libcrypto/ts/ts_conf.c
+++ b/src/lib/libcrypto/ts/ts_conf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_conf.c,v 1.13 2023/11/19 15:46:10 tb Exp $ */ 1/* $OpenBSD: ts_conf.c,v 1.14 2024/03/26 00:39:22 beck Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -437,7 +437,8 @@ TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,
437 if (!NCONF_get_number_e(conf, section, ENV_CLOCK_PRECISION_DIGITS, 437 if (!NCONF_get_number_e(conf, section, ENV_CLOCK_PRECISION_DIGITS,
438 &digits)) 438 &digits))
439 digits = 0; 439 digits = 0;
440 if (digits < 0 || digits > TS_MAX_CLOCK_PRECISION_DIGITS) { 440 /* We only support second precision, so reject everything else */
441 if (digits != 0) {
441 TS_CONF_invalid(section, ENV_CLOCK_PRECISION_DIGITS); 442 TS_CONF_invalid(section, ENV_CLOCK_PRECISION_DIGITS);
442 goto err; 443 goto err;
443 } 444 }