PQLR
Postquantum Crypto Library
 
Loading...
Searching...
No Matches
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
9extern "C" {
10#endif // __cplusplus
11
41typedef struct pqlr_dsa_st* pqlr_dsa;
42
52
69PQLR_API size_t pqlr_dsa_get_algs(const char** algs, size_t count);
70
81
90
99
110
121
132
149PQLR_API int pqlr_dsa_keygen(const pqlr_dsa dsa, uint8_t* sk, uint8_t* pk);
150
151
178 const pqlr_dsa dsa,
179 const uint8_t* sk,
180 const uint8_t* msg,
181 size_t msg_len,
182 uint8_t* result_sig,
183 size_t* sig_len);
184
208 const pqlr_dsa dsa,
209 const uint8_t* pk,
210 const uint8_t* sig,
211 size_t sig_len,
212 const uint8_t* msg,
213 size_t msg_len);
214
219#ifdef __cplusplus
220} // extern "C"
221#endif // __cplusplus
#define PQLR_API
Definition api.h:22
struct pqlr_alg_st * pqlr_alg
PQLR algorithm instance handle.
Definition alg.h:40
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.