PQLR
Postquantum Crypto Library by QAPP
|
Typedefs | |
typedef struct newhope_st * | newhope_t |
Newhope algorithm instance handle. More... | |
Enumerations | |
enum | newhope_parameterset_t { newhope_1024 , newhope_last } |
Possible newhope parameters sets. More... | |
Functions | |
PQLR_API newhope_t | newhope_new (newhope_parameterset_t parameterset) |
Creates newhope instance initialized by parameterset. More... | |
PQLR_API void | newhope_free (newhope_t newhope) |
Frees newhope instance and all corresponding resources. More... | |
PQLR_API newhope_t | newhope_duplicate (const newhope_t newhope) |
Duplicates context of newhope instance. More... | |
PQLR_API uint32_t | newhope_get_initiator_secret_length (newhope_t newhope) |
Obtains initiator's secret length for current newhope instance. More... | |
PQLR_API uint32_t | newhope_get_initiator_public_length (newhope_t newhope) |
Obtains initiator's public key length for current newhope instance. More... | |
PQLR_API uint32_t | newhope_get_ciphertext_length (newhope_t newhope) |
Obtains encoded reply length for current newhope instance. More... | |
PQLR_API uint32_t | newhope_get_shared_secret_length (newhope_t newhope) |
Obtains number of symmetric secret key bytes for current newhope instance. More... | |
PQLR_API pqlr_t | newhope_to_pqlr (newhope_t newhope) |
Casts newhope instance to pqlr instance. More... | |
PQLR_API void | newhope_keygen (const newhope_t newhope, uint8_t *public_key, uint8_t *secret_key) |
Initial step of key distribution. Generates a key pair for key distribution initiator. More... | |
PQLR_API void | newhope_key_encap (const newhope_t newhope, const uint8_t *public_key, uint8_t *ciphertext, uint8_t *session_key) |
Second step of key distribution. Generates symmetric secret key on responder side (opposite from initiator). More... | |
PQLR_API void | newhope_key_decap (const newhope_t newhope, const uint8_t *secret_key, const uint8_t *ciphertext, uint8_t *key) |
Last step of key distribution. Generates symmetric secret key on initiator side. More... | |
This module provides Newhope algorithm implementation, which is finite state machine for secure distribution of secret between two counterparties. Distributed secret is theoretically tolerant to attacks performed by quantum computers. Entry point is newhope_keygen
Key distribution algorithms consist of sequential function calls on two sides named initiator
and responder
.
request
request
to responderreply
and key
reply
to initiatorkey
key
In order to use any NewHope key distribution functions, add following include:
Example code is listed below:
typedef struct newhope_st* newhope_t |
Newhope algorithm instance handle.
Duplicates context of newhope instance.
newhope | instance to duplicate |
Frees newhope instance and all corresponding resources.
newhope | instance to free |
Obtains encoded reply length for current newhope instance.
newhope | initialized newhope instance |
Obtains initiator's public key length for current newhope instance.
newhope | initialized newhope instance |
Obtains initiator's secret length for current newhope instance.
newhope | initialized newhope instance |
Obtains number of symmetric secret key bytes for current newhope instance.
newhope | initialized newhope instance |
PQLR_API void newhope_key_decap | ( | const newhope_t | newhope, |
const uint8_t * | secret_key, | ||
const uint8_t * | ciphertext, | ||
uint8_t * | key | ||
) |
Last step of key distribution. Generates symmetric secret key on initiator side.
newhope | Newhope algorithm context. If NULL , the fatal error occurs. | |
secret_key | Initiator secret buffer obtained on initial step. If NULL , the fatal error occurs. | |
ciphertext | Ciphertext buffer. If NULL , the fatal error occurs. | |
[out] | session_key | session key buffer. If NULL , the fatal error occurs. |
PQLR_API void newhope_key_encap | ( | const newhope_t | newhope, |
const uint8_t * | public_key, | ||
uint8_t * | ciphertext, | ||
uint8_t * | session_key | ||
) |
Second step of key distribution. Generates symmetric secret key on responder side (opposite from initiator).
newhope | Newhope algorithm context. If NULL , the fatal error occurs. | |
public_key | Public key buffer | |
[out] | ciphertext | Ciphertext buffer. Must point to array of uint8_t with elements count at least newhope_get_ciphertext_length . If NULL , the fatal error occurs |
[out] | session_key | Session key buffer. Must point to array of uint8_t with elements count at least mceliece_get_initiator_key_length . If NULL , the fatal error occurs. |
PQLR_API void newhope_keygen | ( | const newhope_t | newhope, |
uint8_t * | public_key, | ||
uint8_t * | secret_key | ||
) |
Initial step of key distribution. Generates a key pair for key distribution initiator.
newhope | Newhope algorithm context. If NULL , the fatal error occurs. | |
[out] | public_key | Encoded message to client. Must point to array of uint8_t with elements count at least newhope_get_initiator_public_length . If NULL , the fatal error occurs. |
[out] | secret_key | Initiator secret buffer. Must point to array of newhope_poly_t with elements count at least newhope_get_initiator_secret_length . If NULL , the fatal error occurs. |
PQLR_API newhope_t newhope_new | ( | newhope_parameterset_t | parameterset | ) |
Creates newhope instance initialized by parameterset.
parameterset | Newhope configuration parameters set (see newhope_parameterset_t for availible options). |
NULL
if out of memory