Skip to main content

Crate confium_mock_plugin

Crate confium_mock_plugin 

Source
Expand description

Mock plugin built entirely with the confium-api SDK proc-macros.

This is the proof-of-concept that the macro-generated FFI symbols load through the standard Confium plugin loader. The plugin implements two interfaces:

  • A trivial XOR-fold hash: the digest is one byte, the XOR of every input byte. Fully deterministic and dependency-free.
  • A trivial XOR-stream cipher: each input byte is XOR-folded with a running key byte derived from the key material. The cipher is a stand-in for a real symmetric cipher — it exercises the full cfmp_cipher_* symbol set (create, block/key/iv size, update, finalize, reset, destroy) end to end.

The crate compiles to a cdylib so the loader can dlopen it. The cfmp_* symbols are emitted by:

  • #[plugin_interface(name = "hash", version = 0)] on the impl HashPlugin for XorHash block (eight cfmp_hash_* symbols).
  • #[plugin_interface(name = "cipher", version = 0)] on the impl CipherPlugin for XorCipher block (eight cfmp_cipher_* symbols).
  • #[export(metadata(...))] on the plugin marker struct. Emits the lifecycle + metadata symbols. The interface list is auto-discovered from the #[plugin_interface] attributes above; no explicit interfaces(...) argument is needed.

The integration test in tests/loader.rs loads this crate’s cdylib artifact and runs an end-to-end hash and cipher through the loader.

Structs§

Plugin
XorCipher
Trivial XOR-stream cipher used as a mock. The “key schedule” is a single running byte derived by XOR-folding the supplied key; each input byte is XORed with that running byte. This is not secure cryptography — it exists only to exercise the full cipher FFI surface without pulling in a real cipher library.
XorHash
One-byte XOR-fold hash. State is a single accumulator byte.

Functions§

cfmp_cipher_block_size
cfmp_cipher_create
cfmp_cipher_destroy
cfmp_cipher_finalize
cfmp_cipher_iv_size
cfmp_cipher_key_size
cfmp_cipher_reset
cfmp_cipher_update
cfmp_finalize
cfmp_hash_block_size
cfmp_hash_clone
cfmp_hash_create
cfmp_hash_destroy
cfmp_hash_finalize
cfmp_hash_output_size
cfmp_hash_reset
cfmp_hash_update
cfmp_initialize
cfmp_interface_version
cfmp_metadata
cfmp_query_interfaces