-
Notifications
You must be signed in to change notification settings - Fork 45
/
xmss.h
61 lines (54 loc) · 2.09 KB
/
xmss.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
#ifndef XMSS_H
#define XMSS_H
#include <stdint.h>
/**
* Generates a XMSS key pair for a given parameter set.
* Format sk: [OID || (32bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
* Format pk: [OID || root || PUB_SEED]
*/
int xmss_keypair(unsigned char *pk, unsigned char *sk, const uint32_t oid);
/**
* Signs a message using an XMSS secret key.
* Returns
* 1. an array containing the signature followed by the message AND
* 2. an updated secret key!
*/
int xmss_sign(unsigned char *sk,
unsigned char *sm, unsigned long long *smlen,
const unsigned char *m, unsigned long long mlen);
/**
* Verifies a given message signature pair using a given public key.
*
* Note: m and mlen are pure outputs which carry the message in case
* verification succeeds. The (input) message is assumed to be contained in sm
* which has the form [signature || message].
*/
int xmss_sign_open(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: [OID || (ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
* Format pk: [OID || root || PUB_SEED]
*/
int xmssmt_keypair(unsigned char *pk, unsigned char *sk, const uint32_t oid);
/**
* Signs a message using an XMSSMT secret key.
* Returns
* 1. an array containing the signature followed by the message AND
* 2. an updated secret key!
*/
int xmssmt_sign(unsigned char *sk,
unsigned char *sm, unsigned long long *smlen,
const unsigned char *m, unsigned long long mlen);
/**
* Verifies a given message signature pair using a given public key.
*
* Note: m and mlen are pure outputs which carry the message in case
* verification succeeds. The (input) message is assumed to be contained in sm
* which has the form [signature || message].
*/
int xmssmt_sign_open(unsigned char *m, unsigned long long *mlen,
const unsigned char *sm, unsigned long long smlen,
const unsigned char *pk);
#endif