SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
SharkSslPSAStorage.h File Reference
#include "psa/crypto.h"

Go to the source code of this file.

Data Structures

struct  SharkSslPSAKeyStorage
 Platform storage for local persistent keys. More...
 

Typedefs

typedef struct SharkSslPSAKeyStorage SharkSslPSAKeyStorage
 Platform storage for local persistent keys. More...
 

Functions

psa_status_t SharkSslPSAKeyStorage_set (const SharkSslPSAKeyStorage *o)
 Register storage, or pass NULL to unregister. More...
 

Detailed Description

See Choose a SharkSSL API for build scope and the owning API layer.

Typedef Documentation

◆ SharkSslPSAKeyStorage

Platform storage for local persistent keys.

Callbacks run under the provider key-store lock and must not call PSA or this registration function. The context must remain alive until the backend is unregistered. The provider copies the callback table; registration requires an empty RAM key store. Register at startup or at a quiescent point with no cryptographic operations in progress. A backend must not be switched while its IDs remain in use.

read with material == NULL and capacity == 0 queries attributes and length. A second read returns the same complete record or an error. Missing records return PSA_ERROR_DOES_NOT_EXIST. create must atomically create a new record, never replace an existing ID, and return PSA_ERROR_ALREADY_EXISTS on collision. Successful create means attributes and material are durable; a recoverable create failure leaves no new record. remove must erase a record and return DOES_NOT_EXIST if absent; recoverable failure preserves it for a retry. If storage fails during rollback, its durable outcome can be uncertain. Report STORAGE_FAILURE and refuse further callbacks until storage has been repaired and the affected ID reconciled. The provider returns no new handle for failed creation; it cannot recover or prove durability for failed media.

The backend owns serialization, format versioning, integrity, confidentiality, access isolation, power-loss atomicity and secure deletion. Raw C attributes are not a portable disk format. No filesystem or flash backend is installed by default. Only PSA_KEY_LIFETIME_PERSISTENT in local storage is supported.

Function Documentation

◆ SharkSslPSAKeyStorage_set()

psa_status_t SharkSslPSAKeyStorage_set ( const SharkSslPSAKeyStorage *  o)

Register storage, or pass NULL to unregister.

No live RAM keys are allowed; destroy volatile keys and purge persistent keys first. Storage records are unchanged. BAD_STATE preserves the previous backend. Invalid callback tables return INVALID_ARGUMENT. The same backend must own all outstanding IDs.

Parameters
oconst SharkSslPSAKeyStorage *; callback table to copy, or NULL to unregister. Its context is borrowed until unregistration.
Returns
psa_status_t: PSA_SUCCESS; PSA_ERROR_INVALID_ARGUMENT for missing callbacks; PSA_ERROR_BAD_STATE for live keys/dependencies; PSA_ERROR_GENERIC_ERROR if the provider lock cannot be acquired.