#autosar #e2e #crc #safety #can

e2e-protection

End-to-End protection core with pluggable profiles. AUTOSAR profile family is optional via feature

5 releases (3 breaking)

0.4.0 Sep 10, 2025
0.3.0 Sep 9, 2025
0.2.1 Sep 9, 2025
0.2.0 Sep 9, 2025
0.1.0 Sep 9, 2025

#1617 in Embedded development

Download history

115 downloads per month

MIT/Apache

38KB
639 lines

e2e-protection (v0.4.0)

Profile-first E2E toolkit with a tiny session layer.

  • Core: E2eProfile, E2eSession, CounterPolicy
  • Feature autosar: provides P11, P22, P44, P7, P4m, P7m

See each profile module’s docs for wire details.

use e2e_protection::{E2eSession, CounterPolicy, E2eProfile};
#[cfg(feature="autosar")]
use e2e_protection::profiles::autosar::profile11::{P11, P11DataIdMode};

#[cfg(feature="autosar")]
let mut tx = E2eSession::new(
    P11 { mode: P11DataIdMode::Both { data_id: 0x0042 } },
    CounterPolicy::Rollover { bits: 4, step: 1 },
);
let frame = tx.wrap(&[0x12, 0x34])?;

let mut rx = E2eSession::new(
    P11 { mode: P11DataIdMode::Both { data_id: 0x0042 } },
    CounterPolicy::Rollover { bits: 4, step: 1 },
);
let pl = rx.unwrap(&frame)?;
assert_eq!(pl, &[0x12, 0x34]);
#[cfg(not(feature="autosar"))]

e2e-protection (v0.4.0)

Minimal end-to-end protection toolkit with profile-first API and a small session layer.

  • Feature-gated AUTOSAR-like profiles (features = ["autosar"]):
    • P11 (CAN-like): 4-bit counter (0..0xE, 0xF forbidden), CRC-8/SAE-J1850, Data-ID either 16-bit (implicit) or 12-bit nibble-mode (hi-nibble explicit).
    • P22 (CAN/FlexRay-like): 4-bit counter (0..15), DataIDList[16], CRC-8/H2F, no explicit length.

This crate uses the upstream crc crate for checksum calculation as requested.

Install

[dependencies]
e2e-protection = { version = "0.4.0", features = ["autosar"] }

Dependencies

~83KB