# DDR-0005: Session Material Decryption Reuses swap_endianness

Status: Accepted  
Date: 2025-12-22  
Related ADRs: ADR-0003 (session lifetime/keys)

## Context

The E27 hello response includes encrypted session material (session key and HMAC).
There was a question whether this material required a special byte/word swap rule
distinct from normal encrypted payloads.

## Decision

Session material decryption will reuse the existing generic byte-swap function:

swap_endianness

No special-case swap implementation will be added for session material.

## Rationale

- Avoids duplicate and divergent swap logic
- Reduces risk of subtle inconsistencies
- Keeps encryption.py focused on primitives
- Simplifies testing and validation

## Consequences

- decrypt_session_material() must call swap_endianness
- Any future protocol changes requiring a different swap must be explicit
- encryption.py must not introduce alternate swap helpers
