PQLR
Postquantum Crypto Library by QAPP
saber.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <pqlr/common/pqlr.h>
4 #include <pqlr/common/api.h>
5 
6 #include <stdint.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif // __cplusplus
11 
53 typedef enum {
59 
65 typedef struct saber_st* saber_t;
66 
78 PQLR_API saber_t saber_new(saber_parameterset_t parameterset);
79 
87 PQLR_API void saber_free(saber_t saber);
88 
96 PQLR_API saber_t saber_duplicate(const saber_t saber);
97 
106 PQLR_API uint32_t saber_get_initiator_public_length(saber_t saber);
107 
116 PQLR_API uint32_t saber_get_initiator_secret_length(saber_t saber);
117 
126 PQLR_API uint32_t saber_get_ciphertext_length(saber_t saber);
127 
136 PQLR_API uint32_t saber_get_shared_secret_length(saber_t saber);
137 
148 PQLR_API pqlr_t saber_to_pqlr(saber_t saber);
149 
168  const saber_t saber, uint8_t* public_key, uint8_t* secret_key);
169 
192  const saber_t saber,
193  const uint8_t* public_key,
194  uint8_t* ciphertext,
195  uint8_t* session_key);
196 
216  const saber_t saber,
217  const uint8_t* secret_key,
218  const uint8_t* ciphertext,
219  uint8_t* session_key);
220 
221 #ifdef __cplusplus
222 } // extern "C"
223 #endif //__cplusplus
224 
Definition: saber.h:56
PQLR_API saber_t saber_duplicate(const saber_t saber)
duplicates context of saber algorithm
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.
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.
PQLR_API void saber_free(saber_t saber)
Frees saber instance and all corresponding resources.
struct saber_st * saber_t
Saber algorithm instance handle.
Definition: saber.h:65
PQLR_API uint32_t saber_get_initiator_secret_length(saber_t saber)
Obtains initiator&#39;s secret key length for the current saber instance.
PQLR_API uint32_t saber_get_shared_secret_length(saber_t saber)
Obtains shared secret (key) length for the current saber instance.
#define PQLR_API
Definition: api.h:22
PQLR_API saber_t saber_new(saber_parameterset_t parameterset)
Creates saber instance initialized by parameterset.
struct pqlr_st * pqlr_t
Pqlr instance handle. Pqlr represents basic library and it&#39;s algorithms configuration. There are singleton instance which could be obtained by pqlr_singleton_instance and local instances which could be obtained from concrete algorithms instances. At the initialization point all the algorithms inherit pqlr&#39;s singleton instance state. Any change in the global configuration does not affect previously created algorithms.
Definition: pqlr.h:26
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.
PQLR_API pqlr_t saber_to_pqlr(saber_t saber)
Casts saber instance to pqlr instance.
PQLR_API uint32_t saber_get_ciphertext_length(saber_t saber)
Obtains ciphertext (request) length for the current saber instance.
Definition: saber.h:55
PQLR_API uint32_t saber_get_initiator_public_length(saber_t saber)
Obtains initiator&#39;s public key length for the current saber instance.
Definition: saber.h:57
Definition: saber.h:54
saber_parameterset_t
Possible saber parameters sets.
Definition: saber.h:53