-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslh_dsa.h
69 lines (53 loc) · 1.83 KB
/
slh_dsa.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// slh_dsa.h
// ((Anonymized)). See LICENSE.
// === FIPS 205 (ipd) Stateless Hash-Based Digital Signature Standard.
#ifndef _SLH_DSA_H_
#define _SLH_DSA_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
typedef struct slh_param_s slh_param_t;
// === SLH-DSA parameter sets
extern const slh_param_t slh_dsa_sha2_128s;
extern const slh_param_t slh_dsa_shake_128s;
extern const slh_param_t slh_dsa_sha2_128f;
extern const slh_param_t slh_dsa_shake_128f;
extern const slh_param_t slh_dsa_sha2_192s;
extern const slh_param_t slh_dsa_shake_192s;
extern const slh_param_t slh_dsa_sha2_192f;
extern const slh_param_t slh_dsa_shake_192f;
extern const slh_param_t slh_dsa_sha2_256s;
extern const slh_param_t slh_dsa_shake_256s;
extern const slh_param_t slh_dsa_sha2_256f;
extern const slh_param_t slh_dsa_shake_256f;
// === API
// Return standard identifier string for parameter set *prm, or NULL.
const char *slh_alg_id(const slh_param_t *prm);
// Return public (verification) key size in bytes for parameter set *prm.
size_t slh_pk_sz(const slh_param_t *prm);
// Return private (signing) key size in bytes for parameter set *prm.
size_t slh_sk_sz(const slh_param_t *prm);
// Return signature size in bytes for parameter set *prm.
size_t slh_sig_sz(const slh_param_t *prm);
// Generate an SLH-DSA key pair.
int slh_keygen( uint8_t *pk, uint8_t *sk,
int (*rbg)(uint8_t *x, size_t xlen),
const slh_param_t *prm);
// Generate a SLH-DSA signature.
size_t slh_sign(uint8_t *sig,
const uint8_t *m, size_t m_sz,
const uint8_t *sk,
int (*rbg)(uint8_t *x, size_t xlen),
const slh_param_t *prm);
// Verify an SLH-DSA signature.
bool slh_verify(const uint8_t *m, size_t m_sz,
const uint8_t *sig, const uint8_t *pk,
const slh_param_t *prm);
#ifdef __cplusplus
}
#endif
// _SLH_DSA_H_
#endif