AUTOSAR_SWS_SecureOnboardCommunication 中文翻译

文档编号:654 | 状态:Final | 发布于:AUTOSAR CP Release 4.4.0
所属标准:AUTOSAR Classic Platform | 文档责任方:AUTOSAR

本翻译覆盖原文档 1-110 页正文。原文为软件规范(SWS),定义 SecOC(Secure Onboard Communication)模块的 API、配置、错误处理——车内安全通信。R4.4 增强:动态长度 PDU 支持 + 错误认证信息传输。


1 引言与范围

SecOC(Secure Onboard Communication)提供车内通信的端到端认证与完整性保护。位于 PduR 与具体通信接口模块之间。应对 CAN/CAN FD/FlexRay/Ethernet 等总线上的 PDU 进行认证,检测伪造报文、重放攻击、损坏数据等攻击。R4.4 增强动态长度 PDU 支持 + 错误认证信息传输。

2 缩略语

SecOC / MAC / CMAC / Freshness / FV / Data ID / PDU / PduR / CSM / CRY / KeyM / DEM / Wrong Authentication Info / Dynamic Length

3 相关文档

[1] AUTOSAR SWS PduR
[2] AUTOSAR SWS Csm
[3] AUTOSAR SRS Secure Onboard Communication

4 约束与假设

SecOC 应:

5 依赖其他模块

SecOC 依赖:PduR(PDU 路由)/ CSM(加密服务)/ KeyM(密钥管理)/ StbM(时间戳,可选)/ Dem(错误上报)。

6 功能规格

6.1 架构

SecOC 位于 PduR 与具体通信接口模块之间。发送方向:在 PDU 末尾追加 MAC、FV;接收方向:验证 MAC、检查 FV,丢弃失败 PDU。

6.2 Freshness Value

FV 构造:

6.3 错误认证信息(R4.4 新增)

当接收方验证失败时,可发送错误认证信息(Wrong Authentication Info)到发送方,通知发送方其密钥可能已泄漏。

7 API 服务

7.1 初始化 / 关闭

void SecOC_Init(const SecOC_ConfigType* ConfigPtr):初始化。
void SecOC_DeInit(void):去初始化。

7.2 传输

Std_ReturnType SecOC_Transmit(PduIdType TxPduId, const PduInfoType* PduInfoPtr):请求传输(认证 + 发送)。

7.3 接收

void SecOC_RxIndication(PduIdType RxPduId, const PduInfoType* PduInfoPtr):接收指示。
BufReq_ReturnType SecOC_StartOfReception(PduIdType RxPduId, PduLengthType SduLength, PduLengthType* BufferSizePtr):TP 接收开始。
BufReq_ReturnType SecOC_CopyRxData(PduIdType RxPduId, const PduInfoType* PduInfoPtr, PduLengthType* BufferSizePtr):TP 接收数据复制。
void SecOC_TpRxIndication(PduIdType RxPduId, Std_ReturnType Result):TP 接收指示。

7.4 TP 发送

BufReq_ReturnType SecOC_CopyTxData(PduIdType TxPduId, PduInfoType* PduInfoPtr, RetryInfoType* RetryInfoPtr, PduLengthType* AvailableDataLengthPtr):TP 发送数据复制。
void SecOC_TxConfirmation(PduIdType TxPduId, Std_ReturnType Result):发送确认。
void SecOC_TpTxConfirmation(PduIdType TxPduId, Std_ReturnType Result):TP 发送确认。

7.5 回调 / 通知

Std_ReturnType SecOC_GetRxFreshness(NetworkHandleType NetworkHandle, uint64* FreshnessValuePtr, uint32* FreshnessValueLengthPtr, uint8* BufferPtr, uint32 BufferLength):获取接收 Freshness。
Std_ReturnType SecOC_GetTxFreshness(NetworkHandleType NetworkHandle, uint64* FreshnessValuePtr, uint32* FreshnessValueLengthPtr, uint8* BufferPtr, uint32 BufferLength):获取发送 Freshness。
void SecOC_RxIndicationFromPduR(PduIdType RxPduId, const PduInfoType* PduInfoPtr, boolean AuthenticationPassed):来自 PduR 的接收指示(含认证结果)。

7.6 MainFunction

void SecOC_MainFunctionRx(void):接收处理。
void SecOC_MainFunctionTx(void):发送处理。

8 配置

SecOC 配置类:

9 错误处理

9.1 开发错误

SECOC_E_UNINIT:模块未初始化。
SECOC_E_PARAM_POINTER:参数指针为空。
SECOC_E_PARAM:参数无效。

9.2 运行时错误

SECOC_E_BUSY:模块忙。

9.3 扩展生产错误(上报 DEM)

SECOC_E_VERIFICATION_FAILED:认证失败(FV 或 MAC 错误)。
SECOC_E_FRESHNESS_FAILED:Freshness 验证失败。


校对记录

校对轮次:L1 自动校对(2026-06-13)