blob: 5f4e795cd5a5cdb1414c4706b916321dd06b68a0 (
plain) (
blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/*
* $FreeBSD$
*/
#include <sys/param.h>
#include <atf-c.h>
#include <geom/eli/pkcs5v2.h>
const struct {
char *salt;
size_t saltlen;
char *passwd;
int iterations;
char *hmacout;
size_t hmaclen;
} testdata[] = {
#include "testvect.h"
};
ATF_TC_WITHOUT_HEAD(hmactest);
ATF_TC_BODY(hmactest, tc)
{
size_t i;
uint8_t hmacout[64];
for (i = 0; i < nitems(testdata); i++) {
pkcs5v2_genkey(hmacout, testdata[i].hmaclen,
(uint8_t *)testdata[i].salt, testdata[i].saltlen,
testdata[i].passwd, testdata[i].iterations);
ATF_REQUIRE(bcmp(hmacout, testdata[i].hmacout,
testdata[i].hmaclen) == 0);
}
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, hmactest);
return (atf_no_error());
}
|