• David Howells's avatar
    X.509: Support leap seconds · da02559c
    David Howells authored
    The format of ASN.1 GeneralizedTime seems to be specified by ISO 8601
    [X.680 46.3] and this apparently supports leap seconds (ie. the seconds
    field is 60).  It's not entirely clear that ASN.1 expects it, but we can
    relax the seconds check slightly for GeneralizedTime.
    
    This results in us passing a time with sec as 60 to mktime64(), which
    handles it as being a duplicate of the 0th second of the next minute.
    
    We can't really do otherwise without giving the kernel much greater
    knowledge of where all the leap seconds are.  Unfortunately, this would
    require change the mapping of the kernel's current-time-in-seconds.
    
    UTCTime, however, only supports a seconds value in the range 00-59, but for
    the sake of simplicity allow this with UTCTime also.
    
    Without this patch, certain X.509 certificates will be rejected,
    potentially making a kernel unbootable.
    Reported-by: default avatarRudolf Polzer <rpolzer@google.com>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
    cc: David Woodhouse <David.Woodhouse@intel.com>
    cc: John Stultz <john.stultz@linaro.org>
    da02559c
x509_cert_parser.c 15.6 KB