From 753387164ce9d0b610ceae93830cfe1f26f0fdd2 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 18 Sep 2016 10:20:38 +0200 Subject: Initial import - WIP --- orig/crypto_api.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 orig/crypto_api.c (limited to 'orig/crypto_api.c') diff --git a/orig/crypto_api.c b/orig/crypto_api.c new file mode 100644 index 0000000..36b7348 --- /dev/null +++ b/orig/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 + * API compatible reimplementation of functions from nacl + */ +#include + +#include +#include + +#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; +} -- cgit v1.2.3