Struct HMacCtxRef

Source
pub struct HMacCtxRef(/* private fields */);
Expand description

A reference to a [HmacCtx].

Implementations§

Source§

impl HMacCtxRef

Source

pub fn reset(&mut self) -> Result<(), ErrorStack>

Clears an existing HMAC_CTX and associated resources.

This will make it suitable for new computations as if it was newly created with HMAC_CTX_new().

This corresponds to HMAC_CTX_reset.

Source

pub fn copy(&mut self, src: &HMacCtxRef) -> Result<(), ErrorStack>

This corresponds to HMAC_CTX_copy.

Source

pub fn init_ex( &mut self, key: Option<&[u8]>, md: &MdRef, ) -> Result<(), ErrorStack>

This corresponds to HMAC_Init_ex.

Source

pub fn md(&self) -> Option<&MdRef>

This corresponds to HMAC_CTX_get_md.

Source

pub fn size(&self) -> usize

Returns the size, in bytes, of the HMAC that will be produced by ctx.

On entry, ctx must have been setup with init_ex

This corresponds to HMAC_size.

Source

pub fn hmac_update(&mut self, data: &[u8]) -> Result<(), ErrorStack>

Add data bytes to the MAC input.

This corresponds to HMAC_Update.

Source

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

Place the message authentication code in out.

This corresponds to HMAC_Update.

Source

pub fn hmac_final_to_vec( &mut self, out: &mut Vec<u8>, ) -> Result<usize, ErrorStack>

Like Self::hmac_final but appends the signature to a Vec.

Trait Implementations§

Source§

impl AsRef<HMacCtxRef> for HMacCtx

Source§

fn as_ref(&self) -> &HMacCtxRef

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<HMacCtxRef> for HMacCtx

Source§

fn borrow(&self) -> &HMacCtxRef

Immutably borrows from an owned value. Read more
Source§

impl ForeignTypeRef for HMacCtxRef

Source§

type CType = HMAC_CTX

The raw C type.
Source§

unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self

Constructs a shared instance of this type from its raw type.
Source§

unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self

Constructs a mutable reference of this type from its raw type.
Source§

fn as_ptr(&self) -> *mut Self::CType

Returns a raw pointer to the wrapped value.
Source§

impl Send for HMacCtxRef

Source§

impl Sync for HMacCtxRef

Auto Trait Implementations§

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.