xref: /openbsd-src/usr.bin/ssh/hash.c (revision c90a81c56dcebd6a1b73fe4aff9b03385b8e63b3)
1 /* $OpenBSD: hash.c,v 1.5 2018/01/13 00:24:09 naddy Exp $ */
2 /*
3  * Public domain. Author: Christian Weisgerber <naddy@openbsd.org>
4  * API compatible reimplementation of function from nacl
5  */
6 
7 #include "crypto_api.h"
8 
9 #include <stdarg.h>
10 
11 #include "digest.h"
12 #include "log.h"
13 #include "ssherr.h"
14 
15 int
16 crypto_hash_sha512(unsigned char *out, const unsigned char *in,
17     unsigned long long inlen)
18 {
19 	int r;
20 
21 	if ((r = ssh_digest_memory(SSH_DIGEST_SHA512, in, inlen, out,
22 	    crypto_hash_sha512_BYTES)) != 0)
23 		fatal("%s: %s", __func__, ssh_err(r));
24 	return 0;
25 }
26