👹
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. Functional
  • 1.1 Specification of the security solution
  • 1.4 Rules of Freshness and MAC Truncation
  • 2. Key Management
  • 2.1 Key Generation
  • 2.2 Key Distribution
  • 2.3 Key Storage and Access
  • WIP
  • FAQ
  1. ECUs
  2. Vehicle_Apps
  3. [SecOC] Tree

[SecOC] SecOC Freshness and MAC Truncation

SecOC Freshness and MAC Truncation

上一页[SecOC] Tree下一页Rust Arm OS

最后更新于1年前

1. Functional

Authentication and integrity protection of sensitive data is necessary to protect the correct and safe functionality of vehicle systems. The SecOC module aims for resource-efficient and practicable authentication mechanisms of sensitive data on the level of PDUs (Protocol Data Units).

AUTOSAR SecOC defines secure communication on OSI layers above DataLink:

1.1 Specification of the security solution

To provide message freshness, the SecOC module on the sending and receiving side get freshness from an external Freshness Manager for each uniquely identifiable Secured I-PDU.

1.1.1 On the sender side

the SecOC module creates a Secured I-PDU by adding authentication information to the outgoing Authentic I-PDU. The authentication information comprises an Authenticator (e.g. Message Authentication Code) and optionally a Freshness Value.

  • Regardless if the Freshness Value is or is not included in the Secure I-PDU payload, the Freshness Value is considered during generation of the Authenticator.

  • When using a Freshness Counter instead of a Timestamp, the Freshness Counter should be incremented by the Freshness Manager prior to providing the authentication information to the receiver side.

1.1.2 On the receiver side

The SecOC module checks the freshness and authenticity of the Authentic I-PDU by verifying the authentication information that has been appended by the sending side SecOC module.

To verify the authenticity and freshness of an Authentic I-PDU, the Secured I-PDU provided to the receiving side SecOC should be the same Secured I-PDU provided by the sending side SecOC and the receiving side SecOC should have knowledge of the Freshness Value used by the sending side SecOC during the creation of the Authenticator.

1.1.3 Basic entities of the security solution

1.1.3.1 Authentic I-PDU and Secured I-PDU

The term Authentic I-PDU refers to an AUTOSAR I-PDU that requires protection against unauthorized manipulation and replay attacks.

The payload of a Secured I-PDU consists of the Authentic I-PDU and an Authenticator (e.g. Message Authentication Code). In other words, Secured I-PDU = Authentic I-PDU + CMAC value.

Truncating Authenticator

Depending on the authentication algorithm (parameter SecOCTxAuthServiceConfigRef or SecOCRxAuthServiceConfigRef ) it may be possible to truncate the resulting Authenticator (e.g. in case of a MAC) generated by the authentication algorithm. Truncation may be desired when the message payload is limited in length and does not have sufficient space to include the full Authenticator.

A truncated Secured I-PDU is shown in the following example of the truncation of the Authenticator and the Freshness Values respecting the parameter SecOCFreshnessValueTxLength and SecOCAuthInfoTxLength.

If truncation is possible, the Authenticator should only be truncated down to the most significant bits of the resulting Authenticator generated by the authentication algorithm.

Note: For the resource constraint embedded use case with static participants, The SecOC specification proposes using Message Authentication Codes (MACs) as a basis for authentication (e.g. a CMAC [16] based on AES with an adequate key length).

Note: In case a MAC is used, it is possible to transmit and compare only parts of the MAC. This is known as MAC truncation. However, this results in a lower security level at least for forgery of single MACs. While we propose to always use a key length of at least 128 bit, a MAC truncation can be beneficial. Of course, the actual length of the MAC for each use case has to be chosen carefully. For some guidance, we refer to SecOC specification appendix A of [16]. In general, MAC sizes of 64 bit and above are considered to provide sufficient protection against guessing attacks by NIST. Depending on the use case, different MAC sizes can be appropriate, but this requires carefully further judge.

1.1.3.2 Data Covered by Authenticator

The data that the Authenticator is calculated on consists of the Data Identifier of the:

  • Secured I-PDU (parameter SecOCDataId)

  • Authentic I-PDU data

  • the Complete Freshness Value.

