1*9b50bc25Stobhe /* $OpenBSD: crypto_hash.c,v 1.1 2021/05/28 18:01:39 tobhe Exp $ */
2*9b50bc25Stobhe /*
3*9b50bc25Stobhe * Public domain. Author: Christian Weisgerber <naddy@openbsd.org>
4*9b50bc25Stobhe * API compatible reimplementation of function from nacl
5*9b50bc25Stobhe */
6*9b50bc25Stobhe
7*9b50bc25Stobhe #include "crypto_api.h"
8*9b50bc25Stobhe #include <openssl/evp.h>
9*9b50bc25Stobhe
10*9b50bc25Stobhe int
crypto_hash_sha512(unsigned char * out,const unsigned char * in,unsigned long long inlen)11*9b50bc25Stobhe crypto_hash_sha512(unsigned char *out, const unsigned char *in,
12*9b50bc25Stobhe unsigned long long inlen)
13*9b50bc25Stobhe {
14*9b50bc25Stobhe u_int mdlen;
15*9b50bc25Stobhe
16*9b50bc25Stobhe if (!EVP_Digest(in, inlen, out, &mdlen, EVP_sha512(), NULL))
17*9b50bc25Stobhe return -1;
18*9b50bc25Stobhe return 0;
19*9b50bc25Stobhe }
20