PQLR
Postquantum Crypto Library by QAPP
newhope.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "params.h"
4 #include <pqlr/common/pqlr.h>
5 #include <pqlr/common/api.h>
6 
7 #include <stdint.h>
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif // __cplusplus
12 
52 typedef enum {
56 
62 typedef struct newhope_st* newhope_t;
63 
76 
85 
93 
103 
113 
123 
134 
146 
166  const newhope_t newhope, uint8_t* public_key, uint8_t* secret_key);
167 
190  const newhope_t newhope,
191  const uint8_t* public_key,
192  uint8_t* ciphertext,
193  uint8_t* session_key);
194 
213  const newhope_t newhope,
214  const uint8_t* secret_key,
215  const uint8_t* ciphertext,
216  uint8_t* key);
217 
218 
219 #ifdef __cplusplus
220 } // extern "C"
221 #endif //__cplusplus
222 
#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
newhope_parameterset_t
Possible newhope parameters sets.
Definition: newhope.h:52
PQLR_API uint32_t newhope_get_ciphertext_length(newhope_t newhope)
Obtains encoded reply length for current 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.
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:62
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)
Casts newhope instance to pqlr 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:53
@ newhope_last
Definition: newhope.h:54