summaryrefslogtreecommitdiff
path: root/sbin/iked/crypto_hash.c
blob: 68867536df479c24e064de9d59a9d1d84e87ae1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* $OpenBSD: crypto_hash.c,v 1.1 2021/05/28 18:01:39 tobhe Exp $ */
/*
 * Public domain. Author: Christian Weisgerber <naddy@openbsd.org>
 * API compatible reimplementation of function from nacl
 */

#include "crypto_api.h"
#include <openssl/evp.h>

int
crypto_hash_sha512(unsigned char *out, const unsigned char *in,
    unsigned long long inlen)
{
	u_int mdlen;

	if (!EVP_Digest(in, inlen, out, &mdlen, EVP_sha512(), NULL))
		return -1;
	return 0;
}