1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-30 03:11:43 +00:00
pqcrypto/crypto_sign/sphincs-sha256-128s-simple/avx2/utilsx8.h
Thom Wiggers facb527c7c SPHINCS+ optimized implementations (#253)
* Add state destroy to SHA2 API

* Include optimized SPHINCS+ implementations

I've generated new implementations from the sphincsplus repository.

* Don't destroy sha256ctx after finalize

* Attempt to shut up MSVC

* Make sure to drop errors in rmtree
2021-03-24 21:02:45 +00:00

47 lines
1.7 KiB
C

#ifndef PQCLEAN_SPHINCSSHA256128SSIMPLE_AVX2_UTILSX8_H
#define PQCLEAN_SPHINCSSHA256128SSIMPLE_AVX2_UTILSX8_H
#include <stdint.h>
#include "hash_state.h"
#include "params.h"
/**
* For a given leaf index, computes the authentication path and the resulting
* root node using Merkle's TreeHash algorithm.
* Expects the layer and tree parts of the tree_addr to be set, as well as the
* tree type (i.e. PQCLEAN_SPHINCSSHA256128SSIMPLE_AVX2_ADDR_TYPE_HASHTREE or PQCLEAN_SPHINCSSHA256128SSIMPLE_AVX2_ADDR_TYPE_FORSTREE).
* Applies the offset idx_offset to indices before building addresses, so that
* it is possible to continue counting indices across trees.
*/
void PQCLEAN_SPHINCSSHA256128SSIMPLE_AVX2_treehashx8_FORS_HEIGHT(
unsigned char *rootx8, unsigned char *auth_pathx8,
const unsigned char *sk_seed, const unsigned char *pub_seed,
const uint32_t leaf_idx[8], uint32_t idx_offset[8],
void (*gen_leafx8)(
unsigned char * /* leaf0 */,
unsigned char * /* leaf1 */,
unsigned char * /* leaf2 */,
unsigned char * /* leaf3 */,
unsigned char * /* leaf4 */,
unsigned char * /* leaf5 */,
unsigned char * /* leaf6 */,
unsigned char * /* leaf7 */,
const unsigned char * /* sk_seed */,
const unsigned char * /* pub_seed */,
uint32_t /* addr_idx0 */,
uint32_t /* addr_idx1 */,
uint32_t /* addr_idx2 */,
uint32_t /* addr_idx3 */,
uint32_t /* addr_idx4 */,
uint32_t /* addr_idx5 */,
uint32_t /* addr_idx6 */,
uint32_t /* addr_idx7 */,
const uint32_t[8] /* tree_addr */,
const hash_state * /* state_seeded */),
uint32_t tree_addrx8[8 * 8],
const hash_state *state_seeded);
#endif