Skip to main content

Module ffi

Module ffi 

Source
Expand description

cfm_tc_* C ABI for the threshold-cryptography session interface.

These symbols are declared #[unsafe(no_mangle)] pub extern "C" and linked into whichever cdylib depends on confium-tc (today, confium-core’s libconfium cdylib, eventually a dedicated confium-ffi). The crate itself is an rlib, not a cdylib.

See TODO.roadmap/04-threshold-cryptography.md for the protocol rationale and crates/confium-core/src/ffi/rng.rs for the FFI pattern these entry points mirror.

§Memory ownership

  • CFMTcMessage **outgoing produced by cfm_tc_session_round is a heap array allocated by the framework; the caller frees it with cfm_tc_messages_destroy.
  • CFMTcShare * produced by cfm_tc_dkg_output_share is a heap allocation; the caller frees it with cfm_tc_share_destroy.
  • FFITcSession * is owned by the caller; destroy with cfm_tc_session_destroy.

Structs§

CFMTcMessage
One inter-party message, C view. to_party_id == NULL means broadcast.
CFMTcMessageArray
Heap allocation returned by cfm_tc_session_round for the outgoing messages array. The framework owns the backing storage; the caller frees the whole bundle with cfm_tc_messages_destroy.
CFMTcPartyList
Roster of parties, C view.
CFMTcShare
A party’s share of a distributed secret, C view.

Enums§

FFITcSession
Opaque session handle returned to C.

Functions§

cfm_tc_dkg_output_share
For DKG sessions: extract the per-party share and the shared public key.
cfm_tc_messages_destroy
Free a CFMTcMessageArray returned by cfm_tc_session_round. Safe to call with NULL.
cfm_tc_session_create
Create a new threshold session.
cfm_tc_session_destroy
Destroy a session. Safe to call with NULL.
cfm_tc_session_result
Read the final session artifact into out.
cfm_tc_session_round
Step the session forward one round.
cfm_tc_share_destroy
Free a CFMTcShare returned by cfm_tc_dkg_output_share. Safe to call with NULL.