diff options
author | James Bottomley <JBottomley@Parallels.com> | 2015-03-12 09:47:09 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2015-03-12 09:47:09 -0400 |
commit | 29af7cf326fbf42080a3b5171e5eb380616b5c1f (patch) | |
tree | 92f46ddcb27a115ea56b35b14274a1f47c84b248 | |
parent | ed79a20e24014372028136f59958a4478dc5f7e9 (diff) | |
download | efitools-29af7cf326fbf42080a3b5171e5eb380616b5c1f.tar.gz |
Fix month offset problem
ktgsmith reports that we have a cocup constructing the EFI_TIMESTAMP because
the unix value tm_mon is 0-11 and the EFI_TIMESTAMP Month field is 1-12. Fix
this by adding one everywhere we use tm_mon.
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | cert-to-efi-hash-list.c | 2 | ||||
-rw-r--r-- | efi-updatevar.c | 2 | ||||
-rw-r--r-- | sign-efi-sig-list.c | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/cert-to-efi-hash-list.c b/cert-to-efi-hash-list.c index e7436c1..1bd45dc 100644 --- a/cert-to-efi-hash-list.c +++ b/cert-to-efi-hash-list.c @@ -103,7 +103,7 @@ main(int argc, char *argv[]) /* timestamp.Year is from 0 not 1900 as tm year is */ tms.tm_year += 1900; timestamp.Year = tms.tm_year; - timestamp.Month = tms.tm_mon; + timestamp.Month = tms.tm_mon + 1; timestamp.Day = tms.tm_mday; timestamp.Hour = tms.tm_hour; timestamp.Minute = tms.tm_min; diff --git a/efi-updatevar.c b/efi-updatevar.c index 62a8175..bc92cb8 100644 --- a/efi-updatevar.c +++ b/efi-updatevar.c @@ -328,7 +328,7 @@ main(int argc, char *argv[]) /* FIXME: currently timestamp is one year into future because of * the way we set up the secure environment */ timestamp.Year = tm->tm_year + 1900 + 1; - timestamp.Month = tm->tm_mon; + timestamp.Month = tm->tm_mon + 1; timestamp.Day = tm->tm_mday; timestamp.Hour = tm->tm_hour; timestamp.Minute = tm->tm_min; diff --git a/sign-efi-sig-list.c b/sign-efi-sig-list.c index ab6b9b7..56aa8e2 100644 --- a/sign-efi-sig-list.c +++ b/sign-efi-sig-list.c @@ -158,6 +158,7 @@ main(int argc, char *argv[]) tm = &tms; /* timestamp.Year is from 0 not 1900 as tm year is */ tm->tm_year += 1900; + tm->tm_mon += 1; /* tm_mon is 0-11 not 1-12 */ } else if (attributes & EFI_VARIABLE_APPEND_WRITE) { /* for append update timestamp should be zero */ memset(&tms, 0, sizeof(tms)); @@ -167,6 +168,7 @@ main(int argc, char *argv[]) tm = localtime(&t); /* timestamp.Year is from 0 not 1900 as tm year is */ tm->tm_year += 1900; + tm->tm_mon += 1; /* tm_mon is 0-11 not 1-12 */ } timestamp.Year = tm->tm_year; |