diff options
author | tb <> | 2021-11-24 19:24:46 +0000 |
---|---|---|
committer | tb <> | 2021-11-24 19:24:46 +0000 |
commit | 0b0465cad1389537c86735b278fe4798a1ddf803 (patch) | |
tree | 23cd555a61379aa720361be0fdf1a9d76155ba4a /src/lib | |
parent | 39b2e104eb5610c7651117e43e96c28139410e63 (diff) | |
download | openbsd-0b0465cad1389537c86735b278fe4798a1ddf803.tar.gz openbsd-0b0465cad1389537c86735b278fe4798a1ddf803.tar.bz2 openbsd-0b0465cad1389537c86735b278fe4798a1ddf803.zip |
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
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/ct/ct_prn.c | 3 |
1 files changed, 1 insertions, 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) | |||
71 | * Note GeneralizedTime from ASN1_GENERALIZETIME_adj is always 15 | 71 | * Note GeneralizedTime from ASN1_GENERALIZETIME_adj is always 15 |
72 | * characters long with a final Z. Update it with fractional seconds. | 72 | * characters long with a final Z. Update it with fractional seconds. |
73 | */ | 73 | */ |
74 | snprintf(genstr, sizeof(genstr), "%.14s.%03dZ", | 74 | snprintf(genstr, sizeof(genstr), "%.14sZ", ASN1_STRING_get0_data(gen)); |
75 | ASN1_STRING_get0_data(gen), (unsigned int)(timestamp % 1000)); | ||
76 | if (ASN1_GENERALIZEDTIME_set_string(gen, genstr)) | 75 | if (ASN1_GENERALIZEDTIME_set_string(gen, genstr)) |
77 | ASN1_GENERALIZEDTIME_print(out, gen); | 76 | ASN1_GENERALIZEDTIME_print(out, gen); |
78 | ASN1_GENERALIZEDTIME_free(gen); | 77 | ASN1_GENERALIZEDTIME_free(gen); |