👹
Carlos's Tech Blog
  • 🧔ECUs
    • ZYNQ_Documents
      • [ZYNQ] 构建ZYNQ的BSP工程
      • [ZYNQ] 启动流程
      • [ZYNQ] Secure Boot Flow
      • [ZYNQ] Provisioning Guideline
      • [ZYNQ] Decrypting Partition by the Decrypt Agent Using PUF key
      • [ZYNQ] enabling the cryptsetup on ramdisk
      • [ZYNQ] Encrypt external files based on file system using PUF key
      • [ZYNQ] Loading an Encrypted Linux kernel at U-Boot with a KUP Key
      • [ZYNQ] cross-compile the cryptsetup on Xilinx ZYNQ aarch64 platform
      • [ZYNQ] Linux Linaro系统镜像制作SD卡启动
    • S32G_Documents
      • [S32G] Going through the s32g hard/soft platform
      • [S32G] S32g247's Secure Boot using HSE firmware
        • S32g2 HSE key config
        • How S32g verify secure boot image
        • S32g secure boot signature generation
        • How to download and build S32g Secure boot image
        • [S32G] OTA with Secure Boot
    • RT117x_Documents
      • [RT-117x]IMX RT1170 Provisioning Guideline
      • [RT-117x] Going through the MX-RT1170 hard/soft platform
      • [RT-117x] i.MX-RT1170's Secure Boot
        • [RT-117x]Signing image with the HSM (SignServer)
    • LS104x_Documents
      • [LS104x] bsp project
      • [LS104x] boot flow
      • [LS104x] secure boot
      • [LS104x] Application Note, Using the PKCS#11 in TCU platform
      • [LS104x] 使用ostree更新rootfs
      • [LS104x] ostree的移植
      • [LS104x] Starting with Yocto
      • [LS104x] 使用FIT的kernel格式和initramfs
    • IMX6/8_Documents
      • [IMX6] Defining A U-Boot Command
      • NXP IMX6 嵌入式板子一些笔记
      • NXP-imx6 initialization
    • Vehicle_Apps
      • [SecOC] Tree
        • [SecOC] SecOC Freshness and MAC Truncation
  • 😾TECH
    • Rust Arm OS
      • ARMv7m_Using_The_RUST_Cross_Compiler
    • ARM
      • ARM-v7-M
        • 01_ARMv7-M_处理器架构技术综述
        • 02_ARMv7-M_编程模型与模式
        • 03_ARMv7-M_存储系统结构
        • 04_ARMv7-M_异常处理及中断处理
      • ARM-v8-A
        • 02_ARMv8_基本概念
        • 03_ARMv8_指令集介绍_加载指令集和存储指令集
        • 04_ARMv8_指令集_运算指令集
        • 05_ARMv8_指令集_跳转_比较与返回指令
        • 06_ARMv8_指令集_一些重要的指令
        • 0X_ARMv8_指令集_基于汇编的UART驱动
        • 07_ARMv8_汇编器Using as
        • 08_ARMv8_链接器和链接脚本
        • 09_ARMv8_内嵌汇编(内联汇编)Inline assembly
        • 10_ARMv8_异常处理(一) - 入口与返回、栈选择、异常向量表
        • 11_ARMv8_异常处理(二)- Legacy 中断处理
        • 12_ARMv8_异常处理(三)- GICv1/v2中断处理
        • 13_ARMv8_内存管理(一)-内存管理要素
        • 14_ARMv8_内存管理(二)-ARM的MMU设计
        • 15_ARMv8_内存管理(三)-MMU恒等映射及Linux实现
        • 16_ARMv8_高速缓存(一)cache要素
        • 17_ARMv8_高速缓存(二)ARM cache设计
        • 18_ARMv8_高速缓存(三)多核与一致性要素
        • 19_ARMv8_TLB管理(Translation Lookaside buffer)
        • 20_ARMv8_barrier(一)流水线和一致性模型
        • 21_ARMv8_barrier(二)内存屏障案例
      • ARM Boot Flow
        • 01_Embedded_ARMv7/v8 non-secure Boot Flow
        • 02_Embedded_ARMv8 ATF Secure Boot Flow (BL1/BL2/BL31)
        • 03_Embedded_ARMv8 BL33 Uboot Booting Flow
      • ARM Compiler
        • Compiler optimization and the volatile keyword
      • ARM Development
        • 在MACBOOK上搭建ARMv8架构的ARM开发环境
        • Starting with JLink debugger or QEMU
    • Linux
      • Kernel
        • 0x01_LinuxKernel_内核的启动(一)之启动前准备
        • 0x02_LinuxKernel_内核的启动(二)SMP多核处理器启动过程分析
        • 0x21_LinuxKernel_内核活动(一)之系统调用
        • 0x22_LinuxKernel_内核活动(二)中断体系结构(中断上文)
        • 0x23_LinuxKernel_内核活动(三)中断体系结构(中断下文)
        • 0x24_LinuxKernel_进程(一)进程的管理(生命周期、进程表示)
        • 0x25_LinuxKernel_进程(二)进程的调度器的实现
        • 0x26_LinuxKernel_设备驱动(一)综述与文件系统关联
        • 0x27_LinuxKernel_设备驱动(二)字符设备操作
        • 0x28_LinuxKernel_设备驱动(三)块设备操作
        • 0x29_LinuxKernel_设备驱动(四)资源与总线系统
        • 0x30_LinuxKernel_设备驱动(五)模块
        • 0x31_LinuxKernel_内存管理(一)物理页面、伙伴系统和slab分配器
        • 0x32_LinuxKernel_内存管理(二)虚拟内存管理、缺页与调试工具
        • 0x33_LinuxKernel_同步管理_原子操作_内存屏障_锁机制等
        • 01_LinuxDebug_调试理论和基础综述
      • Userspace
        • Linux-用户空间-多线程与同步
        • Linux进程之间的通信-管道(上)
        • Linux进程之间的通信-管道(下)
        • Linux进程之间的通信-信号量(System V)
        • Linux进程之间的通信-内存共享(System V)
        • Linux进程之间的通信-消息队列(System V)
        • Linux应用调试(一)方法、技巧和工具 - 综述
        • Linux应用调试(二)工具之coredump
        • Linux应用调试(三)工具之Valgrind
        • Linux机制之内存池
        • Linux机制之对象管理和引用计数(kobject/ktype/kset)
        • Linux机制copy_{to, from}_user
        • Linux设备树 - DTS语法、节点、设备树解析等
        • Linux System : Managing Linux Services - inittab & init.d
        • Linux System : Managing Linux Services - initramfs
      • Kernel Examples
        • Linux Driver - GPIO键盘驱动开发记录_OMAPL138
        • 基于OMAPL138的Linux字符驱动_GPIO驱动AD9833(一)之miscdevice和ioctl
        • 基于OMAPL138的Linux字符驱动_GPIO驱动AD9833(二)之cdev与read、write
        • 基于OMAPL138的字符驱动_GPIO驱动AD9833(三)之中断申请IRQ
        • Linux内核调用SPI驱动_实现OLED显示功能
        • Linux内核调用I2C驱动_驱动嵌套驱动方法MPU6050
    • OPTEE
      • 01_OPTEE-OS_基础之(一)功能综述、简要介绍
      • 02_OPTEE-OS_基础之(二)TrustZone和ATF功能综述、简要介绍
      • 03_OPTEE-OS_系统集成之(一)编译、实例、在QEMU上执行
      • 05_OPTEE-OS_系统集成之(三)ATF启动过程
      • 06_OPTEE-OS_系统集成之(四)OPTEE镜像启动过程
      • 07_OPTEE-OS_系统集成之(五)REE侧上层软件
      • 08_OPTEE-OS_系统集成之(六)TEE的驱动
      • 09_OPTEE-OS_内核之(一)ARM核安全态和非安全态的切换
      • 10_OPTEE-OS_内核之(二)对安全监控模式的调用的处理
      • 11_OPTEE-OS_内核之(三)中断与异常的处理
      • 12_OPTEE-OS_内核之(四)对TA请求的处理
      • 13_OPTEE-OS_内核之(五)内存和cache管理
      • 14_OPTEE-OS_内核之(六)线程管理与并发
      • 15_OPTEE-OS_内核之(七)系统调用及IPC机制
      • 16_OPTEE-OS_应用之(一)TA镜像的签名和加载
      • 17_OPTEE-OS_应用之(二)密码学算法和安全存储
      • 18_OPTEE-OS_应用之(三)可信应用的开发
      • 19_OPTEE-OS_应用之(四)安全驱动开发
      • 20_OPTEE-OS_应用之(五)终端密钥在线下发系统
    • Binary
      • 01_ELF文件_目标文件格式
      • 02_ELF文件结构_浅析内部文件结构
      • 03_ELF文件_静态链接
      • 04_ELF文件_加载进程虚拟地址空间
      • 05_ELF文件_动态链接
      • 06_Linux的动态共享库
      • 07_ELF文件_堆和栈调用惯例以ARMv8为例
      • 08_ELF文件_运行库(入口、库、多线程)
      • 09_ELF文件_基于ARMv7的Linux系统调用原理
      • 10_ELF文件_ARM的镜像文件(.bin/.hex/.s19)
    • Build
      • 01_Script_makefile_summary
    • Rust
      • 02_SYS_RUST_文件IO
    • Security
      • Crypto
        • 1.0_Security_计算机安全概述及安全需求
        • 2.0_Security_随机数(伪随机数)
        • 3.0_Security_对称密钥算法加解密
        • 3.1_Security_对称密钥算法之AES
        • 3.2_Security_对称密钥算法之MAC(CMAC/HMAC)
        • 3.3_Security_对称密钥算法之AEAD
        • 8.0_Security_pkcs7(CMS)_embedded
        • 9.0_Security_pkcs11(HSM)_embedded
      • Tools
        • Openssl EVP to implement RSA and SM2 en/dec sign/verify
        • 基于Mac Silicon M1 的OpenSSL 编译
        • How to compile mbedtls library on Linux/Mac/Windows
    • Embedded
      • eMMC启动介质
  • 😃Design
    • Secure Boot
      • JY Secure Boot Desgin
    • FOTA
      • [FOTA] Module of ECUs' FOTA unit design
        • [FOTA] Tech key point: OSTree Deployment
        • [FOTA] Tech key point: repositories role for onboard
        • [FOTA] Tech key point: metadata management
        • [FOTA] Tech key point: ECU verifying and Decrpting
        • [FOTA] Tech key point: time server
      • [FOTA] Local-OTA for Embedded Linux System
    • Provisioning
      • [X-Shield] Module of the Embedded Boards initialization
    • Report
