Skip to main content

pamoja_session_hmac_sha256

Function pamoja_session_hmac_sha256 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_session_hmac_sha256( key: *const u8, key_len: usize, message: *const u8, message_len: usize, out_digest: *mut u8, ) -> PamojaStatus
Expand description

Computes a keyed hash over a message.

This is the primitive a host uses to authenticate a pairing exchange or a single command, where a whole session would be more than the job needs.

§Arguments

  • key - the secret key.
  • key_len - the length of key.
  • message - the message to authenticate.
  • message_len - the length of message.
  • out_digest - receives PAMOJA_SESSION_KEY_LEN bytes.

§Returns

PamojaStatus::Ok on success.

§Safety

key and message must point to at least their stated lengths of readable bytes, or be null when those lengths are 0, and out_digest must point to at least PAMOJA_SESSION_KEY_LEN writable bytes.