Fix erroneous index length for XMSSMT
This produced repeated indices when reaching 2^32 signatures.
This was introduced in 9b35b00d98
with the re-introduction of runtime parameters. Compile-time parameters
did not contain this error.
This commit is contained in:
parent
4111393912
commit
bbbb95e869
3
params.c
3
params.c
@ -456,7 +456,8 @@ int xmssmt_parse_oid(xmss_params *params, const uint32_t oid)
|
|||||||
params->wots_len2 = 3;
|
params->wots_len2 = 3;
|
||||||
params->wots_len = params->wots_len1 + params->wots_len2;
|
params->wots_len = params->wots_len1 + params->wots_len2;
|
||||||
params->wots_keysize = params->wots_len * params->n;
|
params->wots_keysize = params->wots_len * params->n;
|
||||||
params->index_len = 4;
|
/* Round index_len up to nearest byte. */
|
||||||
|
params->index_len = (params->full_height + 7) / 8;
|
||||||
params->bytes = (params->index_len + params->n + params->d*params->wots_keysize
|
params->bytes = (params->index_len + params->n + params->d*params->wots_keysize
|
||||||
+ params->full_height *params->n);
|
+ params->full_height *params->n);
|
||||||
params->publickey_bytes = 2*params->n;
|
params->publickey_bytes = 2*params->n;
|
||||||
|
@ -176,7 +176,7 @@ int xmssmt_core_keypair(const xmss_params *params,
|
|||||||
|
|
||||||
/* Initialize index to 0. */
|
/* Initialize index to 0. */
|
||||||
memset(sk, 0, params->index_len);
|
memset(sk, 0, params->index_len);
|
||||||
sk += 4;
|
sk += params->index_len;
|
||||||
|
|
||||||
/* Initialize SK_SEED, SK_PRF and PUB_SEED. */
|
/* Initialize SK_SEED, SK_PRF and PUB_SEED. */
|
||||||
randombytes(sk, 3 * params->n);
|
randombytes(sk, 3 * params->n);
|
||||||
|
Loading…
Reference in New Issue
Block a user