Simplify hash family parameter definition

This commit is contained in:
Joost Rijneveld 2017-07-31 16:50:47 +02:00
parent 073e093ce0
commit 1e041f25d5
No known key found for this signature in database
GPG Key ID: 307BC77F47D58EE2
2 changed files with 7 additions and 7 deletions

8
hash.c
View File

@ -48,16 +48,16 @@ static int core_hash(unsigned char *out, const unsigned int type, const unsigned
buf[keylen + n + i] = in[i];
}
if (n == 32 && XMSS_FUNC == XMSS_SHA2_256) {
if (n == 32 && XMSS_FUNC == XMSS_SHA2) {
SHA256(buf, inlen + keylen + n, out);
}
else if (n == 32 && XMSS_FUNC == XMSS_SHAKE128) {
else if (n == 32 && XMSS_FUNC == XMSS_SHAKE) {
shake128(out, 32, buf, inlen + keylen + n);
}
else if (n == 64 && XMSS_FUNC == XMSS_SHA2_512) {
else if (n == 64 && XMSS_FUNC == XMSS_SHA2) {
SHA512(buf, inlen + keylen + n, out);
}
else if (n == 64 && XMSS_FUNC == XMSS_SHAKE256) {
else if (n == 64 && XMSS_FUNC == XMSS_SHAKE) {
shake256(out, 64, buf, inlen + keylen + n);
}
else {

View File

@ -131,9 +131,9 @@ nvalues = {
"SHAKE256": 64,
}
for i, func in enumerate(functions):
print("#define XMSS_{} {}".format(func.replace('-', '_'), i))
print("#define XMSS_FUNC", functions.index(param[1]))
print("#define XMSS_SHA2 0")
print("#define XMSS_SHAKE 1")
print("#define XMSS_FUNC", functions.index(param[1]) // 2)
XMSS_N = int(nvalues[param[1]])
print("#define XMSS_N", XMSS_N)