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

Internal structure of the NoiseDHState type. More...

#include <internal.h>

Data Fields

int(* calculate )(const NoiseDHState *private_key_state, const NoiseDHState *public_key_state, uint8_t *shared_key)
 Performs a Diffie-Hellman calculation. More...
 
void(* change_role )(NoiseDHState *state)
 Changes the role for this object. More...
 
int(* copy )(NoiseDHState *state, const NoiseDHState *from, const NoiseDHState *other)
 Copies another key into this object. More...
 
void(* destroy )(NoiseDHState *state)
 Destroys this DHState prior to the memory being freed. More...
 
short dh_id
 Algorithm identifier for the Diffie-Hellman operation. More...
 
uint8_t ephemeral_only: 1
 Non-zero if this algorithm only supports ephemeral keys. More...
 
int(* generate_keypair )(NoiseDHState *state, const NoiseDHState *other)
 Generates a new key pair for this Diffie-Hellman algorithm. More...
 
uint8_t key_type
 The type of key stored within this DHState object. More...
 
uint8_t nulls_allowed: 1
 Non-zero if null public keys are allowed with this algorithm. More...
 
uint8_t * private_key
 Points to the private key in the subclass state. More...
 
uint16_t private_key_len
 Length of the private key for this algorithm in bytes. More...
 
uint8_t * public_key
 Points to the public key in the subclass state. More...
 
uint16_t public_key_len
 Length of the public key for this algorithm in bytes. More...
 
short role
 The role; either initiator or responder or zero. More...
 
int(* set_keypair )(NoiseDHState *state, const uint8_t *private_key, const uint8_t *public_key)
 Sets a keypair. More...
 
int(* set_keypair_private )(NoiseDHState *state, const uint8_t *private_key)
 Sets a keypair using only the private key. More...
 
uint16_t shared_key_len
 Length of the shared key for this algorithm in bytes. More...
 
size_t size
 Total size of the structure including subclass state. More...
 
int(* validate_public_key )(const NoiseDHState *state, const uint8_t *public_key)
 Validates a public key. More...
 

Detailed Description

Internal structure of the NoiseDHState type.

Definition at line 213 of file internal.h.

Field Documentation

int(* NoiseDHState_s::calculate)(const NoiseDHState *private_key_state, const NoiseDHState *public_key_state, uint8_t *shared_key)

Performs a Diffie-Hellman calculation.

Parameters
private_key_statePoints to the DHState for the private key.
public_key_statePoints to the DHState for the public key.
shared_keyPoints to the shared key on exit.
Returns
NOISE_ERROR_NONE on success.
NOISE_ERROR_INVALID_PRIVATE_KEY if the private key is invalid for the algorithm.
NOISE_ERROR_INVALID_PUBLIC_KEY if the public key is invalid for the algorithm.

This function must always operate in the same amount of time, even if the private or public key is invalid.

Definition at line 330 of file internal.h.

void(* NoiseDHState_s::change_role)(NoiseDHState *state)

Changes the role for this object.

Parameters
statePoints to the DHState.

This pointer can be NULL if the back end does not need any special logic to change the role.

Definition at line 342 of file internal.h.

int(* NoiseDHState_s::copy)(NoiseDHState *state, const NoiseDHState *from, const NoiseDHState *other)

Copies another key into this object.

Parameters
statePoints to the DHState to copy into.
fromPoints to the DHState to copy from.
otherPoints to another DHState for obtaining dependent parameters. May be NULL.

Definition at line 310 of file internal.h.

void(* NoiseDHState_s::destroy)(NoiseDHState *state)

Destroys this DHState prior to the memory being freed.

Parameters
statePoints to the DHState.

This function is called just before the memory for the DHState 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 356 of file internal.h.

short NoiseDHState_s::dh_id

Algorithm identifier for the Diffie-Hellman operation.

Definition at line 219 of file internal.h.

uint8_t NoiseDHState_s::ephemeral_only

Non-zero if this algorithm only supports ephemeral keys.

Definition at line 228 of file internal.h.

int(* NoiseDHState_s::generate_keypair)(NoiseDHState *state, const NoiseDHState *other)

Generates a new key pair for this Diffie-Hellman algorithm.

Parameters
statePoints to the DHState.
otherPoints to the other DHState for obtaining dependent parameters. May be NULL.
Returns
NOISE_ERROR_NONE on success or an error code otherwise.

Definition at line 257 of file internal.h.

uint8_t NoiseDHState_s::key_type

The type of key stored within this DHState object.

Definition at line 225 of file internal.h.

uint8_t NoiseDHState_s::nulls_allowed

Non-zero if null public keys are allowed with this algorithm.

Definition at line 231 of file internal.h.

uint8_t* NoiseDHState_s::private_key

Points to the private key in the subclass state.

Definition at line 243 of file internal.h.

uint16_t NoiseDHState_s::private_key_len

Length of the private key for this algorithm in bytes.

Definition at line 234 of file internal.h.

uint8_t* NoiseDHState_s::public_key

Points to the public key in the subclass state.

Definition at line 246 of file internal.h.

uint16_t NoiseDHState_s::public_key_len

Length of the public key for this algorithm in bytes.

Definition at line 237 of file internal.h.

short NoiseDHState_s::role

The role; either initiator or responder or zero.

Definition at line 222 of file internal.h.

int(* NoiseDHState_s::set_keypair)(NoiseDHState *state, const uint8_t *private_key, const uint8_t *public_key)

Sets a keypair.

Parameters
statePoints to the DHState.
private_keyPoints to the private key for the keypair.
public_keyPoints to the public key for the keypair.
Returns
NOISE_ERROR_NONE if the keypair is valid.
NOISE_ERROR_INVALID_PRIVATE_KEY if there is something wrong with the private key.
NOISE_ERROR_INVALID_PUBLIC_KEY if there is something wrong with the public key.

Definition at line 273 of file internal.h.

int(* NoiseDHState_s::set_keypair_private)(NoiseDHState *state, const uint8_t *private_key)

Sets a keypair using only the private key.

Parameters
statePoints to the DHState.
private_keyPoints to the private key for the keypair.
Returns
NOISE_ERROR_NONE if the keypair is valid.
NOISE_ERROR_INVALID_PRIVATE_KEY if there is something wrong with the private key.

Definition at line 287 of file internal.h.

uint16_t NoiseDHState_s::shared_key_len

Length of the shared key for this algorithm in bytes.

Definition at line 240 of file internal.h.

size_t NoiseDHState_s::size

Total size of the structure including subclass state.

Definition at line 216 of file internal.h.

int(* NoiseDHState_s::validate_public_key)(const NoiseDHState *state, const uint8_t *public_key)

Validates a public key.

Parameters
statePoints to the DHState.
public_keyPoints to the public key.
Returns
NOISE_ERROR_NONE if the keypair is valid.
NOISE_ERROR_INVALID_PUBLIC_KEY if there is something wrong with the public key.

Definition at line 300 of file internal.h.


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