opnsense-src/tests/sys/geom/class/eli/hmac_test.c
Enji Cooper e22ad7bca1 Move .../sys/geom/eli/pbkdf2... to .../sys/geom/class/eli/...
This change moves the tests added in r313962 to an existing directory
structure used by the geli TAP tests. It also, renames the test from
pbkdf2 to pbkdf2_test .

The changes to ObsoleteFiles.inc are being committed separately as they
aren't needed for the MFC to ^/stable/11, etc, if the MFC for the tests
is done all in one commit.

MFC after:	2 weeks
X-MFC with:	r313962, r313972-r313973
Reviewed by:	allanjude
Sponsored by:	Dell EMC Isilon
Differential Revision:	D9985
2017-03-14 07:00:22 +00:00

41 lines
706 B
C

/*
* $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());
}