]> git.karo-electronics.de Git - karo-tx-linux.git/commit
MODSIGN: Fix 32-bit overflow in X.509 certificate validity date checking
authorDavid Howells <dhowells@redhat.com>
Tue, 2 Oct 2012 13:36:16 +0000 (14:36 +0100)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 8 Oct 2012 04:04:02 +0000 (14:34 +1030)
commite42566432ee87820ef37ac3f2c1f215057467ebc
treefdbf54986ce97f473661d62510a513bb4ba79aa9
parent7dcb72b94b114d03272eaa6393a4a8aca90eb96d
MODSIGN: Fix 32-bit overflow in X.509 certificate validity date checking

The current choice of lifetime for the autogenerated X.509 of 100 years,
putting the validTo date in 2112, causes problems on 32-bit systems where a
32-bit time_t wraps in 2106.  64-bit x86_64 systems seem to be unaffected.

This can result in something like:

Loading module verification certificates
X.509: Cert 6e03943da0f3b015ba6ed7f5e0cac4fe48680994 has expired
MODSIGN: Problem loading in-kernel X.509 certificate (-127)

Or:

X.509: Cert 6e03943da0f3b015ba6ed7f5e0cac4fe48680994 is not yet valid
MODSIGN: Problem loading in-kernel X.509 certificate (-129)

Instead of turning the dates into time_t values and comparing, turn the system
clock and the ASN.1 dates into tm structs and compare those piecemeal instead.

Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Josh Boyer <jwboyer@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
crypto/asymmetric_keys/x509_cert_parser.c
crypto/asymmetric_keys/x509_parser.h
crypto/asymmetric_keys/x509_public_key.c