1 /*
2 */
3
4 #include <sys/param.h>
5 #include <atf-c.h>
6
7 #include <geom/eli/pkcs5v2.h>
8
9 const struct {
10 char *salt;
11 size_t saltlen;
12 char *passwd;
13 int iterations;
14 char *hmacout;
15 size_t hmaclen;
16 } testdata[] = {
17 #include "testvect.h"
18 };
19
20 ATF_TC_WITHOUT_HEAD(hmactest);
ATF_TC_BODY(hmactest,tc)21 ATF_TC_BODY(hmactest, tc)
22 {
23 size_t i;
24 uint8_t hmacout[64];
25
26 for (i = 0; i < nitems(testdata); i++) {
27 pkcs5v2_genkey(hmacout, testdata[i].hmaclen,
28 (uint8_t *)testdata[i].salt, testdata[i].saltlen,
29 testdata[i].passwd, testdata[i].iterations);
30 ATF_REQUIRE(bcmp(hmacout, testdata[i].hmacout,
31 testdata[i].hmaclen) == 0);
32 }
33 }
34
ATF_TP_ADD_TCS(tp)35 ATF_TP_ADD_TCS(tp)
36 {
37 ATF_TP_ADD_TC(tp, hmactest);
38
39 return (atf_no_error());
40 }
41