99/*
1010 * Specify which level of Merkle tree (the "layer") we're working on
1111 */
12- void set_layer_addr (uint32_t addr [8 ], uint32_t layer ) {
12+ void set_layer_addr (crypto_context * cctx , uint32_t addr [8 ], uint32_t layer ) {
1313 ((unsigned char * )addr )[SPX_OFFSET_LAYER ] = (unsigned char )layer ;
1414}
1515
1616/*
1717 * Specify which Merkle tree within the level (the "tree address") we're working
1818 * on
1919 */
20- void set_tree_addr (uint32_t addr [8 ], uint64_t tree ) {
20+ void set_tree_addr (crypto_context * cctx , uint32_t addr [8 ], uint64_t tree ) {
2121 ASSERT ((SPX_TREE_HEIGHT * (SPX_D - 1 )) <= 64 );
2222 ull_to_bytes (& ((unsigned char * )addr )[SPX_OFFSET_TREE ], 8 , tree );
2323}
@@ -28,15 +28,16 @@ void set_tree_addr(uint32_t addr[8], uint64_t tree) {
2828 * hashes don't accidentally get the same address structure. The type will be
2929 * one of the SPX_ADDR_TYPE constants
3030 */
31- void set_type (uint32_t addr [8 ], uint32_t type ) {
31+ void set_type (crypto_context * cctx , uint32_t addr [8 ], uint32_t type ) {
3232 ((unsigned char * )addr )[SPX_OFFSET_TYPE ] = (unsigned char )type ;
3333}
3434
3535/*
3636 * Copy the layer and tree fields of the address structure. This is used
3737 * when we're doing multiple types of hashes within the same Merkle tree
3838 */
39- void copy_subtree_addr (uint32_t out [8 ], const uint32_t in [8 ]) {
39+ void copy_subtree_addr (crypto_context * cctx , uint32_t out [8 ],
40+ const uint32_t in [8 ]) {
4041 memcpy (out , in , SPX_OFFSET_TREE + 8 );
4142}
4243
@@ -46,7 +47,8 @@ void copy_subtree_addr(uint32_t out[8], const uint32_t in[8]) {
4647 * Specify which Merkle leaf we're working on; that is, which OTS keypair
4748 * we're talking about.
4849 */
49- void set_keypair_addr (uint32_t addr [8 ], uint32_t keypair ) {
50+ void set_keypair_addr (crypto_context * cctx , uint32_t addr [8 ],
51+ uint32_t keypair ) {
5052 if (SPX_FULL_HEIGHT / SPX_D > 8 ) {
5153 /* We have > 256 OTS at the bottom of the Merkle tree; to specify */
5254 /* which one, we'd need to express it in two bytes */
@@ -60,7 +62,8 @@ void set_keypair_addr(uint32_t addr[8], uint32_t keypair) {
6062 * Copy the layer, tree and keypair fields of the address structure. This is
6163 * used when we're doing multiple things within the same OTS keypair
6264 */
63- void copy_keypair_addr (uint32_t out [8 ], const uint32_t in [8 ]) {
65+ void copy_keypair_addr (crypto_context * cctx , uint32_t out [8 ],
66+ const uint32_t in [8 ]) {
6467 memcpy (out , in , SPX_OFFSET_TREE + 8 );
6568 if (SPX_FULL_HEIGHT / SPX_D > 8 ) {
6669 ((unsigned char * )out )[SPX_OFFSET_KP_ADDR2 ] =
@@ -74,15 +77,15 @@ void copy_keypair_addr(uint32_t out[8], const uint32_t in[8]) {
7477 * Specify which Merkle chain within the OTS we're working with
7578 * (the chain address)
7679 */
77- void set_chain_addr (uint32_t addr [8 ], uint32_t chain ) {
80+ void set_chain_addr (crypto_context * cctx , uint32_t addr [8 ], uint32_t chain ) {
7881 ((unsigned char * )addr )[SPX_OFFSET_CHAIN_ADDR ] = (unsigned char )chain ;
7982}
8083
8184/*
8285 * Specify where in the Merkle chain we are
8386 * (the hash address)
8487 */
85- void set_hash_addr (uint32_t addr [8 ], uint32_t hash ) {
88+ void set_hash_addr (crypto_context * cctx , uint32_t addr [8 ], uint32_t hash ) {
8689 ((unsigned char * )addr )[SPX_OFFSET_HASH_ADDR ] = (unsigned char )hash ;
8790}
8891
@@ -92,14 +95,16 @@ void set_hash_addr(uint32_t addr[8], uint32_t hash) {
9295 * Specify the height of the node in the Merkle/FORS tree we are in
9396 * (the tree height)
9497 */
95- void set_tree_height (uint32_t addr [8 ], uint32_t tree_height ) {
98+ void set_tree_height (crypto_context * cctx , uint32_t addr [8 ],
99+ uint32_t tree_height ) {
96100 ((unsigned char * )addr )[SPX_OFFSET_TREE_HGT ] = (unsigned char )tree_height ;
97101}
98102
99103/*
100104 * Specify the distance from the left edge of the node in the Merkle/FORS tree
101105 * (the tree index)
102106 */
103- void set_tree_index (uint32_t addr [8 ], uint32_t tree_index ) {
107+ void set_tree_index (crypto_context * cctx , uint32_t addr [8 ],
108+ uint32_t tree_index ) {
104109 u32_to_bytes (& ((unsigned char * )addr )[SPX_OFFSET_TREE_INDEX ], tree_index );
105110}
0 commit comments