PQLR
Postquantum Crypto Library by QAPP
ml_dsa.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 ml_dsa_st* ml_dsa_t;
60 
71 
80 
88 
101 
112 
123 
134 
152  const ml_dsa_t ml_dsa, uint8_t* result_sk, uint8_t* result_pk);
153 
176  const ml_dsa_t ml_dsa,
177  const uint8_t* sk,
178  const uint8_t* msg,
179  size_t msg_len,
180  uint8_t* result_sig,
181  size_t* result_sig_len);
182 
210  const ml_dsa_t ml_dsa,
211  const uint8_t* sk,
212  const uint8_t* ctx,
213  size_t ctx_len,
214  const uint8_t* msg,
215  size_t msg_len,
216  uint8_t* result_sig,
217  size_t* result_sig_len);
218 
219 
243  const ml_dsa_t ml_dsa,
244  const uint8_t* pk,
245  const uint8_t* sig,
246  size_t sig_len,
247  const uint8_t* msg,
248  size_t msg_len);
249 
278  const ml_dsa_t ml_dsa,
279  const uint8_t* pk,
280  const uint8_t* sig,
281  size_t sig_len,
282  const uint8_t* ctx,
283  size_t ctx_len,
284  const uint8_t* msg,
285  size_t msg_len);
286  // Close the group
288 
289 #ifdef __cplusplus
290 } // extern "C"
291 #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
struct ml_dsa_st * ml_dsa_t
ML-DSA algorithm instance handle.
Definition: ml_dsa.h:59
PQLR_API size_t ml_dsa_get_signature_bytes_len(ml_dsa_t ml_dsa)
Obtains signature buffer length in bytes for current ml_dsa instance.
ml_dsa_parameterset_t
Possible ml_dsa parameters sets.
Definition: ml_dsa.h:44
PQLR_API int ml_dsa_verify(const ml_dsa_t ml_dsa, 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.
PQLR_API void ml_dsa_free(ml_dsa_t ml_dsa)
Frees ml_dsa instance and all corresponding resources.
PQLR_API size_t ml_dsa_get_secret_key_bytes_len(const ml_dsa_t ml_dsa)
Obtains secret key buffer length in bytes for current ml_dsa instance.
PQLR_API void ml_dsa_sign_ex(const ml_dsa_t ml_dsa, const uint8_t *sk, const uint8_t *ctx, size_t ctx_len, 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 ml_dsa_t ml_dsa_duplicate(const ml_dsa_t ml_dsa)
Duplicates context of ml_dsa instance.
PQLR_API int ml_dsa_verify_ex(const ml_dsa_t ml_dsa, const uint8_t *pk, const uint8_t *sig, size_t sig_len, const uint8_t *ctx, size_t ctx_len, const uint8_t *msg, size_t msg_len)
Verifies that given signature is the signature of given message (extended version).
PQLR_API void ml_dsa_generate_keys(const ml_dsa_t ml_dsa, uint8_t *result_sk, uint8_t *result_pk)
Generates random secret key and public key for given context.
PQLR_API pqlr_t ml_dsa_to_pqlr(ml_dsa_t ml_dsa)
Gets pqlr instance linked to this ml_dsa instance.
PQLR_API ml_dsa_t ml_dsa_new(ml_dsa_parameterset_t parameterset)
Creates new ml_dsa instance with selected parameter set.
PQLR_API void ml_dsa_sign(const ml_dsa_t ml_dsa, 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 size_t ml_dsa_get_public_key_bytes_len(const ml_dsa_t ml_dsa)
Obtains public key buffer length in bytes for current ml_dsa instance.
@ ml_dsa_last
Definition: ml_dsa.h:51
@ ml_dsa_87
Definition: ml_dsa.h:47
@ ml_dsa_87_r
Definition: ml_dsa.h:50
@ ml_dsa_44_r
Definition: ml_dsa.h:48
@ ml_dsa_65
Definition: ml_dsa.h:46
@ ml_dsa_65_r
Definition: ml_dsa.h:49
@ ml_dsa_44
Definition: ml_dsa.h:45