Skip to content

Hardened: encrypt stored records with AES-256-GCM - #25

Merged
DavidCozens merged 1 commit into
mainfrom
hardened-store-aesgcm
Jul 28, 2026
Merged

Hardened: encrypt stored records with AES-256-GCM#25
DavidCozens merged 1 commit into
mainfrom
hardened-store-aesgcm

Conversation

@DavidCozens

@DavidCozens DavidCozens commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What this tag adds

SolidSyslogMbedTlsAesGcmPolicy replaces the HMAC policy on the store. Records at rest
gain confidentiality on top of tamper-evidence — the body is encrypted, the record
header is authenticated as associated data, and nonce and tag go in the trailer.
Completes hardened, and completes the sequence.

  wire ... [logPipeline@32473 transport="mtls" atRest="aes-256-gcm"] device started

  Flash        14,652 B     (+148)
  Static RAM    5,060 B       (+8)
  Heap         17,784 B       (+8)
  Log stack       712 B         (0)
  Service stack 3,800 B         (0)

148 bytes, because AES-GCM is already linked: a device that negotiates a GCM
ciphersuite for TLS carries the same primitive the store now uses. No stack movement —
the policy encrypts in place, into the buffer the store already owns.

Two things worth noting

The store key is unchanged. Its name says what it protects, not which algorithm
protects it, so escalating the policy needs no second key provisioned. That is the
payoff of the named-key design from the HMAC step.

GCM needs a fresh nonce per record, and mbedTLS has no context-free RNG, so the
policy takes the device's DRBG alongside the key. That is the only wiring difference
from the HMAC policy.

Also in this commit

atRest in the pipeline element was hard-coded, the same defect caught on transport
in PR #24 but not yet exercised. Both values now derive from what was actually
configured, and both default to the weakest honest answer — "tls" and "none" — so a
missed Init understates protection rather than overstating it.

Checklist

  • Application-only.
  • measurements/<State>.csv committed, and a row added to measurements/tags.tsv.
    Tag boundaries deferred to the release pass.
  • README cost table regenerated — nothing to regenerate until a state's CSV is frozen.
  • ./run.sh green; the record round-tripped through an encrypted store and
    arrived intact, so Seal and Open are both proven end to end.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Syslog pipelines now support AES-256-GCM protection when a device random-number source is available.
    • Syslog metadata reports the active transport and at-rest protection settings.
  • Bug Fixes

    • Improved security configuration and nonce generation for protected syslog records.
  • Tests

    • Updated resource usage measurements and syslog output expectations to reflect the new security settings.

SolidSyslogMbedTlsAesGcmPolicy replaces the HMAC policy on the store. Records at
rest gain confidentiality on top of tamper-evidence: the body is encrypted, the
record header is authenticated as associated data, and nonce and tag go in the
trailer.

  Flash        14,652 B     (+148)
  Static RAM    5,060 B       (+8)
  Heap         17,784 B       (+8)
  Log stack       712 B         (0)
  Service stack 3,800 B         (0)

A hundred and fifty bytes, because AES-GCM is already linked — a device that
negotiates a GCM ciphersuite for TLS is carrying the same primitive the store now
uses. No stack movement: the policy encrypts in place, into the buffer the store
already owns.

The store key is unchanged. Its name says what it protects, not which algorithm
protects it, so escalating the policy does not need another key provisioned.

GCM needs a fresh nonce per record and mbedTLS has no context-free RNG, so the
policy takes the device's DRBG as well as the key. That is the only wiring
difference from the HMAC policy.

The pipeline element now reports what the store actually did, derived like the
transport value rather than asserted, and both fall back to the weakest honest
answer if the credentials behind them are missing.

The heap difference is measurement noise; the per-run test PKI moves it by up to
32 bytes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ef0ed9a7-de5f-4970-99c6-d68cc92a2902

📥 Commits

Reviewing files that changed from the base of the PR and between bcf4e19 and c4569b9.

📒 Files selected for processing (4)
  • app/syslog/Syslog.c
  • app/syslog/SyslogPipelineSd.c
  • app/syslog/SyslogPipelineSd.h
  • run-report.txt

📝 Walkthrough

Walkthrough

Syslog security changes from HMAC-SHA256 to RNG-backed AES-256-GCM, while structured data now reports configurable transport and at-rest protection values. Runtime reports update measurements and collector output accordingly.

Changes

Syslog security and pipeline configuration

Layer / File(s) Summary
RNG-backed AES-GCM policy wiring
app/syslog/Syslog.c
Device RNG is cached and supplied to TLS stream and AES-256-GCM policy configuration; transport and cipher selection depend on RNG availability.
Active protection values in structured data
app/syslog/SyslogPipelineSd.c, app/syslog/SyslogPipelineSd.h, run-report.txt
SyslogPipelineSd_Init accepts transport and at-rest strings, emits the configured at-rest value, and reports AES-GCM collector output with updated measurements.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant Syslog as Syslog initialization
  participant DeviceCertStore_Rng
  participant TLSStream as SolidSyslogMbedTlsStream
  participant AESGCM as SolidSyslogMbedTlsAesGcmPolicy
  participant PipelineSD as SyslogPipelineSd
  Syslog->>DeviceCertStore_Rng: obtain RNG handle
  Syslog->>TLSStream: configure TLS stream with RNG
  Syslog->>AESGCM: configure key callback and RNG
  Syslog->>PipelineSD: initialize transport and atRest values
  PipelineSD-->>Syslog: emit configured logPipeline structured data
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately captures the main change: switching stored records to AES-256-GCM encryption.
Description check ✅ Passed The description covers the required tag-add explanation and includes the checklist, though some checklist items remain unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hardened-store-aesgcm

Comment @coderabbitai help to get the list of available commands.

@DavidCozens
DavidCozens merged commit 07d25c7 into main Jul 28, 2026
2 checks passed
@DavidCozens
DavidCozens deleted the hardened-store-aesgcm branch July 28, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant