1 #include <u.h>
2 #include <libc.h>
3 #include <venti.h>
4 #include <libsec.h>
5
6 void
vtsha1(uchar score[VtScoreSize],uchar * p,int n)7 vtsha1(uchar score[VtScoreSize], uchar *p, int n)
8 {
9 DigestState ds;
10
11 memset(&ds, 0, sizeof ds);
12 sha1(p, n, score, &ds);
13 }
14
15 int
vtsha1check(uchar score[VtScoreSize],uchar * p,int n)16 vtsha1check(uchar score[VtScoreSize], uchar *p, int n)
17 {
18 DigestState ds;
19 uchar score2[VtScoreSize];
20
21 memset(&ds, 0, sizeof ds);
22 sha1(p, n, score2, &ds);
23 if(memcmp(score, score2, VtScoreSize) != 0) {
24 werrstr("vtsha1check failed");
25 return -1;
26 }
27 return 0;
28 }
29