xmss_commons.c 631 B

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