xref: /dflybsd-src/crypto/openssh/xmss_commons.c (revision ba1276acd1c8c22d225b1bcf370a14c878644f44)
1*ba1276acSMatthew Dillon /* $OpenBSD: xmss_commons.c,v 1.2 2018/02/26 03:56:44 dtucker Exp $ */
2*ba1276acSMatthew Dillon /*
3*ba1276acSMatthew Dillon xmss_commons.c 20160722
4*ba1276acSMatthew Dillon Andreas Hülsing
5*ba1276acSMatthew Dillon Joost Rijneveld
6*ba1276acSMatthew Dillon Public domain.
7*ba1276acSMatthew Dillon */
8*ba1276acSMatthew Dillon 
9*ba1276acSMatthew Dillon #include "includes.h"
10*ba1276acSMatthew Dillon #ifdef WITH_XMSS
11*ba1276acSMatthew Dillon 
12*ba1276acSMatthew Dillon #include "xmss_commons.h"
13*ba1276acSMatthew Dillon #include <stdlib.h>
14*ba1276acSMatthew Dillon #include <stdio.h>
15*ba1276acSMatthew Dillon #ifdef HAVE_STDINT_H
16*ba1276acSMatthew Dillon # include <stdint.h>
17*ba1276acSMatthew Dillon #endif
18*ba1276acSMatthew Dillon 
to_byte(unsigned char * out,unsigned long long in,uint32_t bytes)19*ba1276acSMatthew Dillon void to_byte(unsigned char *out, unsigned long long in, uint32_t bytes)
20*ba1276acSMatthew Dillon {
21*ba1276acSMatthew Dillon   int32_t i;
22*ba1276acSMatthew Dillon   for (i = bytes-1; i >= 0; i--) {
23*ba1276acSMatthew Dillon     out[i] = in & 0xff;
24*ba1276acSMatthew Dillon     in = in >> 8;
25*ba1276acSMatthew Dillon   }
26*ba1276acSMatthew Dillon }
27*ba1276acSMatthew Dillon 
28*ba1276acSMatthew Dillon #if 0
29*ba1276acSMatthew Dillon void hexdump(const unsigned char *a, size_t len)
30*ba1276acSMatthew Dillon {
31*ba1276acSMatthew Dillon   size_t i;
32*ba1276acSMatthew Dillon   for (i = 0; i < len; i++)
33*ba1276acSMatthew Dillon     printf("%02x", a[i]);
34*ba1276acSMatthew Dillon }
35*ba1276acSMatthew Dillon #endif
36*ba1276acSMatthew Dillon #endif /* WITH_XMSS */
37