GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.bin/signify/crypto_api.c Lines: 7 7 100.0 %
Date: 2017-11-13 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: crypto_api.c,v 1.1 2014/01/08 03:59:46 tedu Exp $ */
2
/*
3
 * Public domain. Author: Ted Unangst <tedu@openbsd.org>
4
 * API compatible reimplementation of functions from nacl
5
 */
6
#include <sys/types.h>
7
8
#include <string.h>
9
#include <sha2.h>
10
11
#include "crypto_api.h"
12
13
int
14
crypto_hash_sha512(unsigned char *out, const unsigned char *in,
15
    unsigned long long inlen)
16
{
17
138
	SHA2_CTX ctx;
18
19
69
	SHA512Init(&ctx);
20
69
	SHA512Update(&ctx, in, inlen);
21
69
	SHA512Final(out, &ctx);
22
69
	return 0;
23
69
}
24
25
int
26
crypto_verify_32(const unsigned char *x, const unsigned char *y)
27
{
28
42
	return timingsafe_bcmp(x, y, 32) ? -1 : 0;
29
}