PQLR
Postquantum Crypto Library by QAPP
dsa.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <pqlr/common/alg.h>
4 
5 #include <stddef.h>
6 #include <stdlib.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif // __cplusplus
11 
41 typedef struct pqlr_dsa_st* pqlr_dsa;
42 
52 
65 PQLR_API size_t pqlr_dsa_get_algs(const char** algs, size_t count);
66 
77 
86 
95 
106 
117 
128 
145 PQLR_API int pqlr_dsa_keygen(const pqlr_dsa dsa, uint8_t* sk, uint8_t* pk);
146 
147 
174  const pqlr_dsa dsa,
175  const uint8_t* sk,
176  const uint8_t* msg,
177  size_t msg_len,
178  uint8_t* result_sig,
179  size_t* sig_len);
180 
204  const pqlr_dsa dsa,
205  const uint8_t* pk,
206  const uint8_t* sig,
207  size_t sig_len,
208  const uint8_t* msg,
209  size_t msg_len);
210 
215 #ifdef __cplusplus
216 } // extern "C"
217 #endif // __cplusplus
#define PQLR_API
Definition: api.h:22
struct pqlr_alg_st * pqlr_alg
PQLR algorithm instance handle.
Definition: alg.h:32
PQLR_API size_t pqlr_dsa_get_public_key_bytes_len(const pqlr_dsa dsa)
Obtains public key buffer length in bytes for current pqlr_dsa instance.
PQLR_API size_t pqlr_dsa_get_signature_bytes_len(const pqlr_dsa dsa)
Obtains signature buffer length in bytes for current pqlr_dsa instance.
PQLR_API size_t pqlr_dsa_get_algs(const char **algs, size_t count)
Fills the provided buffer with names of available DSA algorithms.
PQLR_API pqlr_dsa pqlr_dsa_duplicate(const pqlr_dsa src)
Duplicates context copying all related resources.
PQLR_API size_t pqlr_dsa_get_secret_key_bytes_len(const pqlr_dsa dsa)
Obtains secret key buffer length in bytes for current pqlr_dsa instance.
PQLR_API void pqlr_dsa_free(pqlr_dsa dsa)
Frees pqlr_dsa instance and all corresponding resources.
struct pqlr_dsa_st * pqlr_dsa
PQLR DSA instance handle.
Definition: dsa.h:41
PQLR_API int pqlr_dsa_keygen(const pqlr_dsa dsa, uint8_t *sk, uint8_t *pk)
Generates random secret key and public key for given context.
PQLR_API size_t pqlr_dsa_num_algs(void)
Obtains the number of available PQLR DSA algorithms.
PQLR_API int pqlr_dsa_verify(const pqlr_dsa 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 pqlr_dsa pqlr_dsa_new(const pqlr_alg alg)
Creates new pqlr_dsa instance with selected parameter set.
PQLR_API int pqlr_dsa_sign(const pqlr_dsa dsa, const uint8_t *sk, 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.