- source_date_epoch = getenv("SOURCE_DATE_EPOCH");
- if (source_date_epoch != NULL) {
- time = (time_t) strtol(source_date_epoch, NULL, 10);
-
- time_universal = gmtime(&time);
- if (time_universal == NULL) {
- fprintf(stderr, "%s: SOURCE_DATE_EPOCH is not valid\n",
- __func__);
- time = 0;
- } else {
- time = mktime(time_universal);
- }
- } else {
- time = sbuf->st_mtime;
+ time = imagetool_get_source_date(params, sbuf->st_mtime);
+ ep = params->ep;
+ addr = params->addr;
+
+ if (params->type == IH_TYPE_FIRMWARE_IVT)
+ /* Add size of CSF minus IVT */
+ imagesize = sbuf->st_size - sizeof(image_header_t) + 0x1FE0;
+ else
+ imagesize = sbuf->st_size - sizeof(image_header_t);
+
+ if (params->os == IH_OS_TEE) {
+ addr = optee_image_get_load_addr(hdr);
+ ep = optee_image_get_entry_point(hdr);