1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! `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 method | FFI symbol | purpose |
//! |--------------|------------|---------|
//! | [`CipherPlugin::create_with_key`] | `cfmp_cipher_create` | construct a new instance |
//! | [`CipherPlugin::block_size`] | `cfmp_cipher_block_size` | block size in bytes |
//! | [`CipherPlugin::key_size`] | `cfmp_cipher_key_size` | key length in bytes |
//! | [`CipherPlugin::iv_size`] | `cfmp_cipher_iv_size` | nonce/IV length in bytes |
//! | [`CipherPlugin::update`] | `cfmp_cipher_update` | encrypt/decrypt a chunk |
//! | [`CipherPlugin::finalize`] | `cfmp_cipher_finalize` | flush remaining output |
//! | [`CipherPlugin::reset`] | `cfmp_cipher_reset` | reset to initial state |
//! | `Drop` | `cfmp_cipher_destroy` | reclaim the boxed state |
use crate;
use crateOptionView;
/// 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.
/// Convenience used by macro-generated code to surface a buffer-too-small
/// condition as a [`PluginError`] without repeating the boilerplate at
/// every call site.