PQLR
Postquantum Crypto Library by QAPP
|
Typedefs | |
typedef struct kyber_st * | kyber_t |
Kyber algorithm instance handle. More... | |
Enumerations | |
enum | kyber_parameterset_t { kyber512 , kyber768 , kyber1024 , kyber_last } |
Possible kyber parameters sets. More... | |
Functions | |
PQLR_API kyber_t | kyber_new (kyber_parameterset_t parameterset) |
Creates kyber instance initialized by parameterset. More... | |
PQLR_API void | kyber_free (kyber_t kyber) |
Frees kyber instance and all corresponding resources. More... | |
PQLR_API uint32_t | kyber_get_initiator_public_length (kyber_t kyber) |
Obtains initiator's public key length for the current kyber instance. More... | |
PQLR_API uint32_t | kyber_get_initiator_secret_length (kyber_t kyber) |
Obtains initiator's secret key length for the current kyber instance. More... | |
PQLR_API uint32_t | kyber_get_ciphertext_length (kyber_t kyber) |
Obtains ciphertext length for the current kyber instance. More... | |
PQLR_API uint32_t | kyber_get_shared_secret_length (kyber_t kyber) |
Obtains shared secret length for the current kyber instance. More... | |
PQLR_API pqlr_t | kyber_to_pqlr (kyber_t kyber) |
Gets pqlr instance linked to this kyber instance. More... | |
PQLR_API kyber_t | kyber_duplicate (const kyber_t kyber) |
Duplicates context of kyber instance. More... | |
PQLR_API void | kyber_keygen (const kyber_t kyber, 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 | kyber_key_encap (const kyber_t kyber, const uint8_t *public_key, uint8_t *ciphertext, uint8_t *session_key) |
Key encapsulation. More... | |
PQLR_API void | kyber_key_decap (const kyber_t kyber, const uint8_t *secret_key, const uint8_t *ciphertext, uint8_t *session_key) |
Key decapsulation. More... | |
This module provides Kyber 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 kyber_keygen
Key distribution algorithm consists of sequential function calls on two sides: initiator (e.g. server side) and responder (e.g. client side).
public key
.public key
to responder.ciphertext
and session key
.session key
.session key
In order to use any Kyber key distribution functions, add the following include:
Example code is listed below:
typedef struct kyber_st* kyber_t |
Kyber algorithm instance handle.
enum kyber_parameterset_t |
Duplicates context of kyber instance.
kyber | instance to duplicate |
PQLR_API void kyber_key_decap | ( | const kyber_t | kyber, |
const uint8_t * | secret_key, | ||
const uint8_t * | ciphertext, | ||
uint8_t * | session_key | ||
) |
Key decapsulation.
kyber | Kyber algorithm context. If NULL , the fatal error occurs. | |
secret_key | Secret key buffer. Must point to array of uint8_t with elements count at least kyber_get_initiator_secret_length . If NULL , the fatal error occurs. (kyber_keygen) | |
ciphertext | Ciphertext buffer. Must point to array of uint8_t with elements count at least kyber_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 kyber_get_shared_secret_length . If NULL , the fatal error occurs. |
PQLR_API void kyber_key_encap | ( | const kyber_t | kyber, |
const uint8_t * | public_key, | ||
uint8_t * | ciphertext, | ||
uint8_t * | session_key | ||
) |
Key encapsulation.
kyber | Kyber algorithm context. If NULL , the fatal error occurs. | |
public_key | Public key buffer. Must point to array of uint8_t with elements count at least kyber_get_initiator_public_length . If NULL , the fatal error occurs. | |
[out] | ciphertext | Ciphertext buffer. Must point to array of uint8_t with elements count at least kyber_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 kyber_get_shared_secret_length . If NULL , the fatal error occurs. |
Initial step of key distribution. Generates a key pair for key distribution initiator.
kyber | Kyber 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 kyber_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 kyber_get_initiator_secret_length . If NULL , the fatal error occurs. |
PQLR_API kyber_t kyber_new | ( | kyber_parameterset_t | parameterset | ) |
Creates kyber instance initialized by parameterset.
parameterset | Kyber configuration parameters set (see kyber_parameterset_t for availible options). |
NULL
if out of memory Gets pqlr instance linked to this kyber instance.
kyber | initialized kyber instance |
NULL
if kyber is NULL