blob: 5875d41fafa7eb20228417f666cf4c145b2778de [file] [log] [blame]
naddy@openbsd.org4cdc5952017-12-14 21:07:39 +00001/* $OpenBSD: hash.c,v 1.4 2017/12/14 21:07:39 naddy Exp $ */
Darren Tuckerf45f78a2014-01-17 12:43:43 +11002
naddy@openbsd.orga69bbb02018-01-13 00:24:09 +00003/* $OpenBSD: hash.c,v 1.5 2018/01/13 00:24:09 naddy Exp $ */
4/*
5 * Public domain. Author: Christian Weisgerber <naddy@openbsd.org>
6 * API compatible reimplementation of function from nacl
7 */
djm@openbsd.org04c7e282017-12-18 02:25:15 +00008
Damien Miller5be9d9e2013-12-07 11:24:01 +11009#include "crypto_api.h"
10
naddy@openbsd.org4cdc5952017-12-14 21:07:39 +000011#include <stdarg.h>
Damien Miller5be9d9e2013-12-07 11:24:01 +110012
naddy@openbsd.org4cdc5952017-12-14 21:07:39 +000013#include "digest.h"
14#include "log.h"
15#include "ssherr.h"
Damien Miller5be9d9e2013-12-07 11:24:01 +110016
naddy@openbsd.org4cdc5952017-12-14 21:07:39 +000017int
18crypto_hash_sha512(unsigned char *out, const unsigned char *in,
19 unsigned long long inlen)
Damien Miller5be9d9e2013-12-07 11:24:01 +110020{
naddy@openbsd.org4cdc5952017-12-14 21:07:39 +000021 int r;
Damien Miller5be9d9e2013-12-07 11:24:01 +110022
naddy@openbsd.org4cdc5952017-12-14 21:07:39 +000023 if ((r = ssh_digest_memory(SSH_DIGEST_SHA512, in, inlen, out,
24 crypto_hash_sha512_BYTES)) != 0)
25 fatal("%s: %s", __func__, ssh_err(r));
26 return 0;
Damien Miller5be9d9e2013-12-07 11:24:01 +110027}