1.1.3.4 Freshness Values

Each Secured I-PDU is configured with at least one Freshness Value. The Freshness Value refers to a monotonic counter that is used to ensure the freshness of the Secured I-PDU.

The monotonic counter could be realized by:

  • or Freshness Counter

  • or Freshness Timestamp

Freshness Values are to be derived from a Freshness Manager.

  1. SecOCFreshnessValueTxLength is configured to a smaller length than the actual freshness value, SecOC shall include only the least significant bits of the freshness value up to SecOCFreshnessValueTxLength within the secured I-PDU.

  2. If the parameter SecOCFreshnessValueTxLength is configured to 0, the freshness value shall not be included in the secured I-PDU.

  3. If SecOCUseAuthDataFreshness is set to TRUE, SecOC shall use a part of the Authentic I-PDU as freshness. In this case, SecOCAuthDataFreshnessStartPosition determines the start position in bits of the freshness inside the Authentic I-PDU and SecOCAuthDataFreshnessLen determines its length in bits.

In our use case, please set the SecOCUseAuthDataFreshness is FALSE.

The AES-CMAC Algorithm:

1.3.4 Authentication of I-PDUs

The creation of a Secured I-PDU and thus the authentication of an Authentic I-PDU consists of the following six steps:

  • Prepare Secured I-PDU

  • Construct Data for Authenticator

  • Generate Authenticator

  • Construct Secured I-PDU

  • Increment Freshness Counter

  • Broadcast Secured I-PDU

The SecOC module shall generate the Authenticator by passing DataToAuthenticator, the length of DataToAuthenticator into the Authentication Algorithm corresponding to SecOCTxAuthServiceConfigRef.

The SecOC module shall truncate the resulting Authenticator down to the number of bits specified by SecOCAuthInfoTxLength.

1.3.5 Verification of I-PDUs

The verification of a Secured I-PDU consists of the following six steps:

  • Parse Authentic I-PDU, Freshness Value and Authenticator

  • Get Freshness Value from Freshness Manager

  • Construct Data to Authentication

  • Verify Authentication Information

  • Send Confirmation to Freshness Manager

  • Pass Authentic I-PDU to upper layer

If SecOCTxSecuredPduCollection is used then SecOC shall not perform any verification until it has received both the Authentic I-PDU and Cryptographic I-PDU which make up the Secured I-PDU. Only after both have been received SecOC shall attempt to verify the resulting Secure I-PDU.

Although this document consequently uses the terms and concepts from symmetric cryptography. the SecOC module can be configured to use both, symmetric as well as asymmetric cryptographic algorithms.

The sender and receiver flow is shown in the following figure:

1.4 Rules of Freshness and MAC Truncation

The rule of MAC and freshness truncation refers to a technique used in security protocols to balance security and performance by limiting the amount of data that needs to be authenticated or encrypted.

The basic idea is to use a shorter MAC (message authentication code) and/or a truncated freshness value when transmitting a message, rather than authenticating and encrypting the entire message. By doing this, the amount of data that needs to be processed and transmitted is reduced, which can improve performance. Refer to spec 7.1.1.1 Authentic I-PDU and Secured I-PDU. However, this also reduces the level of security, as an attacker may have more opportunities to guess or manipulate the truncated or shortened data.

The exact rule of MAC and freshness truncation will vary depending on the specific security protocol being used and the security requirements of the system. In general, the rule will aim to find a balance between security and performance by limiting the amount of data that needs to be authenticated or encrypted, while still providing sufficient protection against attacks.

In AUTOX’s system, adopting a redundant system design approach, if a full-length MAC is used, it will exert certain pressure and impact on the overall system load. As a result, a MAC and freshness truncation approach are employed while maintaining security.

The following are rules to consider for MAC and freshness truncating.

The calibration process is shown in the following diagram:

The verification process determines whether the purported MAC on a message is the valid output of the MAC generation process applied to the message. The output of the MAC verification determines the assurance that the receiver of the message obtains:

  • If the output is INVALID, then the message is definitely not authentic, i.e., it did not originate from a source that executed the generation process on the message to produce the purported MAC.

  • If the output is VALID, then the design of the mode provides assurance that the message is authentic and, hence, was not corrupted in transit; however, this assurance, as for any MAC algorithm, is not absolute.