由 GitBook 提供支持
在本页
  • 1. Primaies
  • 1.2 Construct and send vehicle version manifest
  • 1.3 Download and check the current time
  • 1.4 Download and verify metadata
  • 1.4 Download and verify images
  • 2. Secondaries
  • 2.1 Receiving the latest time from the primary
  • 2.2 Receiving parsed metadata from the primary
  • 2.3 Receiving parsed images from the primary
  • 2.4 Install the image and Create, send the version report
  • 2.5 Summary
  1. Design
  2. FOTA
  3. [FOTA] Module of ECUs' FOTA unit design

[FOTA] Tech key point: ECU verifying and Decrpting

A Primary downloads, verifies, and distributes the latest time, metadata, and images. To do so, it SHALL perform the following seven steps:

  • Construct and send vehicle version manifest

  • Download and check current time

  • Download and verify metadata

  • Download and verify images

  • Send the latest time to Secondaries

  • Send metadata to Secondaries

  • Send images to Secondaries

An ECU (whatever primaries or secondaries) SHALL perform the following steps when attempting to install a new image:

  • Verify latest attested time.

  • Verify metadata

  • Download latest image

  • Verify image

  • Install image

  • Create and send version report

1. Primaies

  • Construct and send vehicle version manifest

  • Download and check the current time

  • Download and verify metadata

  • Download and verify images

