summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-02-24 14:37:54 +0000
committerDavid Howells <dhowells@redhat.com>2016-02-29 14:29:40 +0000
commit4bfb9b3a276e8ca0e96474318f8a1c91b77da91d (patch)
treecf6e5e65774baff28f38c26e3996f5a41c84a269
parent552d5628e6b31c91f0ca6ffaea0754abc56d61ba (diff)
downloadlinux-crypto-4bfb9b3a276e8ca0e96474318f8a1c91b77da91d.tar.gz
linux-crypto-4bfb9b3a276e8ca0e96474318f8a1c91b77da91d.zip
X.509: Handle midnight alternative notation in GeneralizedTime
The ASN.1 GeneralizedTime object carries an ISO 8601 format date and time. The time is permitted to show midnight as 00:00 or 24:00 (the latter being equivalent of 00:00 of the following day). The permitted value is checked in x509_decode_time() but the actual handling is left to mktime64(). Without this patch, certain X.509 certificates will be rejected and could lead to an unbootable kernel. Note that with this patch we also permit any 24:mm:ss time and extend this to UTCTime, which whilst not strictly correct don't permit much leeway in fiddling date strings. Reported-by: Rudolf Polzer <rpolzer@google.com> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> cc: David Woodhouse <David.Woodhouse@intel.com> cc: John Stultz <john.stultz@linaro.org>
-rw-r--r--crypto/asymmetric_keys/x509_cert_parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
index 99ff5382..c02c200a 100644
--- a/crypto/asymmetric_keys/x509_cert_parser.c
+++ b/crypto/asymmetric_keys/x509_cert_parser.c
@@ -525,7 +525,7 @@ int x509_decode_time(time64_t *_t, size_t hdrlen,
}
if (day < 1 || day > mon_len ||
- hour > 23 ||
+ hour > 24 || /* ISO 8601 permits 24:00:00 as midnight tomorrow */
min > 59 ||
sec > 60) /* ISO 8601 permits leap seconds [X.680 46.3] */
goto invalid_time;