aboutsummaryrefslogtreecommitdiff
path: root/src/libventi/sha1.c
blob: 358f923d1d6fde2aa480dd64f8a09b62b9ef3409 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <u.h>
#include <libc.h>
#include <venti.h>
#include <libsec.h>

void
vtsha1(uchar score[VtScoreSize], uchar *p, int n)
{
	DigestState ds;

	memset(&ds, 0, sizeof ds);
	sha1(p, n, score, &ds);
}

int
vtsha1check(uchar score[VtScoreSize], uchar *p, int n)
{
	DigestState ds;
	uchar score2[VtScoreSize];

	memset(&ds, 0, sizeof ds);
	sha1(p, n, score2, &ds);
	if(memcmp(score, score2, VtScoreSize) != 0) {
		werrstr("vtsha1check failed");
		return -1;
	}
	return 0;
}