PQLR
Postquantum Crypto Library by QAPP
slh_dsa.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "params.h"
4 
5 #include <pqlr/common/pqlr.h>
6 #include <pqlr/common/api.h>
7 
8 #include <stdint.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif // __cplusplus
13 
14 #define MAX_SLH_DSA_CTX_LEN 255
15 
16 
61 typedef struct slh_dsa_st* slh_dsa_t;
62 
74 
83 
93 
106 
117 
128 
139 
156  const slh_dsa_t slh_dsa, uint8_t* result_sk, uint8_t* result_pk);
157 
158 
183  const slh_dsa_t slh_dsa,
184  const uint8_t* sk,
185  const uint8_t* msg,
186  size_t msg_len,
187  uint8_t* result_sig,
188  size_t* result_sig_len);
189 
214  const slh_dsa_t slh_dsa,
215  const uint8_t* sk,
216  const uint8_t* ctx,
217  size_t ctx_len,
218  const uint8_t* msg,
219  size_t msg_len,
220  uint8_t* result_sig,
221  size_t* sig_len);
222 
246  const slh_dsa_t slh_dsa,
247  const uint8_t* pk,
248  const uint8_t* sig,
249  size_t sig_len,
250  const uint8_t* msg,
251  size_t msg_len);
252 
278  const slh_dsa_t slh_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 
291 #ifdef __cplusplus
292 } // extern "C"
293 #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
slh_dsa_parameterset_t
Parameter set.
Definition: params.h:42
PQLR_API int slh_dsa_verify_ex(const slh_dsa_t slh_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 with additional context information.
PQLR_API void slh_dsa_generate_keys(const slh_dsa_t slh_dsa, uint8_t *result_sk, uint8_t *result_pk)
Generates random secret key and public key for given context.
PQLR_API void slh_dsa_free(slh_dsa_t slh_dsa)
Frees slh_dsa instance and all corresponding resources.
PQLR_API void slh_dsa_sign(const slh_dsa_t slh_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. The signature is non-deter...
PQLR_API int slh_dsa_verify(const slh_dsa_t slh_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 slh_dsa_sign_ex(const slh_dsa_t slh_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 *sig_len)
Generates signature for given message according to context and secret key. The signature is non-deter...
PQLR_API size_t slh_dsa_get_public_key_bytes_len(slh_dsa_t slh_dsa)
Obtains public key buffer length in bytes for current slh_dsa instance.
struct slh_dsa_st * slh_dsa_t
slh_dsa algorithm instance handle
Definition: slh_dsa.h:61
PQLR_API pqlr_t slh_dsa_to_pqlr(slh_dsa_t slh_dsa)
Gets pqlr instance linked to this slh_dsa instance.
PQLR_API slh_dsa_t slh_dsa_new(slh_dsa_parameterset_t parameterset)
Creates new slh_dsa instance with selected parameter set.
PQLR_API slh_dsa_t slh_dsa_duplicate(const slh_dsa_t slh_dsa)
Duplicates slh_dsa context.
PQLR_API size_t slh_dsa_get_signature_bytes_len(slh_dsa_t slh_dsa)
Obtains signature buffer length in bytes for current slh_dsa instance.
PQLR_API size_t slh_dsa_get_secret_key_bytes_len(slh_dsa_t slh_dsa)
Obtains secret key buffer length in bytes for current slh_dsa instance.