2018-02-26 11:56:44 +08:00
|
|
|
/* $OpenBSD: xmss_commons.c,v 1.2 2018/02/26 03:56:44 dtucker Exp $ */
|
2018-02-23 23:58:37 +08:00
|
|
|
/*
|
|
|
|
xmss_commons.c 20160722
|
|
|
|
Andreas Hülsing
|
|
|
|
Joost Rijneveld
|
|
|
|
Public domain.
|
|
|
|
*/
|
|
|
|
|
2018-02-26 09:18:14 +08:00
|
|
|
#include "includes.h"
|
2018-02-28 16:59:35 +08:00
|
|
|
#ifdef WITH_XMSS
|
2018-02-26 09:18:14 +08:00
|
|
|
|
2018-02-23 23:58:37 +08:00
|
|
|
#include "xmss_commons.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2018-02-26 14:42:56 +08:00
|
|
|
#ifdef HAVE_STDINT_H
|
2019-10-09 06:06:35 +08:00
|
|
|
# include <stdint.h>
|
2018-02-26 14:42:56 +08:00
|
|
|
#endif
|
2018-02-23 23:58:37 +08:00
|
|
|
|
|
|
|
void to_byte(unsigned char *out, unsigned long long in, uint32_t bytes)
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
for (i = bytes-1; i >= 0; i--) {
|
|
|
|
out[i] = in & 0xff;
|
|
|
|
in = in >> 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-26 11:51:59 +08:00
|
|
|
#if 0
|
2018-02-23 23:58:37 +08:00
|
|
|
void hexdump(const unsigned char *a, size_t len)
|
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
printf("%02x", a[i]);
|
2018-02-26 09:18:14 +08:00
|
|
|
}
|
2018-02-26 11:51:59 +08:00
|
|
|
#endif
|
2018-02-27 11:45:17 +08:00
|
|
|
#endif /* WITH_XMSS */
|