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

Internal structure of the NoiseSignState type. More...

#include <internal.h>

Data Fields

int(* derive_public_key )(const NoiseSignState *state, const uint8_t *private_key, uint8_t *public_key)
 Derives a public key from a private key. More...
 
void(* destroy )(NoiseSignState *state)
 Destroys this SignState prior to the memory being freed. More...
 
void(* generate_keypair )(NoiseSignState *state)
 Generates a new key pair for this digital signature algorithm. More...
 
uint16_t key_type
 The type of key stored within this SignState object. 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...
 
int(* sign )(const NoiseSignState *state, const uint8_t *message, size_t message_len, uint8_t *signature)
 Creates a signature. More...
 
int sign_id
 Algorithm identifier for the digital signature operation. More...
 
uint16_t signature_len
 Length of the signature for this algorithm in bytes. More...
 
size_t size
 Total size of the structure including subclass state. More...
 
int(* validate_keypair )(const NoiseSignState *state, const uint8_t *private_key, const uint8_t *public_key)
 Validates a keypair. More...
 
int(* validate_public_key )(const NoiseSignState *state, const uint8_t *public_key)
 Validates a public key. More...
 
int(* verify )(const NoiseSignState *state, const uint8_t *message, size_t message_len, const uint8_t *signature)
 Verifies a digital signature on a message. More...
 

Detailed Description

Internal structure of the NoiseSignState type.

Definition at line 362 of file internal.h.

Field Documentation

int(* NoiseSignState_s::derive_public_key)(const NoiseSignState *state, const uint8_t *private_key, uint8_t *public_key)

Derives a public key from a private key.

Parameters
statePoints to the SignState.
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 derived public key.

Definition at line 426 of file internal.h.

void(* NoiseSignState_s::destroy)(NoiseSignState *state)

Destroys this SignState prior to the memory being freed.

Parameters
statePoints to the SignState.

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

void(* NoiseSignState_s::generate_keypair)(NoiseSignState *state)

Generates a new key pair for this digital signature algorithm.

Parameters
statePoints to the SignState.

Definition at line 393 of file internal.h.

uint16_t NoiseSignState_s::key_type

The type of key stored within this SignState object.

Definition at line 371 of file internal.h.

uint8_t* NoiseSignState_s::private_key

Points to the private key in the subclass state.

Definition at line 383 of file internal.h.

uint16_t NoiseSignState_s::private_key_len

Length of the private key for this algorithm in bytes.

Definition at line 374 of file internal.h.

uint8_t* NoiseSignState_s::public_key

Points to the public key in the subclass state.

Definition at line 386 of file internal.h.

uint16_t NoiseSignState_s::public_key_len

Length of the public key for this algorithm in bytes.

Definition at line 377 of file internal.h.

int(* NoiseSignState_s::sign)(const NoiseSignState *state, const uint8_t *message, size_t message_len, uint8_t *signature)

Creates a signature.

Parameters
statePoints to the SignState.
messagePoints to the message to be signed.
message_lenThe length of the message to be signed.
signaturePoints to the signature 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 460 of file internal.h.

int NoiseSignState_s::sign_id

Algorithm identifier for the digital signature operation.

Definition at line 368 of file internal.h.

uint16_t NoiseSignState_s::signature_len

Length of the signature for this algorithm in bytes.

Definition at line 380 of file internal.h.

size_t NoiseSignState_s::size

Total size of the structure including subclass state.

Definition at line 365 of file internal.h.

int(* NoiseSignState_s::validate_keypair)(const NoiseSignState *state, const uint8_t *private_key, const uint8_t *public_key)

Validates a keypair.

Parameters
statePoints to the SignState.
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 409 of file internal.h.

int(* NoiseSignState_s::validate_public_key)(const NoiseSignState *state, const uint8_t *public_key)

Validates a public key.

Parameters
statePoints to the SignState.
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 440 of file internal.h.

int(* NoiseSignState_s::verify)(const NoiseSignState *state, const uint8_t *message, size_t message_len, const uint8_t *signature)

Verifies a digital signature on a message.

Parameters
statePoints to the SignState.
messagePoints to the message whose signature should be verified, which is usually a short hash value.
message_lenThe length of the message to be verified.
signaturePoints to the signature to be verified.
Returns
NOISE_ERROR_NONE on success.
NOISE_ERROR_INVALID_PUBLIC_KEY if state does not contain a public key or the public key is invalid.
NOISE_ERROR_INVALID_SIGNATURE if the signature is not valid for the message using this public key.

Definition at line 479 of file internal.h.


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