Struct oqs_sys::kem::OQS_KEM

source ·
#[repr(C)]
pub struct OQS_KEM { pub method_name: *const c_char, pub alg_version: *const c_char, pub claimed_nist_level: u8, pub ind_cca: bool, pub length_public_key: usize, pub length_secret_key: usize, pub length_ciphertext: usize, pub length_shared_secret: usize, pub keypair: Option<unsafe extern "C" fn(public_key: *mut u8, secret_key: *mut u8) -> OQS_STATUS>, pub encaps: Option<unsafe extern "C" fn(ciphertext: *mut u8, shared_secret: *mut u8, public_key: *const u8) -> OQS_STATUS>, pub decaps: Option<unsafe extern "C" fn(shared_secret: *mut u8, ciphertext: *const u8, secret_key: *const u8) -> OQS_STATUS>, }
Expand description

Key encapsulation mechanism object

Fields§

§method_name: *const c_char

Printable string representing the name of the key encapsulation mechanism.

§alg_version: *const c_char

Printable string representing the version of the cryptographic algorithm.

Implementations with the same method_name and same alg_version will be interoperable. See README.md for information about algorithm compatibility.

§claimed_nist_level: u8

The NIST security level (1, 2, 3, 4, 5) claimed in this algorithm’s original NIST submission.

§ind_cca: bool

Whether the KEM offers IND-CCA security (TRUE) or IND-CPA security (FALSE).

§length_public_key: usize

The (maximum) length, in bytes, of public keys for this KEM.

§length_secret_key: usize

The (maximum) length, in bytes, of secret keys for this KEM.

§length_ciphertext: usize

The (maximum) length, in bytes, of ciphertexts for this KEM.

§length_shared_secret: usize

The (maximum) length, in bytes, of shared secrets for this KEM.

§keypair: Option<unsafe extern "C" fn(public_key: *mut u8, secret_key: *mut u8) -> OQS_STATUS>

Keypair generation algorithm.

Caller is responsible for allocating sufficient memory for public_key and secret_key, based on the length_* members in this object or the per-scheme compile-time macros OQS_KEM_*_length_*.

@param[out] public_key The public key represented as a byte string. @param[out] secret_key The secret key represented as a byte string. @return OQS_SUCCESS or OQS_ERROR

§encaps: Option<unsafe extern "C" fn(ciphertext: *mut u8, shared_secret: *mut u8, public_key: *const u8) -> OQS_STATUS>

Encapsulation algorithm.

Caller is responsible for allocating sufficient memory for ciphertext and shared_secret, based on the length_* members in this object or the per-scheme compile-time macros OQS_KEM_*_length_*.

@param[out] ciphertext The ciphertext (encapsulation) represented as a byte string. @param[out] shared_secret The shared secret represented as a byte string. @param[in] public_key The public key represented as a byte string. @return OQS_SUCCESS or OQS_ERROR

§decaps: Option<unsafe extern "C" fn(shared_secret: *mut u8, ciphertext: *const u8, secret_key: *const u8) -> OQS_STATUS>

Decapsulation algorithm.

Caller is responsible for allocating sufficient memory for shared_secret, based on the length_* members in this object or the per-scheme compile-time macros OQS_KEM_*_length_*.

@param[out] shared_secret The shared secret represented as a byte string. @param[in] ciphertext The ciphertext (encapsulation) represented as a byte string. @param[in] secret_key The secret key represented as a byte string. @return OQS_SUCCESS or OQS_ERROR

Trait Implementations§

source§

impl Clone for OQS_KEM

source§

fn clone(&self) -> OQS_KEM

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for OQS_KEM

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for OQS_KEM

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.