dtucker@openbsd.org | 27b9f39 | 2018-02-26 03:56:44 +0000 | [diff] [blame] | 1 | /* $OpenBSD: xmss_commons.c,v 1.2 2018/02/26 03:56:44 dtucker Exp $ */ |
markus@openbsd.org | 1b11ea7 | 2018-02-23 15:58:37 +0000 | [diff] [blame] | 2 | /* |
| 3 | xmss_commons.c 20160722 |
| 4 | Andreas Hülsing |
| 5 | Joost Rijneveld |
| 6 | Public domain. |
| 7 | */ |
| 8 | |
Damien Miller | f885474 | 2018-02-26 12:18:14 +1100 | [diff] [blame] | 9 | #include "includes.h" |
Darren Tucker | 941e0d3 | 2018-02-28 19:59:35 +1100 | [diff] [blame] | 10 | #ifdef WITH_XMSS |
Damien Miller | f885474 | 2018-02-26 12:18:14 +1100 | [diff] [blame] | 11 | |
markus@openbsd.org | 1b11ea7 | 2018-02-23 15:58:37 +0000 | [diff] [blame] | 12 | #include "xmss_commons.h" |
| 13 | #include <stdlib.h> |
| 14 | #include <stdio.h> |
Darren Tucker | c7ef4a3 | 2018-02-26 17:42:56 +1100 | [diff] [blame] | 15 | #ifdef HAVE_STDINT_H |
markus@openbsd.org | 1b11ea7 | 2018-02-23 15:58:37 +0000 | [diff] [blame] | 16 | #include <stdint.h> |
Darren Tucker | c7ef4a3 | 2018-02-26 17:42:56 +1100 | [diff] [blame] | 17 | #endif |
markus@openbsd.org | 1b11ea7 | 2018-02-23 15:58:37 +0000 | [diff] [blame] | 18 | |
| 19 | void to_byte(unsigned char *out, unsigned long long in, uint32_t bytes) |
| 20 | { |
| 21 | int32_t i; |
| 22 | for (i = bytes-1; i >= 0; i--) { |
| 23 | out[i] = in & 0xff; |
| 24 | in = in >> 8; |
| 25 | } |
| 26 | } |
| 27 | |
Darren Tucker | 534b268 | 2018-02-26 14:51:59 +1100 | [diff] [blame] | 28 | #if 0 |
markus@openbsd.org | 1b11ea7 | 2018-02-23 15:58:37 +0000 | [diff] [blame] | 29 | void hexdump(const unsigned char *a, size_t len) |
| 30 | { |
| 31 | size_t i; |
| 32 | for (i = 0; i < len; i++) |
| 33 | printf("%02x", a[i]); |
Damien Miller | f885474 | 2018-02-26 12:18:14 +1100 | [diff] [blame] | 34 | } |
Darren Tucker | 534b268 | 2018-02-26 14:51:59 +1100 | [diff] [blame] | 35 | #endif |
Darren Tucker | a10d855 | 2018-02-27 14:45:17 +1100 | [diff] [blame] | 36 | #endif /* WITH_XMSS */ |