Skip to main content

Module cipher

Module cipher 

Source
Expand description

CipherPlugin trait — the Rust-side counterpart of the symmetric cipher v0 wire protocol.

Plugin authors implement this trait on their cipher state type, then apply #[plugin_interface(name = "cipher", version = 0)] to the impl block. The macro emits the eight canonical cfmp_cipher_* FFI symbols, one per trait method.

Method → symbol mapping (see crates/confium-core/src/ffi/cipher.rs for the loader-side wire types):

trait methodFFI symbolpurpose
CipherPlugin::create_with_keycfmp_cipher_createconstruct a new instance
CipherPlugin::block_sizecfmp_cipher_block_sizeblock size in bytes
CipherPlugin::key_sizecfmp_cipher_key_sizekey length in bytes
CipherPlugin::iv_sizecfmp_cipher_iv_sizenonce/IV length in bytes
CipherPlugin::updatecfmp_cipher_updateencrypt/decrypt a chunk
CipherPlugin::finalizecfmp_cipher_finalizeflush remaining output
CipherPlugin::resetcfmp_cipher_resetreset to initial state
Dropcfmp_cipher_destroyreclaim the boxed state

Traits§

CipherPlugin
Trait implemented by symmetric cipher plugins. The macro-generated cfmp_cipher_create calls CipherPlugin::create_with_key; all other symbols dispatch through OpaqueHandle::<Self>::borrow_raw and the corresponding trait method.

Functions§

insufficient_buffer
Convenience used by macro-generated code to surface a buffer-too-small condition as a PluginError without repeating the boilerplate at every call site.