Add SSH host identity rotation controls

This commit is contained in:
2026-09-13 19:58:05 +02:00
parent aa4bbc2c8c
commit 8df1d2218b
19 changed files with 626 additions and 107 deletions
+17 -1
View File
@@ -3,6 +3,7 @@
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@@ -38,7 +39,22 @@ esp_err_t ssh_security_copy_private_key(uint8_t *output, size_t capacity,
size_t *output_length);
esp_err_t ssh_security_get_metadata(ssh_security_metadata_t *metadata);
/* Caller must stop SSH first. Rotation requires valid live material; reset replaces any stored state. */
typedef struct {
ssh_security_metadata_t metadata;
bool busy;
} ssh_security_identity_snapshot_t;
/* Zero-wait atomic public projection; no private material. */
esp_err_t ssh_security_get_identity_snapshot(ssh_security_identity_snapshot_t *snapshot);
/* Owner transaction: nonreused token, reserve before side effects and retain through
* restart. Only the reserving task may replace once and release. Zero generation
* selects canonical semantics; reset additionally permits unavailable material. */
esp_err_t ssh_security_reserve_identity(uint32_t generation, bool reset, uint32_t *token);
esp_err_t ssh_security_replace_reserved(uint32_t token);
void ssh_security_release_identity(uint32_t token);
/* Rotation requires valid live material; reset replaces any stored state.
* Direct callers share the reservation but do not restart the transport. */
esp_err_t ssh_security_rotate(void);
esp_err_t ssh_security_reset(void);