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
impl KcApi
Sourcepub fn new(alg_type: &str, alg_name: &str) -> Result<Self, Error>
pub fn new(alg_type: &str, alg_name: &str) -> Result<Self, Error>
New from algorithm name and type.
§Errors
Error::Sys(Errno)
in case of low level error. Seeman 2 socket
andman 2 bind
Sourcepub fn set_key<T>(&self, key: &T) -> Result<(), Error>
pub fn set_key<T>(&self, key: &T) -> Result<(), Error>
Set Cipher key. See KCAPI setsockopt
§Errors
Error::Sys(Errno)
in case of low level error. Seeman 2 setsockopt
Sourcepub fn set_aead_auth_size(&self, size: usize) -> Result<(), Error>
pub fn set_aead_auth_size(&self, size: usize) -> Result<(), Error>
Set authentication tag size for AEAD ciphers. See KCAPI setsockopt
§Errors
Error::Sys(Errno)
in case of low level error. Seeman 2 setsockopt
Sourcepub fn init(&mut self) -> Result<(), Error>
pub fn init(&mut self) -> Result<(), Error>
Accept connexion to get operation socket Eventually close current connexion
§Errors
Error::Sys(Errno)
in case of low level error. Seeman 2 close
andman 2 accept
Sourcepub fn set_option(
&self,
iv: Option<&[u8]>,
aad: Option<u32>,
dir: Option<Direction>,
) -> Result<(), Error>
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
Error::Sys(Errno)
in case of low level error. Seeman 2 sendmsg
Sourcepub fn send_data_with_option(
&self,
iv: Option<&[u8]>,
aad: Option<u32>,
dir: Option<Direction>,
data: &[u8],
more_data: DataPos,
) -> Result<usize, Error>
pub fn send_data_with_option( &self, iv: Option<&[u8]>, aad: Option<u32>, dir: Option<Direction>, data: &[u8], more_data: DataPos, ) -> Result<usize, Error>
Sourcepub fn send_data_no_copy(
&self,
data: &[u8],
more_data: DataPos,
) -> Result<usize, Error>
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. Seeman 2 vmsplice
,man 2 splice
,man 2 close
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more