From: tb Date: Wed, 24 Nov 2021 19:24:46 +0000 (+0000) Subject: Fix timestamp printing in Signed Certificate Timestamps X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8c08b2605471a62d92ca70a0ec163a4349a9cbfe;p=openbsd 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 --- diff --git a/lib/libcrypto/ct/ct_prn.c b/lib/libcrypto/ct/ct_prn.c index 3b1be713946..37781ee37bd 100644 --- a/lib/libcrypto/ct/ct_prn.c +++ b/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);