Simplify hash family parameter definition
This commit is contained in:
parent
073e093ce0
commit
1e041f25d5
8
hash.c
8
hash.c
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user