Craton Shield
vs-autosar
vs-autosar
Part of Craton Shield | Architecture
Craton Shield AUTOSAR Classic/Adaptive platform integration.
Overview
This crate provides adapters for integrating Craton Shield with AUTOSAR platforms. It includes SecOC (Secure Onboard Communication) for MAC-based CAN frame authentication, an IdsM reporter for mapping security alerts to the AUTOSAR IDS Manager interface, MCAL driver adapter traits, and Ara::com service discovery types for SOME/IP instance registration.
Key Types
SecOcManager<C>— manages SecOC PDU verification and MAC generation with freshness trackingSecOcPduConfig— per-PDU configuration (CAN ID, key slot, MAC/freshness lengths, direction)SecOcVerifyResult— verification outcome (Pass,MacMismatch,FreshnessExpired, etc.)SecOcDirection— PDU direction (TxorRx)SecOcCrypto— trait for the cryptographic backend used by SecOCIdsmReporter— mapsSecurityAlertevents to AUTOSAR IdsM security eventsIdsmSecurityEvent— AUTOSAR-compatible security event representationMcalCanAdapter<D>— bridges Craton ShieldCanBustrait to MCAL CAN driversMcalEthAdapter<D>— bridges Craton ShieldEthernetPhytrait to MCAL Ethernet driversServiceRegistry— Ara::com SOME/IP service instance registryDemManager— Diagnostic Event Manager with debounce/healing logicBswModeManager— BSW mode transition management with rule-based gatingComMManager— Communication channel mode management
Usage
use vs_autosar::{SecOcManager, SecOcPduConfig, SecOcDirection, IdsmReporter};
// SecOC: Secure Onboard Communication with MAC verification
let mut secoc = SecOcManager::new(my_crypto, 100_000 /* max freshness age us */);
secoc.register_pdu(SecOcPduConfig {
can_id: 0x100, key_id: 1, mac_len: 4,
freshness_len: 4, direction: SecOcDirection::Rx, active: true,
})?;
let result = secoc.verify_rx(&frame, now_us);
// IdsM: forward security alerts to the AUTOSAR IDS Manager
let mut idsm = IdsmReporter::new();
idsm.report_alert(&alert)?;
while let Some(event) = idsm.dequeue() {
// forward event to AUTOSAR IdsM interface
}
Feature Flags
See core/docs/feature-flags.md for the full workspace feature reference.
License
Apache-2.0. See LICENSE.