Crates.io | fips203-ffi |
lib.rs | fips203-ffi |
version | 0.4.1 |
source | src |
created_at | 2024-05-25 18:05:48.275944 |
updated_at | 2024-10-13 23:20:07.903963 |
description | C shared library exposing FIPS 203: Module-Lattice-Based Key-Encapsulation Mechanism |
homepage | |
repository | https://github.com/integritychain/fips203 |
max_upload_size | |
id | 1252110 |
size | 45,900 |
This crate provides a shared object (dynamically-linked library) using standard C FFI ABI that provides a functional implementation of ML-KEM.
The goals of this implementation are:
security-related goals:
non-goals are:
Autogenerate stable C headers (e.g. with cbindgen); manually-crafted headers are probably fine, given the simplicity of the API/ABI
$ cd ffi # this directory
$ cargo build
$ (cd tests && make)
$ cd python
$ python3
>>> from fips203 import ML_KEM_512
>>>
>>> (encapsulation_key, decapsulation_key) = ML_KEM_512.keygen()
>>> (ciphertext, shared_secret_1) = encapsulation_key.encaps()
>>> shared_secret_2 = decapsulation_key.decaps(ciphertext)
>>> assert(shared_secret_1 == shared_secret_2)