Struct KcApi

Source
pub struct KcApi { /* private fields */ }
Expand description

Entry structure to linux kernel crypto api. All method low level (i.e. libc calls) errors are logued at debug level to allow investigation in case of unexpected error.

Implementations§

Source§

impl KcApi

Source

pub fn new(alg_type: &str, alg_name: &str) -> Result<Self, Error>

New from algorithm name and type.

§Errors
Source

pub fn set_key<T>(&self, key: &T) -> Result<(), Error>
where T: AsRef<[u8]> + Clone,

Set Cipher key. See KCAPI setsockopt

§Errors
Source

pub fn set_aead_auth_size(&self, size: usize) -> Result<(), Error>

Set authentication tag size for AEAD ciphers. See KCAPI setsockopt

§Errors
Source

pub fn init(&mut self) -> Result<(), Error>

Accept connexion to get operation socket Eventually close current connexion

§Errors
Source

pub fn finish(&mut self) -> Result<(), Error>

Close current connexion.

§Errors
Source

pub fn set_option( &self, iv: Option<&[u8]>, aad: Option<u32>, dir: Option<Direction>, ) -> Result<(), Error>

Set cipher option. See KCAPI symmetric-cipher-api and See KCAPI aead-cipher-api

§Errors
Source

pub fn read(&self, out: &mut [u8]) -> Result<usize, Error>

Get processed data.

§Errors
Source

pub fn send_data_with_option( &self, iv: Option<&[u8]>, aad: Option<u32>, dir: Option<Direction>, data: &[u8], more_data: DataPos, ) -> Result<usize, Error>

Send data to be processed.

§Errors
Source

pub fn send_data(&self, data: &[u8], more_data: DataPos) -> Result<usize, Error>

Send data to be processed.

§Errors
Source

pub fn send_data_no_copy( &self, data: &[u8], more_data: DataPos, ) -> Result<usize, Error>

Send data to be processed.

§Errors
  • Error::Sys(Errno) in case of low level error. See man 2 vmsplice, man 2 splice, man 2 close

Trait Implementations§

Source§

impl Drop for KcApi

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for KcApi

§

impl RefUnwindSafe for KcApi

§

impl Send for KcApi

§

impl Sync for KcApi

§

impl Unpin for KcApi

§

impl UnwindSafe for KcApi

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.