The primary flow is shown in the following figure:

1.2 Construct and send vehicle version manifest

Once the complete manifest is built, the Primary can send the manifest to the Director repository. However, it is not strictly required that the Primary send the manifest until step three. If permitted by the implementation, a Primary could send only a diff of the manifest to save bandwidth. If an implementation permits diffs, the Director SHOULD have a way to request a full manifest.

Vehicle Manifest

Secondaries can send their version reports at any time so that they are already stored on the Primary when it wishes to check for updates. Alternatively, the Primary can request a version report from each Secondary at the time of the update check.

The vehicle version manifest is a metadata structure that SHALL contain the following information:

  • An attribute containing the signature(s) of the payload, each specified by:

    • The public key identifier of the key being used to sign the payload

    • The signing method (i.e., ed25519, rsassa-pss, etc.)

    • A hash of the payload to be signed

    • The hashing function used (i.e., SHA3-256, SHA-512/224, etc.)

    • The signature of the hash

  • A payload representing the installed versions of each software image on the vehicle. This payload SHALL contain:

    • The vehicle’s unique identifier (e.g., the VIN)

    • The Primary ECU’s unique identifier (e.g., the serial number)

A vehicle manifest example is shown in the following code block:

{
  "signed":{
      "vin": "VINTESTCODEDEADBEE",
      "OEM": "AUTOX",
      "model": "XERO",
      "ecu_version_manifests": {
        "DC1": [{
          "ecu_name": "VDU",
          "ecu_serial": "1q2w3e44efe",
          "hardware_id": "0xdeadbeef",
          "firmware_version": "1.0.1",
          "firmware_sha256hash": "d47ec6a4b942939a1a6138c99227d06bc23203055a65492f0ab33781c0f8b746",
          "firmware_length": 1024000,
          "bootloader_version": "1.1.1",
          "bootloader_sha256hash": "c94867b062852139e536d1c427753104ff069d9f1cff42a1029b7ed1f3adc61d",
          "bootloader_length": 1024000,
          "os_version": "Linux kernel xxx",
          "last_report_time": "2023-07-20-14:00",
          "nonce": "t3af4yah4yag4yqat43qg",
          "denpendencies": [
            {
              "name": “xxx”,
              "verson": "0.1.1"
            }
          ]
        }],
        "DC2":[],
        "DC3":[],
        "primary_ecu":{
        }
      }
  },
   "signature": {
      "keyid": "primary_ecu_key",
      "method": "sha256WithRSAEncryption", 
      "sig": "f417...signature..."
   }
}

