Merge branch '46-just-use-clang-format-to-reformat-sources' into 'master'
Reformat source code with clang-format Closes #46 See merge request isc-projects/bind9!2156 (cherry picked from commit7099e79a9b)4c3b063eImport Linux kernel .clang-format with small modificationsf50b1e06Use clang-format to reformat the source files11341c76Update the definition files for Windowsdf6c1f76Remove tkey_test (which is no-op anyway)
This commit is contained in:
@@ -13,11 +13,10 @@
|
||||
|
||||
#if HAVE_CMOCKA
|
||||
|
||||
#include <sched.h> /* IWYU pragma: keep */
|
||||
#include <setjmp.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include <sched.h> /* IWYU pragma: keep */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -26,16 +25,17 @@
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/hex.h>
|
||||
#include <isc/hmac.h>
|
||||
#include <isc/region.h>
|
||||
#include <isc/result.h>
|
||||
#include <isc/hmac.h>
|
||||
|
||||
#include "../hmac.c"
|
||||
|
||||
#define TEST_INPUT(x) (x), sizeof(x)-1
|
||||
#define TEST_INPUT(x) (x), sizeof(x) - 1
|
||||
|
||||
static int
|
||||
_setup(void **state) {
|
||||
_setup(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = isc_hmac_new();
|
||||
if (hmac == NULL) {
|
||||
return (-1);
|
||||
@@ -45,7 +45,8 @@ _setup(void **state) {
|
||||
}
|
||||
|
||||
static int
|
||||
_teardown(void **state) {
|
||||
_teardown(void **state)
|
||||
{
|
||||
if (*state == NULL) {
|
||||
return (-1);
|
||||
}
|
||||
@@ -54,7 +55,8 @@ _teardown(void **state) {
|
||||
}
|
||||
|
||||
static int
|
||||
_reset(void **state) {
|
||||
_reset(void **state)
|
||||
{
|
||||
if (*state == NULL) {
|
||||
return (-1);
|
||||
}
|
||||
@@ -65,7 +67,8 @@ _reset(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_new_test(void **state) {
|
||||
isc_hmac_new_test(void **state)
|
||||
{
|
||||
UNUSED(state);
|
||||
|
||||
isc_hmac_t *hmac = isc_hmac_new();
|
||||
@@ -74,7 +77,8 @@ isc_hmac_new_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_free_test(void **state) {
|
||||
isc_hmac_free_test(void **state)
|
||||
{
|
||||
UNUSED(state);
|
||||
|
||||
isc_hmac_t *hmac = isc_hmac_new();
|
||||
@@ -94,32 +98,31 @@ isc_hmac_test(isc_hmac_t *hmac, const void *key, size_t keylen,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < repeats; i++) {
|
||||
assert_int_equal(
|
||||
isc_hmac_update(hmac,
|
||||
(const unsigned char *)buf, buflen),
|
||||
ISC_R_SUCCESS);
|
||||
assert_int_equal(isc_hmac_update(hmac,
|
||||
(const unsigned char *)buf,
|
||||
buflen),
|
||||
ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
unsigned char digest[ISC_MAX_MD_SIZE];
|
||||
unsigned int digestlen;
|
||||
unsigned int digestlen;
|
||||
assert_int_equal(isc_hmac_final(hmac, digest, &digestlen),
|
||||
ISC_R_SUCCESS);
|
||||
|
||||
char hexdigest[ISC_MAX_MD_SIZE * 2 + 3];
|
||||
isc_region_t r = { .base = digest,
|
||||
.length = digestlen
|
||||
};
|
||||
char hexdigest[ISC_MAX_MD_SIZE * 2 + 3];
|
||||
isc_region_t r = { .base = digest, .length = digestlen };
|
||||
isc_buffer_t b;
|
||||
isc_buffer_init(&b, hexdigest, sizeof(hexdigest));
|
||||
|
||||
assert_return_code(isc_hex_totext(&r, 0, "", &b), ISC_R_SUCCESS);
|
||||
|
||||
assert_memory_equal(hexdigest, result, (result?strlen(result):0));
|
||||
assert_memory_equal(hexdigest, result, (result ? strlen(result) : 0));
|
||||
assert_int_equal(isc_hmac_reset(hmac), ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_init_test(void **state) {
|
||||
isc_hmac_init_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
assert_non_null(hmac);
|
||||
|
||||
@@ -155,7 +158,8 @@ isc_hmac_init_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_update_test(void **state) {
|
||||
isc_hmac_update_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
assert_non_null(hmac);
|
||||
|
||||
@@ -168,7 +172,8 @@ isc_hmac_update_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_reset_test(void **state) {
|
||||
isc_hmac_reset_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
#if 0
|
||||
unsigned char digest[ISC_MAX_MD_SIZE] __attribute((unused));
|
||||
@@ -197,12 +202,13 @@ isc_hmac_reset_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_final_test(void **state) {
|
||||
isc_hmac_final_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
assert_non_null(hmac);
|
||||
|
||||
unsigned char digest[ISC_MAX_MD_SIZE];
|
||||
unsigned int digestlen;
|
||||
unsigned int digestlen;
|
||||
|
||||
/* Fail when message digest context is empty */
|
||||
expect_assert_failure(isc_hmac_final(NULL, digest, &digestlen));
|
||||
@@ -215,13 +221,13 @@ isc_hmac_final_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_md5_test(void **state) {
|
||||
isc_hmac_md5_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
|
||||
/* Test 0 */
|
||||
isc_hmac_test(hmac, TEST_INPUT(""), ISC_MD_MD5, TEST_INPUT(""),
|
||||
"74E6F7298A9C2D168935F58C001BAD88",
|
||||
1);
|
||||
"74E6F7298A9C2D168935F58C001BAD88", 1);
|
||||
|
||||
/* Test 1 */
|
||||
isc_hmac_test(hmac,
|
||||
@@ -229,18 +235,14 @@ isc_hmac_md5_test(void **state) {
|
||||
"\x0b\x0b\x0b\x0b\x0b\x0b"),
|
||||
ISC_MD_MD5,
|
||||
TEST_INPUT("\x48\x69\x20\x54\x68\x65\x72\x65"),
|
||||
"9294727A3638BB1C13F48EF8158BFC9D",
|
||||
1);
|
||||
"9294727A3638BB1C13F48EF8158BFC9D", 1);
|
||||
|
||||
/* Test 2 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("Jefe"),
|
||||
ISC_MD_MD5,
|
||||
isc_hmac_test(hmac, TEST_INPUT("Jefe"), ISC_MD_MD5,
|
||||
TEST_INPUT("\x77\x68\x61\x74\x20\x64\x6f\x20\x79"
|
||||
"\x61\x20\x77\x61\x6e\x74\x20\x66\x6f"
|
||||
"\x72\x20\x6e\x6f\x74\x68\x69\x6e\x67\x3f"),
|
||||
"750C783E6AB0B503EAA86E310A5DB738",
|
||||
1);
|
||||
"750C783E6AB0B503EAA86E310A5DB738", 1);
|
||||
|
||||
/* Test 3 */
|
||||
isc_hmac_test(hmac,
|
||||
@@ -252,8 +254,7 @@ isc_hmac_md5_test(void **state) {
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"),
|
||||
"56BE34521D144C88DBB8C733F0E8B3F6",
|
||||
1);
|
||||
"56BE34521D144C88DBB8C733F0E8B3F6", 1);
|
||||
/* Test 4 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
|
||||
@@ -265,8 +266,7 @@ isc_hmac_md5_test(void **state) {
|
||||
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
||||
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
||||
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"),
|
||||
"697EAF0ACA3A3AEA3A75164746FFAA79",
|
||||
1);
|
||||
"697EAF0ACA3A3AEA3A75164746FFAA79", 1);
|
||||
#if 0
|
||||
/* Test 5 -- unimplemented optional functionality */
|
||||
isc_hmac_test(hmac,
|
||||
@@ -320,13 +320,13 @@ isc_hmac_md5_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_sha1_test(void **state) {
|
||||
isc_hmac_sha1_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
|
||||
/* Test 0 */
|
||||
isc_hmac_test(hmac, TEST_INPUT(""), ISC_MD_SHA1, TEST_INPUT(""),
|
||||
"FBDB1D1B18AA6C08324B7D64B71FB76370690E1D",
|
||||
1);
|
||||
"FBDB1D1B18AA6C08324B7D64B71FB76370690E1D", 1);
|
||||
|
||||
/* Test 1 */
|
||||
isc_hmac_test(hmac,
|
||||
@@ -334,17 +334,13 @@ isc_hmac_sha1_test(void **state) {
|
||||
"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"),
|
||||
ISC_MD_SHA1,
|
||||
TEST_INPUT("\x48\x69\x20\x54\x68\x65\x72\x65"),
|
||||
"B617318655057264E28BC0B6FB378C8EF146BE00",
|
||||
1);
|
||||
"B617318655057264E28BC0B6FB378C8EF146BE00", 1);
|
||||
/* Test 2 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("Jefe"),
|
||||
ISC_MD_SHA1,
|
||||
isc_hmac_test(hmac, TEST_INPUT("Jefe"), ISC_MD_SHA1,
|
||||
TEST_INPUT("\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61"
|
||||
"\x20\x77\x61\x6e\x74\x20\x66\x6f\x72\x20"
|
||||
"\x6e\x6f\x74\x68\x69\x6e\x67\x3f"),
|
||||
"EFFCDF6AE5EB2FA2D27416D5F184DF9C259A7C79",
|
||||
1);
|
||||
"EFFCDF6AE5EB2FA2D27416D5F184DF9C259A7C79", 1);
|
||||
/* Test 3 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
@@ -355,8 +351,7 @@ isc_hmac_sha1_test(void **state) {
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"),
|
||||
"125D7342B9AC11CD91A39AF48AA17B4F63F175D3",
|
||||
1);
|
||||
"125D7342B9AC11CD91A39AF48AA17B4F63F175D3", 1);
|
||||
/* Test 4 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a"
|
||||
@@ -368,8 +363,7 @@ isc_hmac_sha1_test(void **state) {
|
||||
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
||||
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
|
||||
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"),
|
||||
"4C9007F4026250C6BC8414F9BF50C86C2D7235DA",
|
||||
1);
|
||||
"4C9007F4026250C6BC8414F9BF50C86C2D7235DA", 1);
|
||||
#if 0
|
||||
/* Test 5 */
|
||||
isc_hmac_test(hmac,
|
||||
@@ -407,12 +401,12 @@ isc_hmac_sha1_test(void **state) {
|
||||
ISC_MD_SHA1,
|
||||
TEST_INPUT("Test Using Larger Than Block-Size Key and "
|
||||
"Larger Than One Block-Size Data"),
|
||||
"E8E99D0F45237D786D6BBAA7965C7808BBFF1A91",
|
||||
1);
|
||||
"E8E99D0F45237D786D6BBAA7965C7808BBFF1A91", 1);
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_sha224_test(void **state) {
|
||||
isc_hmac_sha224_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
|
||||
/* Test 0 */
|
||||
@@ -431,9 +425,7 @@ isc_hmac_sha224_test(void **state) {
|
||||
"4F53684B22",
|
||||
1);
|
||||
/* Test 2 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("Jefe"),
|
||||
ISC_MD_SHA224,
|
||||
isc_hmac_test(hmac, TEST_INPUT("Jefe"), ISC_MD_SHA224,
|
||||
TEST_INPUT("\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61"
|
||||
"\x20\x77\x61\x6e\x74\x20\x66\x6f\x72\x20"
|
||||
"\x6e\x6f\x74\x68\x69\x6e\x67\x3f"),
|
||||
@@ -491,7 +483,8 @@ isc_hmac_sha224_test(void **state) {
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"),
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa"),
|
||||
ISC_MD_SHA224,
|
||||
TEST_INPUT("Test Using Larger Than Block-Size Key - "
|
||||
"Hash Key First"),
|
||||
@@ -512,7 +505,8 @@ isc_hmac_sha224_test(void **state) {
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"),
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa"),
|
||||
ISC_MD_SHA224,
|
||||
TEST_INPUT("\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20"
|
||||
"\x74\x65\x73\x74\x20\x75\x73\x69\x6e\x67"
|
||||
@@ -536,7 +530,8 @@ isc_hmac_sha224_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_sha256_test(void **state) {
|
||||
isc_hmac_sha256_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
|
||||
/* Test 0 */
|
||||
@@ -555,9 +550,7 @@ isc_hmac_sha256_test(void **state) {
|
||||
"A726E9376C2E32CFF7",
|
||||
1);
|
||||
/* Test 2 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("Jefe"),
|
||||
ISC_MD_SHA256,
|
||||
isc_hmac_test(hmac, TEST_INPUT("Jefe"), ISC_MD_SHA256,
|
||||
TEST_INPUT("\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61"
|
||||
"\x20\x77\x61\x6e\x74\x20\x66\x6f\x72\x20"
|
||||
"\x6e\x6f\x74\x68\x69\x6e\x67\x3f"),
|
||||
@@ -615,7 +608,8 @@ isc_hmac_sha256_test(void **state) {
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"),
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa"),
|
||||
ISC_MD_SHA256,
|
||||
TEST_INPUT("Test Using Larger Than Block-Size Key - "
|
||||
"Hash Key First"),
|
||||
@@ -636,7 +630,8 @@ isc_hmac_sha256_test(void **state) {
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"),
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa"),
|
||||
ISC_MD_SHA256,
|
||||
TEST_INPUT("\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20"
|
||||
"\x74\x65\x73\x74\x20\x75\x73\x69\x6e\x67"
|
||||
@@ -660,7 +655,8 @@ isc_hmac_sha256_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_sha384_test(void **state) {
|
||||
isc_hmac_sha384_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
|
||||
/* Test 0 */
|
||||
@@ -680,9 +676,7 @@ isc_hmac_sha384_test(void **state) {
|
||||
"E8B2FA9CB6",
|
||||
1);
|
||||
/* Test 2 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("Jefe"),
|
||||
ISC_MD_SHA384,
|
||||
isc_hmac_test(hmac, TEST_INPUT("Jefe"), ISC_MD_SHA384,
|
||||
TEST_INPUT("\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61"
|
||||
"\x20\x77\x61\x6e\x74\x20\x66\x6f\x72\x20"
|
||||
"\x6e\x6f\x74\x68\x69\x6e\x67\x3f"),
|
||||
@@ -743,7 +737,8 @@ isc_hmac_sha384_test(void **state) {
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"),
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa"),
|
||||
ISC_MD_SHA384,
|
||||
TEST_INPUT("Test Using Larger Than Block-Size Key - "
|
||||
"Hash Key First"),
|
||||
@@ -765,7 +760,8 @@ isc_hmac_sha384_test(void **state) {
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"),
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa"),
|
||||
ISC_MD_SHA384,
|
||||
TEST_INPUT("\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20"
|
||||
"\x74\x65\x73\x74\x20\x75\x73\x69\x6e\x67"
|
||||
@@ -790,14 +786,16 @@ isc_hmac_sha384_test(void **state) {
|
||||
}
|
||||
|
||||
static void
|
||||
isc_hmac_sha512_test(void **state) {
|
||||
isc_hmac_sha512_test(void **state)
|
||||
{
|
||||
isc_hmac_t *hmac = *state;
|
||||
|
||||
/* Test 0 */
|
||||
isc_hmac_test(hmac, TEST_INPUT(""), ISC_MD_SHA512, TEST_INPUT(""),
|
||||
"B936CEE86C9F87AA5D3C6F2E84CB5A4239A5FE50480A6EC6"
|
||||
"6B70AB5B1F4AC6730C6C515421B327EC1D69402E53DFB49A"
|
||||
"D7381EB067B338FD7B0CB22247225D47", 1);
|
||||
"D7381EB067B338FD7B0CB22247225D47",
|
||||
1);
|
||||
|
||||
/* Test 1 */
|
||||
isc_hmac_test(hmac,
|
||||
@@ -810,9 +808,7 @@ isc_hmac_sha512_test(void **state) {
|
||||
"4EAEA3F4E4BE9D914EEB61F1702E696C203A126854",
|
||||
1);
|
||||
/* Test 2 */
|
||||
isc_hmac_test(hmac,
|
||||
TEST_INPUT("Jefe"),
|
||||
ISC_MD_SHA512,
|
||||
isc_hmac_test(hmac, TEST_INPUT("Jefe"), ISC_MD_SHA512,
|
||||
TEST_INPUT("\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61"
|
||||
"\x20\x77\x61\x6e\x74\x20\x66\x6f\x72\x20"
|
||||
"\x6e\x6f\x74\x68\x69\x6e\x67\x3f"),
|
||||
@@ -873,7 +869,8 @@ isc_hmac_sha512_test(void **state) {
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"),
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa"),
|
||||
ISC_MD_SHA512,
|
||||
TEST_INPUT("Test Using Larger Than Block-Size Key - "
|
||||
"Hash Key First"),
|
||||
@@ -895,7 +892,8 @@ isc_hmac_sha512_test(void **state) {
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"),
|
||||
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
|
||||
"\xaa"),
|
||||
ISC_MD_SHA512,
|
||||
TEST_INPUT("\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20"
|
||||
"\x74\x65\x73\x74\x20\x75\x73\x69\x6e\x67"
|
||||
@@ -920,18 +918,19 @@ isc_hmac_sha512_test(void **state) {
|
||||
}
|
||||
|
||||
int
|
||||
main(void) {
|
||||
main(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
/* isc_hmac_new() */
|
||||
cmocka_unit_test(isc_hmac_new_test),
|
||||
|
||||
/* isc_hmac_init() */
|
||||
cmocka_unit_test_setup_teardown(isc_hmac_init_test,
|
||||
_reset, _reset),
|
||||
cmocka_unit_test_setup_teardown(isc_hmac_init_test, _reset,
|
||||
_reset),
|
||||
|
||||
/* isc_hmac_reset() */
|
||||
cmocka_unit_test_setup_teardown(isc_hmac_reset_test,
|
||||
_reset, _reset),
|
||||
cmocka_unit_test_setup_teardown(isc_hmac_reset_test, _reset,
|
||||
_reset),
|
||||
|
||||
/* isc_hmac_init() -> isc_hmac_update() -> isc_hmac_final() */
|
||||
cmocka_unit_test(isc_hmac_md5_test),
|
||||
@@ -941,10 +940,10 @@ main(void) {
|
||||
cmocka_unit_test(isc_hmac_sha384_test),
|
||||
cmocka_unit_test(isc_hmac_sha512_test),
|
||||
|
||||
cmocka_unit_test_setup_teardown(isc_hmac_update_test,
|
||||
_reset, _reset),
|
||||
cmocka_unit_test_setup_teardown(isc_hmac_final_test,
|
||||
_reset, _reset),
|
||||
cmocka_unit_test_setup_teardown(isc_hmac_update_test, _reset,
|
||||
_reset),
|
||||
cmocka_unit_test_setup_teardown(isc_hmac_final_test, _reset,
|
||||
_reset),
|
||||
|
||||
cmocka_unit_test(isc_hmac_free_test),
|
||||
};
|
||||
@@ -957,7 +956,8 @@ main(void) {
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(void) {
|
||||
main(void)
|
||||
{
|
||||
printf("1..0 # Skipped: cmocka not available\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user