mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-27 01:41:40 +00:00
62 lines
4.1 KiB
C
62 lines
4.1 KiB
C
|
#include <stdint.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
#include "address.h"
|
||
|
#include "hashx8.h"
|
||
|
#include "params.h"
|
||
|
#include "sha256.h"
|
||
|
#include "sha256avx.h"
|
||
|
#include "sha256x8.h"
|
||
|
#include "utils.h"
|
||
|
|
||
|
/*
|
||
|
* 8-way parallel version of prf_addr; takes 8x as much input and output
|
||
|
*/
|
||
|
void PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_prf_addrx8(unsigned char *out0,
|
||
|
unsigned char *out1,
|
||
|
unsigned char *out2,
|
||
|
unsigned char *out3,
|
||
|
unsigned char *out4,
|
||
|
unsigned char *out5,
|
||
|
unsigned char *out6,
|
||
|
unsigned char *out7,
|
||
|
const unsigned char *key,
|
||
|
const uint32_t addrx8[8 * 8]) {
|
||
|
unsigned char bufx8[8 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES)];
|
||
|
unsigned char outbufx8[8 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES];
|
||
|
unsigned int j;
|
||
|
|
||
|
for (j = 0; j < 8; j++) {
|
||
|
memcpy(bufx8 + j * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES), key, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_compress_address(bufx8 + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + j * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
addrx8 + j * 8);
|
||
|
}
|
||
|
|
||
|
PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_sha256x8(outbufx8 + 0 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES,
|
||
|
outbufx8 + 1 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES,
|
||
|
outbufx8 + 2 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES,
|
||
|
outbufx8 + 3 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES,
|
||
|
outbufx8 + 4 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES,
|
||
|
outbufx8 + 5 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES,
|
||
|
outbufx8 + 6 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES,
|
||
|
outbufx8 + 7 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES,
|
||
|
bufx8 + 0 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
bufx8 + 1 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
bufx8 + 2 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
bufx8 + 3 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
bufx8 + 4 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
bufx8 + 5 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
bufx8 + 6 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
bufx8 + 7 * (PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES),
|
||
|
PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N + PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_ADDR_BYTES);
|
||
|
|
||
|
memcpy(out0, outbufx8 + 0 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
memcpy(out1, outbufx8 + 1 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
memcpy(out2, outbufx8 + 2 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
memcpy(out3, outbufx8 + 3 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
memcpy(out4, outbufx8 + 4 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
memcpy(out5, outbufx8 + 5 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
memcpy(out6, outbufx8 + 6 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
memcpy(out7, outbufx8 + 7 * PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_SHA256_OUTPUT_BYTES, PQCLEAN_SPHINCSSHA256128FSIMPLE_AVX2_N);
|
||
|
}
|