ECU version manifest

An ECU version report is a metadata structure that SHALL contain the following information:

  • An attribute containing the signature(s) of the payload, each specified by:

    • The public key identifier of the key being used to sign the payload

    • The signing method (i.e., ed25519, rsassa-pss, etc.)

    • A hash of the payload to be signed

    • The hashing function used (i.e., SHA3-256, SHA-512/224, etc.)

    • The signature of the hash

  • A payload containing:

    • The ECU’s unique identifier (e.g., the serial number)

    • The filename, length, and hashes of its currently installed image (i.e., the non-custom Targets metadata for this particular image)

    • An indicator of any detected security attack

    • The latest time the ECU can verify at the time this version report was generated

    • A nonce or counter to prevent a replay of the ECU version report. This value SHALL change each update cycle.

An ECU version manifest example is shown in the following code block:

{
  "signed": {
      "ecu_name": "VDU",
      "ecu_serial": "1q2w3e44efe",
      "hardware_id": "0xdeadbeef",
      "firmware_version": "1.0.1",
      "firmware_sha256hash": "d47ec6a4b942939a1a6138c99227d06bc23203055a65492f0ab33781c0f8b746",
      "firmware_length": 1024000,
      "bootloader_version": "1.1.1",
      "bootloader_sha256hash": "c94867b062852139e536d1c427753104ff069d9f1cff42a1029b7ed1f3adc61d",
      "bootloader_length": 1024000,
      "os_version": "Linux kernel xxx",
      "last_report_time": "2023-07-20-14:00",
      "nonce": "t3af4yah4yag4yqat43qg",
      "denpendencies": [
        {
          "name": “xxx”,
          "verson": "0.1.1"
        }
      ]
  },
  "signature": {
      "keyid": "ecu_key",
      "method": "sha256WithRSAEncryption", 
      "sig": "f417...signature..."
  }
}

