PQLR
Postquantum Crypto Library by QAPP
|
Typedefs | |
typedef struct saber_st * | saber_t |
Saber algorithm instance handle. More... | |
Enumerations | |
enum | saber_parameterset_t { saber_classic , saber_lightsaber , saber_firesaber , saber_last } |
Possible saber parameters sets. More... | |
Functions | |
PQLR_API saber_t | saber_new (saber_parameterset_t parameterset) |
Creates saber instance initialized by parameterset. More... | |
PQLR_API void | saber_free (saber_t saber) |
Frees saber instance and all corresponding resources. More... | |
PQLR_API saber_t | saber_duplicate (const saber_t saber) |
duplicates context of saber algorithm More... | |
PQLR_API uint32_t | saber_get_initiator_public_length (saber_t saber) |
Obtains initiator's public key length for the current saber instance. More... | |
PQLR_API uint32_t | saber_get_initiator_secret_length (saber_t saber) |
Obtains initiator's secret key length for the current saber instance. More... | |
PQLR_API uint32_t | saber_get_ciphertext_length (saber_t saber) |
Obtains ciphertext (request) length for the current saber instance. More... | |
PQLR_API uint32_t | saber_get_shared_secret_length (saber_t saber) |
Obtains shared secret (key) length for the current saber instance. More... | |
PQLR_API pqlr_t | saber_to_pqlr (saber_t saber) |
Casts saber instance to pqlr instance. More... | |
PQLR_API void | saber_keygen (const saber_t saber, 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 | saber_key_encap (const saber_t saber, const uint8_t *public_key, uint8_t *ciphertext, uint8_t *session_key) |
Second step of key distribution. Encapsulates key on the responder side. More... | |
PQLR_API void | saber_key_decap (const saber_t saber, const uint8_t *secret_key, const uint8_t *ciphertext, uint8_t *session_key) |
Last step of key distribution. Decapsulates key on the initiator side. More... | |
This module provides SABER algorithm implementation, which is finite state machine for secure distribution of secret between two counterparties. The distributed secret is theoretically tolerant to attacks performed by quantum computers. Entry point is saber_keygen
Key distribution algorithms consist of sequential function calls on two sides named initiator
and responder
.
request
, key
request
to initiatorkey
key
In order to use any SABER key distribution functions, add the following include:
Example code is listed below:
typedef struct saber_st* saber_t |
Saber algorithm instance handle.
enum saber_parameterset_t |
duplicates context of saber algorithm
[in] | saber | instance to duplicate |
PQLR_API void saber_key_decap | ( | const saber_t | saber, |
const uint8_t * | secret_key, | ||
const uint8_t * | ciphertext, | ||
uint8_t * | session_key | ||
) |
Last step of key distribution. Decapsulates key on the initiator side.
[in] | saber | Saber algorithm context. If NULL , the fatal error occurs. |
[in] | secret_key | Secret key buffer ( saber_keygen ). Must point to array of uint8_t with elements count at least saber_get_initiator_secret_length . If NULL , the fatal error occurs. |
[in] | ciphertext | Encoded request from the responder. Must point to array of uint8_t , with elements count at least saber_get_ciphertext_length . If NULL , the fatal error occurs. |
[out] | session_key | Distributed key, equal to the key to be obtained on the responder side. Must point to array of uint8_t , with elements count at least saber_get_shared_secret_length . If NULL , the fatal error occurs. |
PQLR_API void saber_key_encap | ( | const saber_t | saber, |
const uint8_t * | public_key, | ||
uint8_t * | ciphertext, | ||
uint8_t * | session_key | ||
) |
Second step of key distribution. Encapsulates key on the responder side.
[in] | saber | Saber algorithm context. If NULL , the fatal error occurs. |
[in] | public_key | Public key buffer ( saber_keygen ). Must point to array of uint8_t with elements count at least saber_get_initiator_public_length . If NULL , the fatal error occurs. |
[out] | ciphertext | Encoded request from the responder. Must point to array of uint8_t , with elements count at least saber_get_ciphertext_length . If NULL , the fatal error occurs. |
[out] | session_key | Distributed key, equal to the key to be obtained on the initiator side. Must point to array of uint8_t , with elements count at least saber_get_shared_secret_length . If NULL , the fatal error occurs. |
Initial step of key distribution. Generates a key pair for key distribution initiator.
[in] | saber | Saber algorithm context. If NULL , the fatal error occurs. |
[out] | public_key | Public key buffer. Must point to array of uint8_t with elements count at least saber_get_initiator_public_length . If NULL , the fatal error occurs. |
[out] | secret_key | Secret key buffer. Must point to array of uint8_t with elements count at least saber_get_initiator_secret_length . If NULL , the fatal error occurs. |
PQLR_API saber_t saber_new | ( | saber_parameterset_t | parameterset | ) |
Creates saber instance initialized by parameterset.
[in] | parameterset | Saber configuration parameters set (see saber_parameterset_t for availible options). |
NULL
if out of memory