-
Notifications
You must be signed in to change notification settings - Fork 34
/
hss_aux.h
59 lines (47 loc) · 2 KB
/
hss_aux.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
#if !defined( HSS_AUX_H_ )
#define HSS_AUX_H_
/*
* This is the internal API to the subsystem that deals with aux data
* This should not be included by files outside this subsystem
*/
#include "common_defs.h"
#include <stdlib.h>
#include <stdint.h>
struct hss_working_key;
/* This is a bitmap that lists which aux levels we have */
typedef uint_fast32_t aux_level_t;
/* This is the expanded version of the aux data */
struct expanded_aux_data {
unsigned char *data[ MAX_MERKLE_HEIGHT+1 ];
};
/*
* These are some internal routines that handle aux data
*/
/* Internal function used to compute the optimal aux level */
aux_level_t hss_optimal_aux_level( size_t max_length,
const param_set_t *lm_type,
const param_set_t *lm_ots_type,
size_t *actual_len );
/* Generate pointers into a saved aux data */
/* If w is provided, we do sanity checking on the data within aux_data */
struct expanded_aux_data *hss_expand_aux_data( const unsigned char *aux_data,
size_t len_aux_data,
struct expanded_aux_data *temp, unsigned size_hash,
struct hss_working_key *w );
/*
* Save the marker within the aux data
*/
void hss_store_aux_marker( unsigned char *aux_data, aux_level_t aux_level );
/* Save an intermediate node */
void hss_save_aux_data( struct expanded_aux_data *data, unsigned level,
unsigned size_hash, merkle_index_t q,
const unsigned char *cur_val );
/* Do the final touches on the aux data */
void hss_finalize_aux_data(struct expanded_aux_data *data,
unsigned size_hash, unsigned hash,
const unsigned char *seed);
/* Get a set of intermediate nodes from the aux data */
bool hss_extract_aux_data(const struct expanded_aux_data *aux, unsigned level,
const struct hss_working_key *w, unsigned char *dest,
merkle_index_t node_offset, merkle_index_t node_count);
#endif /* HSS_AUX_H_ */