summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-01-08 03:59:46 +0000
committertedu <tedu@openbsd.org>2014-01-08 03:59:46 +0000
commitbdb222f4ca3bca68429c72651d9c940bca622e46 (patch)
treea4bbc3a758126d1069259766213f142acbe050ef
parentno tomfoolery: mark the comment as untrusted, and enforce it. (diff)
downloadwireguard-openbsd-bdb222f4ca3bca68429c72651d9c940bca622e46.tar.xz
wireguard-openbsd-bdb222f4ca3bca68429c72651d9c940bca622e46.zip
reduce size by using equivalent code from libc instead of nacl
ok deraadt
-rw-r--r--usr.bin/signify/Makefile4
-rw-r--r--usr.bin/signify/crypto_api.c29
2 files changed, 31 insertions, 2 deletions
diff --git a/usr.bin/signify/Makefile b/usr.bin/signify/Makefile
index 7ec0a9e77dd..aca7b57b528 100644
--- a/usr.bin/signify/Makefile
+++ b/usr.bin/signify/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.1 2013/12/31 03:03:32 tedu Exp $
+# $OpenBSD: Makefile,v 1.2 2014/01/08 03:59:46 tedu Exp $
.PATH: ${.CURDIR}/../ssh
CPPFLAGS += -I${.CURDIR}/../ssh
SRCS= signify.c
SRCS+= ed25519.c fe25519.c ge25519.c sc25519.c smult_curve25519_ref.c
-SRCS+= blocks.c hash.c verify.c
+SRCS+= crypto_api.c
PROG= signify
diff --git a/usr.bin/signify/crypto_api.c b/usr.bin/signify/crypto_api.c
new file mode 100644
index 00000000000..36b734837da
--- /dev/null
+++ b/usr.bin/signify/crypto_api.c
@@ -0,0 +1,29 @@
+/* $OpenBSD: crypto_api.c,v 1.1 2014/01/08 03:59:46 tedu Exp $ */
+/*
+ * Public domain. Author: Ted Unangst <tedu@openbsd.org>
+ * API compatible reimplementation of functions from nacl
+ */
+#include <sys/types.h>
+
+#include <string.h>
+#include <sha2.h>
+
+#include "crypto_api.h"
+
+int
+crypto_hash_sha512(unsigned char *out, const unsigned char *in,
+ unsigned long long inlen)
+{
+ SHA2_CTX ctx;
+
+ SHA512Init(&ctx);
+ SHA512Update(&ctx, in, inlen);
+ SHA512Final(out, &ctx);
+ return 0;
+}
+
+int
+crypto_verify_32(const unsigned char *x, const unsigned char *y)
+{
+ return timingsafe_bcmp(x, y, 32) ? -1 : 0;
+}