In the second case, an attacker, i.e., a party without access to the key or to the MAC generation process, may have simply guessed the correct MAC for the message. In particular, if the attacker selects a MAC at random from the set of strings of length Tlen bits, then the probability is 1 in 2Tlen that the MAC will be valid. Consequently, larger values of Tlen provide greater protection against such an event. Of course, an attacker may attempt to systematically guess many different MACs for a message, or for different messages, thereby increasing the probability that one (or more) of them will be accepted as valid. For this reason, a system should limit the number of unsuccessful verification attempts for each key.

1.4.1 Message Span of the Key

The message span of a key is the total number of messages for which MACs are generated across all implementations of CMAC with that key. The message span of the key affects the security of the system against attacks that are based on the detection of a pair of distinct messages with the same MAC before its truncation[1]. Such a pair is called a collision[2] in this appendix. As with other block cipher-based MAC algorithms, an attacker may be able to exploit a collision to produce the valid MAC for a new message, the content of which may be large of the attacker's choosing. Such an event would be a fundamental breach of the expected authentication assurance.

In principle, collisions must exist because there are many more possible messages than MACs; in practice, however, collisions may not occur among the messages for which MACs are actually generated during the lifetime of the key. The probability that at least one collision will occur depends mostly on the message span of the key relative to the block size, b, of the underlying block cipher. For example, a collision is expected to exist among a set of 2b/2 arbitrary messages; in other words, 264 messages for the AES algorithm, and 232 messages for TDEA. This property was one of the motivations to develop the AES with a block size of 128 bits.

Perspective A:

For any system in which CMAC is implemented, the risk that an attacker can detect and exploit a collision shall be limited to a level that is appropriate to the value of the data. A simple and prudent method to achieve this goal is to establish and enforce an appropriate limit on the message span of any CMAC key, which in turn limits the probability that a collision will even occur. For general-purpose applications, the default recommendation is to limit the key to no more than 248 messages when the block size of the underlying block cipher is 128 bits, as with the AES algorithm, and 221 messages when the block size is 64 bits, as with TDEA. Within these limits, the probability that a collision will occur is expected to be less than one in a billion for the AES algorithm, and less than one in a million for TDEA.

Perspective B:

For applications where higher confidence in security is required, the message span of a key may be measured in terms of the total number of message blocks. The recommendation, in this case, is to limit the key to no more than 248 message blocks (222 Gbytes) when the block size is 128 bits, and 221 message blocks (16 Mbytes) when the block size is 64 bits. Within these limits, the probability that a collision will occur is proved to be less than one in a billion for the AES algorithm, and less than one in a million for TDEA, assuming that the underlying block cipher has no weakness, as modeled in Ref. [3]. In some cases, a limit on the message span of a key may be established and enforced within a key management infrastructure by an appropriate constraint on the time span during which the key remains in effect, i.e., its crypto period.

Ref:

  • [1] FIPS Publication 197, The Advanced Encryption Standard (AES), U.S. DoC/NIST, November 26, 2001.

  • [2] FIPS Publication 198, The Keyed-Hash Message Authentication Code, U.S. DoC/NIST, March 6, 2002.

  • [3] T. Iwata, K. Kurosawa, OMAC: One-Key CBC MAC, in Fast Software Encryption, 10th International Workshop, FSE 2003, Lecture Notes in Computer Science, Vol. 2887, Thomas Johansson, ed., Springer-Verlag (2003), p.p. 129–153.

1.4.2 Selection of the MAC Length

The NIST guidance can be quantified in terms of the following two bounds:

  • The highest acceptable probability for an inauthentic message to pass the verification process

  • A limit on the number of times that the output is the error message INVALID before the key is retired, across all implementations of the verification process for the key.

Given estimates of these quantities, denoted Risk and MaxInvalids, respectively, Tlen should satisfy the following inequality:

In our use case, the MAC verification process(es) within a system will not output INVALID for more than 1024 messages before the key is retired(i.e., MaxInvalids = 2^10), and the users can tolerate about a one in a million chance that the system will accept an inauthentic message (i.e., Risk = 2^-20).

As the result, the Tlen = lg(25÷ 2-20) = 30

