1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-27 01:41:40 +00:00

Fix input/output overwrite for MGF1

This commit is contained in:
Joost Rijneveld 2019-04-24 14:04:33 +02:00
parent 08e6c6c052
commit f3980cf033
No known key found for this signature in database
GPG Key ID: A4FE39CF49CBC553
6 changed files with 30 additions and 30 deletions

View File

@ -17,7 +17,7 @@ static void PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash(
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char outbuf[SPX_SHA256_OUTPUT_BYTES];
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES;
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES + 4;
uint8_t sha2_state[40];
unsigned int i;
@ -44,7 +44,7 @@ void PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash_1(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 1 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 1 * SPX_N];
PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash(
out, buf, in, 1, pub_seed, addr);
}
@ -53,7 +53,7 @@ void PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash_2(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 2 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 2 * SPX_N];
PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash(
out, buf, in, 2, pub_seed, addr);
}
@ -62,7 +62,7 @@ void PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash_WOTS_LEN(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_WOTS_LEN * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_WOTS_LEN * SPX_N];
PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash(
out, buf, in, SPX_WOTS_LEN, pub_seed, addr);
}
@ -71,7 +71,7 @@ void PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash_FORS_TREES(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_FORS_TREES * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_FORS_TREES * SPX_N];
PQCLEAN_SPHINCSSHA256128FROBUST_CLEAN_thash(
out, buf, in, SPX_FORS_TREES, pub_seed, addr);
}

View File

@ -17,7 +17,7 @@ static void PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash(
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char outbuf[SPX_SHA256_OUTPUT_BYTES];
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES;
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES + 4;
uint8_t sha2_state[40];
unsigned int i;
@ -44,7 +44,7 @@ void PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash_1(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 1 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 1 * SPX_N];
PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash(
out, buf, in, 1, pub_seed, addr);
}
@ -53,7 +53,7 @@ void PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash_2(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 2 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 2 * SPX_N];
PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash(
out, buf, in, 2, pub_seed, addr);
}
@ -62,7 +62,7 @@ void PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash_WOTS_LEN(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_WOTS_LEN * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_WOTS_LEN * SPX_N];
PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash(
out, buf, in, SPX_WOTS_LEN, pub_seed, addr);
}
@ -71,7 +71,7 @@ void PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash_FORS_TREES(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_FORS_TREES * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_FORS_TREES * SPX_N];
PQCLEAN_SPHINCSSHA256128SROBUST_CLEAN_thash(
out, buf, in, SPX_FORS_TREES, pub_seed, addr);
}

View File

@ -17,7 +17,7 @@ static void PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash(
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char outbuf[SPX_SHA256_OUTPUT_BYTES];
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES;
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES + 4;
uint8_t sha2_state[40];
unsigned int i;
@ -44,7 +44,7 @@ void PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash_1(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 1 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 1 * SPX_N];
PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash(
out, buf, in, 1, pub_seed, addr);
}
@ -53,7 +53,7 @@ void PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash_2(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 2 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 2 * SPX_N];
PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash(
out, buf, in, 2, pub_seed, addr);
}
@ -62,7 +62,7 @@ void PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash_WOTS_LEN(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_WOTS_LEN * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_WOTS_LEN * SPX_N];
PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash(
out, buf, in, SPX_WOTS_LEN, pub_seed, addr);
}
@ -71,7 +71,7 @@ void PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash_FORS_TREES(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_FORS_TREES * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_FORS_TREES * SPX_N];
PQCLEAN_SPHINCSSHA256192FROBUST_CLEAN_thash(
out, buf, in, SPX_FORS_TREES, pub_seed, addr);
}

View File

@ -17,7 +17,7 @@ static void PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash(
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char outbuf[SPX_SHA256_OUTPUT_BYTES];
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES;
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES + 4;
uint8_t sha2_state[40];
unsigned int i;
@ -44,7 +44,7 @@ void PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash_1(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 1 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 1 * SPX_N];
PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash(
out, buf, in, 1, pub_seed, addr);
}
@ -53,7 +53,7 @@ void PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash_2(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 2 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 2 * SPX_N];
PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash(
out, buf, in, 2, pub_seed, addr);
}
@ -62,7 +62,7 @@ void PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash_WOTS_LEN(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_WOTS_LEN * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_WOTS_LEN * SPX_N];
PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash(
out, buf, in, SPX_WOTS_LEN, pub_seed, addr);
}
@ -71,7 +71,7 @@ void PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash_FORS_TREES(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_FORS_TREES * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_FORS_TREES * SPX_N];
PQCLEAN_SPHINCSSHA256192SROBUST_CLEAN_thash(
out, buf, in, SPX_FORS_TREES, pub_seed, addr);
}

View File

@ -17,7 +17,7 @@ static void PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash(
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char outbuf[SPX_SHA256_OUTPUT_BYTES];
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES;
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES + 4;
uint8_t sha2_state[40];
unsigned int i;
@ -44,7 +44,7 @@ void PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash_1(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 1 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 1 * SPX_N];
PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash(
out, buf, in, 1, pub_seed, addr);
}
@ -53,7 +53,7 @@ void PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash_2(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 2 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 2 * SPX_N];
PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash(
out, buf, in, 2, pub_seed, addr);
}
@ -62,7 +62,7 @@ void PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash_WOTS_LEN(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_WOTS_LEN * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_WOTS_LEN * SPX_N];
PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash(
out, buf, in, SPX_WOTS_LEN, pub_seed, addr);
}
@ -71,7 +71,7 @@ void PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash_FORS_TREES(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_FORS_TREES * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_FORS_TREES * SPX_N];
PQCLEAN_SPHINCSSHA256256FROBUST_CLEAN_thash(
out, buf, in, SPX_FORS_TREES, pub_seed, addr);
}

View File

@ -17,7 +17,7 @@ static void PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash(
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char outbuf[SPX_SHA256_OUTPUT_BYTES];
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES;
unsigned char *bitmask = buf + SPX_N + SPX_SHA256_ADDR_BYTES + 4;
uint8_t sha2_state[40];
unsigned int i;
@ -44,7 +44,7 @@ void PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash_1(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 1 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 1 * SPX_N];
PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash(
out, buf, in, 1, pub_seed, addr);
}
@ -53,7 +53,7 @@ void PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash_2(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 2 * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + 2 * SPX_N];
PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash(
out, buf, in, 2, pub_seed, addr);
}
@ -62,7 +62,7 @@ void PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash_WOTS_LEN(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_WOTS_LEN * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_WOTS_LEN * SPX_N];
PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash(
out, buf, in, SPX_WOTS_LEN, pub_seed, addr);
}
@ -71,7 +71,7 @@ void PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash_FORS_TREES(
unsigned char *out, const unsigned char *in,
const unsigned char *pub_seed, uint32_t addr[8]) {
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + SPX_FORS_TREES * SPX_N + 4];
unsigned char buf[SPX_N + SPX_SHA256_ADDR_BYTES + 4 + SPX_FORS_TREES * SPX_N];
PQCLEAN_SPHINCSSHA256256SROBUST_CLEAN_thash(
out, buf, in, SPX_FORS_TREES, pub_seed, addr);
}