PQLR
Postquantum Crypto Library by QAPP
dilithium.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 #include "stddef.h"
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif // __cplusplus
12 
44 typedef enum {
53 
59 typedef struct dilithium_st* dilithium_t;
60 
71 
80 
88 
100 
111 
122 
133 
151  const dilithium_t dilithium, uint8_t* result_sk, uint8_t* result_pk);
152 
175  const dilithium_t dilithium,
176  const uint8_t* sk,
177  const uint8_t* msg,
178  size_t msg_len,
179  uint8_t* result_sig,
180  size_t* result_sig_len);
181 
205  const dilithium_t dilithium,
206  const uint8_t* pk,
207  const uint8_t* sig,
208  size_t sig_len,
209  const uint8_t* msg,
210  size_t msg_len);
211  // Close the group
213 
214 #ifdef __cplusplus
215 } // extern "C"
216 #endif //__cplusplus
#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 int dilithium_verify(const dilithium_t dilithium, const uint8_t *pk, const uint8_t *sig, size_t sig_len, const uint8_t *msg, size_t msg_len)
Verifies that given signature is the signature of given message.
struct dilithium_st * dilithium_t
Dilithium algorithm instance handle.
Definition: dilithium.h:59
PQLR_API dilithium_t dilithium_new(dilithium_parameterset_t parameterset)
Creates new dilithium instance with selected parameter set.
PQLR_API void dilithium_free(dilithium_t dilithium)
Frees dilithium instance and all corresponding resources.
PQLR_API size_t dilithium_get_signature_bytes_len(dilithium_t dilithium)
Obtains signature buffer length in bytes for current dilithium instance.
PQLR_API pqlr_t dilithium_to_pqlr(dilithium_t dilithium)
Casts dilithium instance to pqlr instance.
PQLR_API void dilithium_generate_keys(const dilithium_t dilithium, uint8_t *result_sk, uint8_t *result_pk)
Generates random secret key and public key for given context.
PQLR_API void dilithium_sign(const dilithium_t dilithium, const uint8_t *sk, const uint8_t *msg, size_t msg_len, uint8_t *result_sig, size_t *result_sig_len)
Generates signature for given message according to context and secret key.
PQLR_API dilithium_t dilithium_duplicate(const dilithium_t dilithium)
Duplicates context of dilithium instance.
dilithium_parameterset_t
Possible dilithium parameters sets.
Definition: dilithium.h:44
PQLR_API size_t dilithium_get_public_key_bytes_len(const dilithium_t dilithium)
Obtains public key buffer length in bytes for current dilithium instance.
PQLR_API size_t dilithium_get_secret_key_bytes_len(const dilithium_t dilithium)
Obtains secret key buffer length in bytes for current dilithium instance.
@ dilithium_5_r
Definition: dilithium.h:50
@ dilithium_3
Definition: dilithium.h:46
@ dilithium_2_r
Definition: dilithium.h:48
@ dilithium_last
Definition: dilithium.h:51
@ dilithium_5
Definition: dilithium.h:47
@ dilithium_2
Definition: dilithium.h:45
@ dilithium_3_r
Definition: dilithium.h:49