From 0b0465cad1389537c86735b278fe4798a1ddf803 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 24 Nov 2021 19:24:46 +0000 Subject: Fix timestamp printing in Signed Certificate Timestamps Our ASN1_GENERALIZEDTIME_set() doesn't accept time strings with fractional seconds, so don't feed it milliseconds, but only seconds. Ensures that openssl x509 -text prints timestamps instead of skipping them. ok beck jsing --- src/lib/libcrypto/ct/ct_prn.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/libcrypto/ct/ct_prn.c b/src/lib/libcrypto/ct/ct_prn.c index 3b1be71394..37781ee37b 100644 --- a/src/lib/libcrypto/ct/ct_prn.c +++ b/src/lib/libcrypto/ct/ct_prn.c @@ -71,8 +71,7 @@ timestamp_print(uint64_t timestamp, BIO *out) * Note GeneralizedTime from ASN1_GENERALIZETIME_adj is always 15 * characters long with a final Z. Update it with fractional seconds. */ - snprintf(genstr, sizeof(genstr), "%.14s.%03dZ", - ASN1_STRING_get0_data(gen), (unsigned int)(timestamp % 1000)); + snprintf(genstr, sizeof(genstr), "%.14sZ", ASN1_STRING_get0_data(gen)); if (ASN1_GENERALIZEDTIME_set_string(gen, genstr)) ASN1_GENERALIZEDTIME_print(out, gen); ASN1_GENERALIZEDTIME_free(gen); -- cgit v1.2.3-55-g6feb