2017-12-14 22:07:39 +01:00
|
|
|
/* $OpenBSD: hash.c,v 1.4 2017/12/14 21:07:39 naddy Exp $ */
|
2014-01-17 02:43:43 +01:00
|
|
|
|
2018-01-13 01:24:09 +01:00
|
|
|
/* $OpenBSD: hash.c,v 1.5 2018/01/13 00:24:09 naddy Exp $ */
|
|
|
|
/*
|
|
|
|
* Public domain. Author: Christian Weisgerber <naddy@openbsd.org>
|
|
|
|
* API compatible reimplementation of function from nacl
|
|
|
|
*/
|
2017-12-18 03:25:15 +01:00
|
|
|
|
2013-12-07 01:24:01 +01:00
|
|
|
#include "crypto_api.h"
|
|
|
|
|
2017-12-14 22:07:39 +01:00
|
|
|
#include <stdarg.h>
|
2013-12-07 01:24:01 +01:00
|
|
|
|
2017-12-14 22:07:39 +01:00
|
|
|
#include "digest.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "ssherr.h"
|
2013-12-07 01:24:01 +01:00
|
|
|
|
2017-12-14 22:07:39 +01:00
|
|
|
int
|
|
|
|
crypto_hash_sha512(unsigned char *out, const unsigned char *in,
|
|
|
|
unsigned long long inlen)
|
2013-12-07 01:24:01 +01:00
|
|
|
{
|
2017-12-14 22:07:39 +01:00
|
|
|
int r;
|
2013-12-07 01:24:01 +01:00
|
|
|
|
2017-12-14 22:07:39 +01:00
|
|
|
if ((r = ssh_digest_memory(SSH_DIGEST_SHA512, in, inlen, out,
|
|
|
|
crypto_hash_sha512_BYTES)) != 0)
|
|
|
|
fatal("%s: %s", __func__, ssh_err(r));
|
|
|
|
return 0;
|
2013-12-07 01:24:01 +01:00
|
|
|
}
|