|
|
@@ -6,37 +6,9 @@ |
|
|
|
#include "hash_address.h" |
|
|
|
#include "params.h" |
|
|
|
#include "wots.h" |
|
|
|
#include "utils.h" |
|
|
|
#include "xmss_commons.h" |
|
|
|
|
|
|
|
/** |
|
|
|
* Converts the value of 'in' to 'outlen' bytes in big-endian byte order. |
|
|
|
*/ |
|
|
|
void ull_to_bytes(unsigned char *out, unsigned int outlen, |
|
|
|
unsigned long long in) |
|
|
|
{ |
|
|
|
int i; |
|
|
|
|
|
|
|
/* Iterate over out in decreasing order, for big-endianness. */ |
|
|
|
for (i = outlen - 1; i >= 0; i--) { |
|
|
|
out[i] = in & 0xff; |
|
|
|
in = in >> 8; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Converts the inlen bytes in 'in' from big-endian byte order to an integer. |
|
|
|
*/ |
|
|
|
unsigned long long bytes_to_ull(const unsigned char *in, unsigned int inlen) |
|
|
|
{ |
|
|
|
unsigned long long retval = 0; |
|
|
|
unsigned int i; |
|
|
|
|
|
|
|
for (i = 0; i < inlen; i++) { |
|
|
|
retval |= ((unsigned long long)in[i]) << (8*(inlen - 1 - i)); |
|
|
|
} |
|
|
|
return retval; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Computes the leaf at a given address. First generates the WOTS key pair, |
|
|
|
* then computes leaf using l_tree. As this happens position independent, we |
|
|
|