Port SPHINCS+-SHAKE256 to fips202 ctx structs

这个提交包含在:
Thom Wiggers 2019-05-20 10:38:31 +02:00
父节点 98002329ad
当前提交 692fba119c
找不到此签名对应的密钥
GPG 密钥 ID: 001BB0A7CE26E363
共有 12 个文件被更改,包括 168 次插入168 次删除

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256128FROBUST_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256128FROBUST_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256128FSIMPLE_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256128FSIMPLE_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256128SROBUST_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256128SSIMPLE_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256128SSIMPLE_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256192FROBUST_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256192FROBUST_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256192FSIMPLE_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256192FSIMPLE_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256192SROBUST_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256192SROBUST_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256192SSIMPLE_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256192SSIMPLE_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256256FROBUST_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256256FROBUST_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256256FSIMPLE_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256256FSIMPLE_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256256SROBUST_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256256SROBUST_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;

查看文件

@ -37,14 +37,14 @@ void PQCLEAN_SPHINCSSHAKE256256SSIMPLE_CLEAN_gen_message_random(
unsigned char *R, unsigned char *R,
const unsigned char *sk_prf, const unsigned char *optrand, const unsigned char *sk_prf, const unsigned char *optrand,
const unsigned char *m, size_t mlen) { const unsigned char *m, size_t mlen) {
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, sk_prf, SPX_N); shake256_inc_absorb(&state, sk_prf, SPX_N);
shake256_inc_absorb(s_inc, optrand, SPX_N); shake256_inc_absorb(&state, optrand, SPX_N);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(R, SPX_N, s_inc); shake256_inc_squeeze(R, SPX_N, &state);
} }
/** /**
@ -64,14 +64,14 @@ void PQCLEAN_SPHINCSSHAKE256256SSIMPLE_CLEAN_hash_message(
unsigned char buf[SPX_DGST_BYTES]; unsigned char buf[SPX_DGST_BYTES];
unsigned char *bufp = buf; unsigned char *bufp = buf;
uint64_t s_inc[26]; shake256incctx state;
shake256_inc_init(s_inc); shake256_inc_init(&state);
shake256_inc_absorb(s_inc, R, SPX_N); shake256_inc_absorb(&state, R, SPX_N);
shake256_inc_absorb(s_inc, pk, SPX_PK_BYTES); shake256_inc_absorb(&state, pk, SPX_PK_BYTES);
shake256_inc_absorb(s_inc, m, mlen); shake256_inc_absorb(&state, m, mlen);
shake256_inc_finalize(s_inc); shake256_inc_finalize(&state);
shake256_inc_squeeze(buf, SPX_DGST_BYTES, s_inc); shake256_inc_squeeze(buf, SPX_DGST_BYTES, &state);
memcpy(digest, bufp, SPX_FORS_MSG_BYTES); memcpy(digest, bufp, SPX_FORS_MSG_BYTES);
bufp += SPX_FORS_MSG_BYTES; bufp += SPX_FORS_MSG_BYTES;