1.3 Download and check the current time

The flow of the secure source(time server) in the ECU interactions is shown in the following sequence diagram:

1.4 Download and verify metadata

The Primary SHALL download metadata for all targets and perform a full verification that the ECU checks that the Targets metadata about images from the Director repository matches the Targets metadata about the same images from the Image repository.

In order to perform full verification, an ECU SHALL perform the following steps:

About Time Server:

  1. Load and verify the current time or the most recent securely attested time;

About Director Repository

  1. Download and check the Root metadata file from the Director repository;

  2. Download and check the Timestamp metadata file from the Director repository;

  3. Check the previously downloaded Snapshot metadata file from the Directory repository:

    1. If the hashes and version number of that file match the hashes and version number listed in the new Timestamp metadata, there are no new updates and the verification process SHALL be stopped and considered complete.

    2. Otherwise, download and check the Snapshot metadata file from the Director repository;

  4. Download and check the Targets metadata file from the Director repository;

    1. If the Targets metadata from the Directory repository indicates that there are no new targets that are not already currently installed, the verification process SHALL be stopped and considered complete.

    2. Otherwise, to step 6.

  5. Download and check the Root metadata file from the Image repository;

  6. Download and check the Timestamp metadata file from the Image repository;

  7. Check the previously downloaded Snapshot metadata file from the Image repository:

    1. f the hashes and version number of that file match the hashes and version number listed in the new Timestamp metadata, the ECU SHALL skip to the last step

    2. Otherwise, download and check the Snapshot metadata file from the Image repository;

  8. Download and check the top-level Targets metadata file from the Image repository;

About Primary ECU

  1. Verify that Targets metadata from the Director and Image repositories match:

    1. A Primary ECU SHALL perform this check on metadata for all images listed in the Targets metadata file from the Director repository downloaded in step 6;

  2. A Secondary ECU can elect to perform this check only on the metadata for the image it will install.

About How to check the metadata matching

Note, To check that the metadata for an image matches, complete the following procedure:

  • Check that the non-custom metadata (i.e., length and hashes) of the unencrypted or encrypted image are the same in both sets of metadata.

  • Note: the Primary is responsible for validating encrypted images and associated metadata. The target ECU (Primary or Secondary) is responsible for validating the unencrypted image and associated metadata.

  • Check that all SHALL match custom metadata (e.g., hardware identifier and release counter) are the same in both sets of metadata.

  • Check that the release counter, if one is used, in the previous Targets metadata file is less than or equal to the release counter in this Targets metadata file.

If any step fails, the ECU SHALL return an error code indicating the failure. If a check for a specific type of security attack fails (i.e., rollback, freeze, arbitrary software, etc.), the ECU SHOULD return an error code that indicates the type of attack.

1.4 Download and verify images

The Primary SHALL download and verify images for itself and for all of its associated Secondaries. Images SHALL be verified by checking that the hash of the image file matches the hash specified in the Director’s Targets metadata for that image.

2. Secondaries

The primary with the secondaries is shown in the following figure. We suppose that the UDS protocol is used in the communication between the primary and secondaries:

The flow of the secondaries is shown in the following figure:

2.1 Receiving the latest time from the primary

The Primary SHOULD send the time to each ECU. If the ECU has limited secondary storage, i.e., insufficient buffer storage to temporarily store the latest image before installing it, it SHALL download the latest image from the Primary.

2.2 Receiving parsed metadata from the primary

The Primary SHALL send its latest downloaded metadata to all of its associated Secondaries. The metadata it sends to each Secondary SHALL include all of the metadata required for verification on that Secondary.

  • For full verification Secondaries, this includes the metadata for all four roles from both repositories, plus any delegated Targets metadata files the Secondary will recurse through to find the proper delegation.

  • For partial verification Secondaries, this could include fewer metadata files; at a minimum, it includes only the Targets metadata file from the Director repository.

