-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmini.h
More file actions
71 lines (57 loc) · 1.35 KB
/
mini.h
File metadata and controls
71 lines (57 loc) · 1.35 KB
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
#ifndef OTS_MINI_H
#define OTS_MINI_H
#include <stdbool.h>
#include "ots.h"
enum mini_res {
MINI_OK,
MINI_ERR_UPGRADED_NOT_FOUND,
MINI_ERR_PENDING_NOT_FOUND,
MINI_ERR_OTS_PARSE_FAILED,
};
enum mini_tag {
MINI_OP_SHA1 = 0x01,
MINI_OP_RIPEMD160 = 0x02,
MINI_OP_SHA256 = 0x03,
MINI_OP_KECCAK256 = 0x04,
MINI_OP_APPEND = 0x0A,
MINI_OP_PREPEND = 0x0B,
MINI_OP_REVERSE = 0x10,
MINI_OP_HEXLIFY = 0x11,
MINI_ATT_PEND = 0x1A,
MINI_ATT_UNK = 0x1B,
MINI_ATT_BTC = 0x1C,
MINI_ATT_LTC = 0x1D,
};
struct token_search {
bool done;
bool upgraded;
bool first_ts;
int end_header_index;
int tokindex;
int att_token_start_candidate;
int att_candidate_payload_size;
int att_payload_size;
int att_token_start;
};
struct mini_encoder {
struct encoder *encoder;
struct token_search *attest_loc;
bool strip_filehash;
bool has_ts;
};
struct mini_options {
bool upgraded;
bool strip_filehash;
struct crypto filehash;
};
struct mini_ots_encoder {
bool filehash_done;
struct encoder *encoder;
struct mini_options *options;
};
enum decoder_state parse_ots_mini(const u8 *buf, int len, ots_token_cb *cb,
void *user_data);
enum mini_res encode_ots_mini(struct mini_options *opts, const u8 *proof,
int prooflen, u8 *buf, int bufsize, int *outlen);
extern const unsigned char ots_mini_magic[3];
#endif /* OTS_MINI_H */