Skip to content

Commit 04c8e89

Browse files
committed
Add --no-ts option to sign tool
For tests with reproducible payload across build
1 parent 9cf9472 commit 04c8e89

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tools/keytools/sign.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ struct cmd_options {
233233
int hash_algo;
234234
int sign;
235235
int delta;
236+
int no_ts;
236237
int sign_wenc;
237238
const char *image_file;
238239
const char *key_file;
@@ -929,10 +930,13 @@ static int make_header_ex(int is_diff, uint8_t *pubkey, uint32_t pubkey_sz,
929930
/* Append pad bytes, so timestamp val field is 8-byte aligned */
930931
while ((header_idx % 8) != 4)
931932
header_idx++;
932-
/* Append Timestamp field */
933-
stat(image_file, &attrib);
934-
header_append_tag(header, &header_idx, HDR_TIMESTAMP, HDR_TIMESTAMP_LEN,
935-
&attrib.st_ctime);
933+
934+
if (!CMD.no_ts) {
935+
/* Append Timestamp field */
936+
stat(image_file, &attrib);
937+
header_append_tag(header, &header_idx, HDR_TIMESTAMP, HDR_TIMESTAMP_LEN,
938+
&attrib.st_ctime);
939+
}
936940

937941
/* Append Image type field */
938942
image_type = (uint16_t)CMD.sign & HDR_IMG_TYPE_AUTH_MASK;
@@ -1816,6 +1820,9 @@ int main(int argc, char** argv)
18161820
CMD.delta = 1;
18171821
CMD.delta_base_file = argv[++i];
18181822
}
1823+
else if (strcmp(argv[i], "--no-ts") == 0) {
1824+
CMD.no_ts = 1;
1825+
}
18191826
else if (strcmp(argv[i], "--policy") == 0) {
18201827
CMD.policy_sign = 1;
18211828
CMD.policy_file = argv[++i];

0 commit comments

Comments
 (0)