Browse Source

Simplify hash family parameter definition

master
Joost Rijneveld 7 years ago
parent
commit
1e041f25d5
No known key found for this signature in database GPG Key ID: 307BC77F47D58EE2
2 changed files with 7 additions and 7 deletions
  1. +4
    -4
      hash.c
  2. +3
    -3
      params.h.py

+ 4
- 4
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 {


+ 3
- 3
params.h.py 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)


Loading…
Cancel
Save