Noise-C
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Data Fields
NoiseCipherState_s Struct Reference

Internal structure of the NoiseCipherState type. More...

#include <internal.h>

Data Fields

int cipher_id
 Algorithm identifier for the cipher. More...
 
NoiseCipherState *(* create )(void)
 Creates a new CipherState of the same type as this one. More...
 
int(* decrypt )(NoiseCipherState *state, const uint8_t *ad, size_t ad_len, uint8_t *data, size_t len)
 Decrypts data with this CipherState. More...
 
void(* destroy )(NoiseCipherState *state)
 Destroys this CipherState prior to the memory being freed. More...
 
int(* encrypt )(NoiseCipherState *state, const uint8_t *ad, size_t ad_len, uint8_t *data, size_t len)
 Encrypts data with this CipherState. More...
 
uint8_t has_key
 Non-zero if the key has been set on this cipher. More...
 
void(* init_key )(NoiseCipherState *state, const uint8_t *key)
 Sets the key for this CipherState. More...
 
uint8_t key_len
 Length of the key for this cipher in bytes. More...
 
uint8_t mac_len
 Length of the MAC for this cipher in bytes. More...
 
uint64_t n
 The nonce value for the next packet. More...
 
size_t size
 Total size of the structure including subclass state. More...
 

Detailed Description

Internal structure of the NoiseCipherState type.

Definition at line 58 of file internal.h.

Field Documentation

int NoiseCipherState_s::cipher_id

Algorithm identifier for the cipher.

Definition at line 64 of file internal.h.

NoiseCipherState*(* NoiseCipherState_s::create)(void)

Creates a new CipherState of the same type as this one.

Returns
A new CipherState object, or NULL if there is insufficient memory for the request.

Definition at line 84 of file internal.h.

int(* NoiseCipherState_s::decrypt)(NoiseCipherState *state, const uint8_t *ad, size_t ad_len, uint8_t *data, size_t len)

Decrypts data with this CipherState.

Parameters
statePoints to the CipherState.
adPoints to the associated data to include in the MAC computation.
ad_lenThe length of the associated data; may be zero.
dataPoints to the ciphertext plus MAC on entry, and to the plaintext on exit.
lenThe length of the ciphertext, excluding the MAC.
Returns
NOISE_ERROR_NONE on success, NOISE_ERROR_MAC_FAILURE if the MAC check failed.

Definition at line 130 of file internal.h.

void(* NoiseCipherState_s::destroy)(NoiseCipherState *state)

Destroys this CipherState prior to the memory being freed.

Parameters
statePoints to the CipherState.

This function is called just before the memory for the CipherState is deallocated. It gives the back end an opportunity to clean up linked objects.

This pointer can be NULL if the back end does not need any special clean up logic.

Definition at line 145 of file internal.h.

int(* NoiseCipherState_s::encrypt)(NoiseCipherState *state, const uint8_t *ad, size_t ad_len, uint8_t *data, size_t len)

Encrypts data with this CipherState.

Parameters
statePoints to the CipherState.
adPoints to the associated data to include in the MAC computation.
ad_lenThe length of the associated data; may be zero.
dataPoints to the plaintext on entry, and to the ciphertext plus MAC on exit.
lenThe length of the plaintext.
Returns
NOISE_ERROR_NONE on success.

The data buffer must have enough room to append mac_len extra bytes for the MAC value.

Definition at line 113 of file internal.h.

uint8_t NoiseCipherState_s::has_key

Non-zero if the key has been set on this cipher.

Definition at line 67 of file internal.h.

void(* NoiseCipherState_s::init_key)(NoiseCipherState *state, const uint8_t *key)

Sets the key for this CipherState.

Parameters
statePoints to the CipherState.
keyPoints to the key, which must be key_len bytes in size.

If the key has already been set before, then calling this function again will set a new key.

Definition at line 95 of file internal.h.

uint8_t NoiseCipherState_s::key_len

Length of the key for this cipher in bytes.

Definition at line 70 of file internal.h.

uint8_t NoiseCipherState_s::mac_len

Length of the MAC for this cipher in bytes.

Definition at line 73 of file internal.h.

uint64_t NoiseCipherState_s::n

The nonce value for the next packet.

Definition at line 76 of file internal.h.

size_t NoiseCipherState_s::size

Total size of the structure including subclass state.

Definition at line 61 of file internal.h.


The documentation for this struct was generated from the following file: