Skip to content

feat: encrypt stored records with AES-256-GCM - #17

Merged
DavidCozens merged 1 commit into
mainfrom
stage-17-aes-gcm
Aug 16, 2026
Merged

feat: encrypt stored records with AES-256-GCM#17
DavidCozens merged 1 commit into
mainfrom
stage-17-aes-gcm

Conversation

@DavidCozens

Copy link
Copy Markdown
Contributor

Replace the HMAC policy with authenticated encryption. Tamper-evidence establishes that a stored
record was not altered; it does nothing to stop anyone reading it. AES-256-GCM encrypts the body,
authenticates the record header as associated data, and puts the nonce and tag in the trailer.

struct SolidSyslogMbedTlsAesGcmPolicyConfig gcmConfig = {.GetKey = SyslogStoreKey, .Rng = rng};

.SecurityPolicy = SolidSyslogMbedTlsAesGcmPolicy_Create(&gcmConfig),

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 store key does not change. Its name states what it protects rather than which algorithm protects
it, so escalating the policy needs no new key provisioned.

These are separate decisions and the second does not follow from the first. A device that only needs
to prove records were not altered can stop at the HMAC.

The pipeline element now derives both of its values from what the device holds, and each falls back
to the weakest honest answer when the credential behind it is missing:

s_sd[3] = SyslogPipelineSd_Init(
    ((clientChain != NULL) && (clientKey != NULL)) ? "mtls" : "tls", (rng != NULL) ? "aes-256-gcm" : "none"
);
... [logPipeline@32473 transport="mtls" atRest="aes-256-gcm"] device started

When you need it. If a disk that leaves the device would give something away — records naming
users, addresses, process values, or anything else you would not publish.

@DavidCozens

Copy link
Copy Markdown
Contributor Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

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      +13,788 B  (+164 on the previous stage)
  RAM        +39,536 B     (+12)
  Log stack     +680 B  (unchanged)
  Service     +3,768 B  (unchanged)

AES-GCM is already linked: a device negotiating a GCM ciphersuite for TLS carries
the same primitive the store now uses. The policy encrypts in place, into the
buffer the store already owns.

The store key is unchanged. Its name states what it protects rather than which
algorithm protects it, so escalating the policy needs no new 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 derives both values from what the device holds, and each
falls back to the weakest honest answer when the credential behind it is missing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@DavidCozens
DavidCozens changed the base branch from stage-16-mtls to main August 16, 2026 21:52
@DavidCozens
DavidCozens merged commit fb1bd59 into main Aug 16, 2026
1 check was pending
@DavidCozens
DavidCozens deleted the stage-17-aes-gcm branch August 16, 2026 21:54
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