1.4.3 Freshness Truncation

The successful verification of a MAC for a message gives assurance that the source of the message executed the MAC generation algorithm to create the MAC; however, the party that presented the message and MAC for verification may not be the original source of the message. Therefore, the CMAC algorithm does not inherently prevent an attacker from intercepting a legitimate message and its MAC and “replaying” them for verification at a later time, for example, in an attempt to impersonate a party that has access to the key. In some protocols, an attacker may even be able to present to a verifier a message-MAC pair that the verifier itself generated earlier in the protocol.

The controlling protocol or application may protect against such an event by incorporating certain identifying information into the initial bits of every message. Examples of such information include a sequential message number, a timestamp, or a nonce. Upon successful verification of the message, this information may provide a means for the detection of replayed messages, out-of-sequence messages, or missing messages.

For the monotonic counter, please use the eight least significant bits of the freshness value as a truncated freshness value.

1.4.4 Security Profiles

SecOC Profile 1 (or 24Bit-CMAC-8Bit-FV) Recommended

[PRS_SecOc_00610] Using the CMAC algorithm based on AES-128 according to NIST SP 800-38B to calculate the MAC, use the eight least significant bit of the freshness value as truncated freshness value and use the 24 most significant bits of the MAC as truncated MAC.

SecOC Profile 3 (or JASPAR) Recommended

User defining

WIP

2. Key Management

There are a large number of keys that need to be managed here. In the following example,

  • 1 Gateway

  • 3 Domains

  • 11 ECUs

  • Multiple local domain applications

  • 3 cross-domain / E2E applications

  • Secured by keys: ECU 2 needs many keys

2.1 Key Generation

  • Random keys generated with approved Random Bit Generators (RBG)

  • Using approved cryptographic modules (ECU hardware)

  • Country-specific compliance standards

  • FIPS 1402 compliancy National Institute of Standards and Technology (NIST) standards.

  • AUTOSAR CryIF module must be implemented to international standards

2.2 Key Distribution

  • Primary ECU as Key Management Server (KMS)

  • responsible for generation and distribution of Secret Keys

  • Distribution via PDUs, network agnostic.

  • Distribution in the production phase (secure premises).

  • Default key installed in ECUs on initialization

  • After first distribution, key updates require previous key...

  • Key data encrypted with older key

  • Keys installed and activated on reception from KMS

2.3 Key Storage and Access

  • Keys are stored in and accessed from Secure On-Chip Hardware

  • Different Implementation for different hardware:

    • Arm TrustZone

    • or on-chip HSM

  • No access to secured flash (where keys are stored) via debug port

  • Accessed via AUTOSAR SecOC Module -> CSM Module -> CryIF Module (software layer)

  • CryIF Module -> MCAL (hardware layer)

  • No use of Software Crypto, unsecured

WIP

FAQ

Question 1: Can be the Big Endian changed to Little Endian?

Question 2: Comparing the auth bandwidth overhead (Classical CAN)

Question 3: 在使用SecOC的时候,如果是广播的CAN信息,对于不想接收广播信息的ECU如何处理这个CAN信息?

具体来说,SecOC协议使用了消息认证码(MAC)算法对CAN数据进行认证,以确保数据的完整性、认证性和抗重放攻击性,而没有进行加密。在发送方ECU发送CAN数据时,需要在CAN帧中添加Secured I-PDU字段,该字段包含了MAC值和相关的安全参数,用于在接收方ECU进行认证。在接收方ECU收到CAN数据时,会先验证Secured I-PDU字段中的MAC值,如果验证通过,则表示CAN数据是可信的,否则则会拒绝该CAN数据。

需要注意的是,SecOC协议并没有对CAN数据进行加密,而是仅对CAN数据进行了认证。因此,在使用SecOC协议时,CAN数据仍然是以明文的形式在CAN总线上传输的。因此,SecOC并不会影响CAN总线的广播特性。广播消息仍然会被发送到所有连接到总线上的ECU。同时,在使用SecOC时,需要确保所有连接到总线上的ECU都支持SecOC协议,否则可能会导致通信错误或安全漏洞。

Question 4: 在使用SecOC的时候,ECU收到消息,是先解析Authentic I-PDU 还是先验证Authentic I-PDU

在使用SecOC时,ECU收到消息时,首先需要对接收到的Authentic I-PDU进行验证,验证通过后再进行解析。这是因为Authentic I-PDU是要被认证的消息,需要先进行认证才能得到确保原始的CAN数据来源于可信的发送方,然后再对CAN数据进行解析和处理。

具体来说,在验证Authentic I-PDU时,ECU需要进行以下步骤:

  1. 验证消息的MAC:ECU需要计算接收到消息的MAC值,并与消息中的MAC值进行比较,以确保消息没有被篡改。

  2. 验证消息的时间戳或Counter:ECU需要检查消息中的时间戳/Counter,以确保消息没有被重放。

  3. 检查数据长度:ECU需要检查CAN数据的长度是否符合规范,以防止缓冲区溢出和其他安全漏洞。

  4. 解析CAN数据:最后,ECU需要对CAN数据进行解析和处理,以完成相应的操作。

需要注意的是,在使用SecOC时,需要确保所有ECU都按照规范进行。

Question 5: 在使用SecOC的时候,如果是广播的CAN信息,对于不关心这个广播的ECU如何处理这个CAN信息?

在使用SecOC时,广播的CAN信息可以通过两种方式进行处理:

  1. 直接忽略:ECU可以通过配置来忽略接收到的广播消息。

  2. 使用群组密钥:ECU可以在SecOC配置中指定群组密钥,用于加广播消息的MAC。在这种情况下,只有知道群组密钥的其他ECU才能认证广播消息。

需要注意的是,SecOC并不会影响CAN总线的广播特性。广播消息仍然会被发送到所有连接到总线上的ECU,因此在使用SecOC时,需要考虑到广播消息可能会暴露给不需要的接收方,因此要对广播的消息进行分组管控。

The SecOC module as described in this document provides the functionality necessary to verify the authenticity and freshness of PDU-based communication between ECUs within the vehicle architecture. The approach requires both the sending ECU and the receiving ECU to implement a SecOC module. Both SecOC modules are integrated providing the upper and lower layer on the sender and receiver side.

or

We refer to the:

The length, Tlen, of the MAC is an important security parameter. The role of this parameter in resisting guessing attacks is outlined in the spec of the SecOC recommends referring to the.

Larger values of Tlen bits provide greater assurance against . The performance tradeoff is that larger values of Tlen require more bandwidth/storage for the MAC.

The freshness value can be truncated to include the length of one session. The rule is following Refer to 5.4 Security Profiles.

For the short freshness, please enable the in the system.

The specification of the module Secure Onboard Communication allows different configurations for which cryptographic algorithms and modes to use for the MAC calculation and how the truncation of the MAC and freshness value (if applicable) shall be done. The security profiles provide a consistent set of values for a subset of configuration parameters that are relevant to the configuration of Secure Onboard Communication. Refer to 5.4 Security Profiles.

[PRS_SecOc_00630] This profile depicts one configuration and usage of the base FV with the Master-Slave Synchronization method. It uses the CMAC algorithm based on AES-128 according to NIST SP 800-38B Appendix-A to calculate the MAC. Use the 4 least significant bits of the freshness value as truncated freshness value and use the 28 most significant bits of the MAC as truncated MAC. Freshness Value provided to SecOC shall be constructed as described in the [UC_SecOC_00202]. The profile shall be used for CAN.

Further reduction in MAC length requires renegotiation of the key according to the .

🧔
PduR
APIs
JasPar counter
https://www.rfc-editor.org/rfc/rfc4493
https://arm-software.github.io/CMSIS-mbedTLS/latest/cmac_8h.html
Specification of Secure Onboard Communication Protocol
NIST Special Publication 800-38B - Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication
guessing attacks
https://www.autosar.org/fileadmin/standards/R21-11/FO/AUTOSAR_PRS_SecOcProtocol.pdf
JasPar counter
https://www.autosar.org/fileadmin/standards/R21-11/FO/AUTOSAR_PRS_SecOcProtocol.pdf
JasPar counter
NIST Special Publication 800-38B - Recommendation for Block Cipher Modes of Operation: The CMAC Mode for Authentication