forked from kj3moraes/further-testing-xmss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmss_core.h
84 lines (78 loc) · 3.63 KB
/
xmss_core.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef XMSS_CORE_H
#define XMSS_CORE_H
#include "params.h"
/**
* Given a set of parameters, this function returns the size of the secret key.
* This is implementation specific, as varying choices in tree traversal will
* result in varying requirements for state storage.
*
* This function handles both XMSS and XMSSMT parameter sets.
*/
unsigned long long xmss_xmssmt_core_sk_bytes(const xmss_params *params);
/*
* Generates a XMSS key pair for a given parameter set.
* Format sk: [(32bit) index || SK_SEED || SK_PRF || PUB_SEED || root]
* Format pk: [root || PUB_SEED], omitting algorithm OID.
*/
int xmss_core_keypair(const xmss_params *params,
unsigned char *pk, unsigned char *sk);
int xmss_core_keypair_mp(const xmss_params *params,
unsigned char *pk, unsigned char *sk);
/**
* Signs a message. Returns an array containing the signature followed by the
* message and an updated secret key.
*/
int xmss_core_sign(const xmss_params *params,
unsigned char *sk,
unsigned char *sm, unsigned long long *smlen,
const unsigned char *m, unsigned long long mlen);
int xmss_core_sign_mp(const xmss_params *params,
unsigned char *sk,
unsigned char *sm, unsigned long long *smlen,
const unsigned char *m, unsigned long long mlen);
/**
* Verifies a given message signature pair under a given public key.
* Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
*/
int xmss_core_sign_open(const xmss_params *params,
unsigned char *m, unsigned long long *mlen,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk);
int xmss_core_sign_open_mp(const xmss_params *params,
unsigned char *m, unsigned long long *mlen,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk);
/*
* Generates a XMSSMT key pair for a given parameter set.
* Format sk: [(ceil(h/8) bit) index || SK_SEED || SK_PRF || PUB_SEED || root]
* Format pk: [root || PUB_SEED] omitting algorithm OID.
*/
int xmssmt_core_keypair(const xmss_params *params,
unsigned char *pk, unsigned char *sk);
int xmssmt_core_keypair_mp(const xmss_params *params,
unsigned char *pk, unsigned char *sk);
/**
* Signs a message. Returns an array containing the signature followed by the
* message and an updated secret key.
*/
int xmssmt_core_sign(const xmss_params *params,
unsigned char *sk,
unsigned char *sm, unsigned long long *smlen,
const unsigned char *m, unsigned long long mlen);
int xmssmt_core_sign_mp(const xmss_params *params,
unsigned char *sk,
unsigned char *sm, unsigned long long *smlen,
const unsigned char *m, unsigned long long mlen);
/**
* Verifies a given message signature pair under a given public key.
* Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
*/
int xmssmt_core_sign_open(const xmss_params *params,
unsigned char *m, unsigned long long *mlen,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk);
int xmssmt_core_sign_open_mp(const xmss_params *params,
unsigned char *m, unsigned long long *mlen,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk);
#endif