Each Secondary SHALL store the latest copy of all metadata required for its own verification.

The filename used to identify the latest known image (i.e., the file to request from the Primary) SHALL be determined as follows:

  • Load the Targets metadata file from the Director repository.

  • Find the Targets metadata associated with this ECU identifier.

2.3 Receiving parsed images from the primary

The Primary SHALL send the latest image to each of its associated Secondaries that have sufficient storage to receive it. For Secondaries without sufficient storage to store a copy of the image, the Primary SHOULD wait for a request from the Secondary to stream the new image file to it. The Secondary will send the request once it has verified the metadata sent in the previous step.

The ECU SHALL verify that the latest image matches the latest metadata as follows:

  1. Load the latest Targets metadata file from the Director.

  2. Find the Targets metadata associated with this ECU identifier.

  3. Check that the hardware identifier in the metadata matches the ECU’s hardware identifier.

  4. Check that the image filename is valid for this ECU. This could be a comparison against a wildcard path, which restricts the ECUs to which a delegation will apply.

  5. Check that the release counter of the image in the previous metadata, if it exists, is less than or equal to the release counter in the latest metadata.

  6. If the image is encrypted, decrypt the image with a decryption key to be chosen as follows:

    • If the ECU key is a symmetric key, the ECU SHALL use the ECU key for image decryption.

    • If the ECU key is asymmetric, the ECU SHALL check the Targets metadata for an encrypted symmetric key. If such a key is found, the ECU SHALL decrypt the symmetric key using its ECU key, and use the decrypted symmetric key for image decryption.

    • If the ECU key is asymmetric and there is no symmetric key in the Targets metadata, the ECU SHALL use its ECU key for image decryption.

  7. Check that all hashes listed in the metadata match the corresponding hashes of the image.

If the ECU has enough secondary storage capacity to store the image, the checks SHOULD be performed on the image in secondary storage before it is installed.

2.4 Install the image and Create, send the version report

The ECU SHALL attempt to install the update. This installation SHOULD occur at a time when all pre-conditions are met. These pre-conditions could include ensuring the vehicle is in a safe environment for an installation (e.g., the vehicle is parked when updating a specific ECU). Other pre-conditions could include ensuring the ECU has a backup of its current image and metadata in case the current installation fails.

2.5 Summary

The secondary flow can be summarized by the following figure:

上一页[FOTA] Tech key point: metadata management下一页[FOTA] Tech key point: time server

最后更新于1年前

The Primary SHALL build a vehicle version manifest as described in

A list of ECU version reports as specified in

The Primary SHALL load the current time from a secure source. About the secure source, please refer to

About the image file name setting, please refer to

Construct the Image filename using the rule in , or use the download URL specified in the Director metadata.

If there is no Targets metadata about this image, abort the update cycle and report that there is no such image. Additionally, in the case of failure, the ECU SHALL retain its previous Targets metadata instead of using the new Targets metadata. Otherwise, download the image (up to the number of bytes specified in the Targets metadata) and verify it according to .

The ECU SHALL create a version report as described in , and send it to the Primary (or simply save it to disk, if the ECU is a Primary). The Primary SHOULD write the version reports it receives to disk and associate them with the Secondaries that sent them.

😃
https://app.gitbook.com/o/eTBeA3vhkOtihTJASkhd/s/tqiX1ZbXhRorHX3bwk1r/~/changes/43/design/fota/fota-module-of-ecus-fota-unit-design/fota-tech-key-point-metadata-management
Section 5.4.2.1.2
https://carloss-organization-4.gitbook.io/tech/design/fota/fota-module-of-ecus-fota-unit-design/fota-tech-key-point-time-server
https://uptane.github.io/papers/uptane-standard.2.0.0.html#metadata_filename_rules
Section 5.2.7
Section 5.4.3.4
Section 5.4.2.1.2