X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fcrypto%2Fasymmetric_keys%2Fx509_cert_parser.c;fp=kernel%2Fcrypto%2Fasymmetric_keys%2Fx509_cert_parser.c;h=13c4e5a5fe8c47b546bc34cbc109279dfa81fb4a;hb=52f993b8e89487ec9ee15a7fb4979e0f09a45b27;hp=021d39c0ba75a8ce3c8c6cb4ea2c41cddd954ad7;hpb=c189ccac5702322ed843fe17057035b7222a59b6;p=kvmfornfv.git diff --git a/kernel/crypto/asymmetric_keys/x509_cert_parser.c b/kernel/crypto/asymmetric_keys/x509_cert_parser.c index 021d39c0b..13c4e5a5f 100644 --- a/kernel/crypto/asymmetric_keys/x509_cert_parser.c +++ b/kernel/crypto/asymmetric_keys/x509_cert_parser.c @@ -494,7 +494,7 @@ int x509_decode_time(time64_t *_t, size_t hdrlen, unsigned char tag, const unsigned char *value, size_t vlen) { - static const unsigned char month_lengths[] = { 31, 29, 31, 30, 31, 30, + static const unsigned char month_lengths[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; const unsigned char *p = value; unsigned year, mon, day, hour, min, sec, mon_len; @@ -540,9 +540,9 @@ int x509_decode_time(time64_t *_t, size_t hdrlen, if (year % 4 == 0) { mon_len = 29; if (year % 100 == 0) { - year /= 100; - if (year % 4 != 0) - mon_len = 28; + mon_len = 28; + if (year % 400 == 0) + mon_len = 29; } } }