summaryrefslogtreecommitdiff
path: root/xmss_commons.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2018-02-23 15:58:37 +0000
committerDamien Miller <djm@mindrot.org>2018-02-26 11:40:41 +1100
commit1b11ea7c58cd5c59838b5fa574cd456d6047b2d4 (patch)
tree7e96cb41b5234b9d327f7c8f41392f09aed0994e /xmss_commons.c
parent7d330a1ac02076de98cfc8fda05353d57b603755 (diff)
upstream: Add experimental support for PQC XMSS keys (Extended
Hash-Based Signatures) The code is not compiled in by default (see WITH_XMSS in Makefile.inc) Joint work with stefan-lukas_gazdag at genua.eu See https://tools.ietf.org/html/draft-irtf-cfrg-xmss-hash-based-signatures-12 ok djm@ OpenBSD-Commit-ID: ef3eccb96762a5d6f135d7daeef608df7776a7ac
Diffstat (limited to 'xmss_commons.c')
-rw-r--r--xmss_commons.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/xmss_commons.c b/xmss_commons.c
new file mode 100644
index 00000000..51171af9
--- /dev/null
+++ b/xmss_commons.c
@@ -0,0 +1,27 @@
+/*
+xmss_commons.c 20160722
+Andreas Hülsing
+Joost Rijneveld
+Public domain.
+*/
+
+#include "xmss_commons.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+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;
+ }
+}
+
+void hexdump(const unsigned char *a, size_t len)
+{
+ size_t i;
+ for (i = 0; i < len; i++)
+ printf("%02x", a[i]);
+} \ No newline at end of file