1 /* $OpenBSD: crypto_hash.c,v 1.1 2021/05/28 18:01:39 tobhe 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 #include <openssl/evp.h>
9
10 int
crypto_hash_sha512(unsigned char * out,const unsigned char * in,unsigned long long inlen)11 crypto_hash_sha512(unsigned char *out, const unsigned char *in,
12 unsigned long long inlen)
13 {
14 u_int mdlen;
15
16 if (!EVP_Digest(in, inlen, out, &mdlen, EVP_sha512(), NULL))
17 return -1;
18 return 0;
19 }
20