PQLR
Postquantum Crypto Library by QAPP
newhope.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 
51 typedef enum {
55 
61 typedef struct newhope_st* newhope_t;
62 
75 
84 
92 
102 
112 
122 
133 
146 
166  const newhope_t newhope, uint8_t* public_key, uint8_t* secret_key);
167 
192  const newhope_t newhope,
193  const uint8_t* public_key,
194  uint8_t* ciphertext,
195  uint8_t* session_key);
196 
219  const newhope_t newhope,
220  const uint8_t* secret_key,
221  const uint8_t* ciphertext,
222  uint8_t* session_key);
223 
224 
225 #ifdef __cplusplus
226 } // extern "C"
227 #endif //__cplusplus
228 
#define PQLR_API
Definition: api.h:22
struct pqlr_st * pqlr_t
Pqlr instance handle. Pqlr represents basic library and it's algorithms configuration....
Definition: pqlr.h:26
PQLR_API void newhope_key_decap(const newhope_t newhope, const uint8_t *secret_key, const uint8_t *ciphertext, uint8_t *session_key)
Last step of key distribution. Generates symmetric secret key on initiator side.
newhope_parameterset_t
Possible newhope parameters sets.
Definition: newhope.h:51
PQLR_API uint32_t newhope_get_ciphertext_length(newhope_t newhope)
Obtains encoded reply length for current newhope instance.
PQLR_API newhope_t newhope_new(newhope_parameterset_t parameterset)
Creates newhope instance initialized by parameterset.
struct newhope_st * newhope_t
Newhope algorithm instance handle.
Definition: newhope.h:61
PQLR_API uint32_t newhope_get_initiator_public_length(newhope_t newhope)
Obtains initiator's public key length for current newhope instance.
PQLR_API uint32_t newhope_get_shared_secret_length(newhope_t newhope)
Obtains number of symmetric secret key bytes for current newhope instance.
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 init...
PQLR_API void newhope_free(newhope_t newhope)
Frees newhope instance and all corresponding resources.
PQLR_API pqlr_t newhope_to_pqlr(newhope_t newhope)
Gets pqlr instance linked to this newhope instance.
PQLR_API newhope_t newhope_duplicate(const newhope_t newhope)
Duplicates context of newhope instance.
PQLR_API uint32_t newhope_get_initiator_secret_length(newhope_t newhope)
Obtains initiator's secret length for current newhope instance.
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_1024
1024 bytes secret length
Definition: newhope.h:52
@ newhope_last
Definition: newhope.h:53