]>
git.ipfire.org Git - people/ms/strongswan.git/blob - Source/testing/prf_plus_test.c
2 * @file prf_plus_test.h
4 * @brief Tests for the prf_plus_t class.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 #include "prf_plus_test.h"
27 #include <crypto/prf_plus.h>
31 * described in Header-File
33 void test_prf_plus(protected_tester_t
*tester
)
38 u_int8_t buffer
[10000];
41 u_int8_t key_bytes
[] = {
44 u_int8_t seed_bytes
[] = {
51 key
.len
= sizeof(key_bytes
);
52 seed
.ptr
= seed_bytes
;
53 seed
.len
= sizeof(seed_bytes
);
55 prf
= prf_create(PRF_HMAC_SHA1
);
56 prf
->set_key(prf
, key
);
58 prf_plus
= prf_plus_create(prf
, seed
);
63 prf_plus
->get_bytes(prf_plus
, i
*i
, buffer
);
67 //tester->assert_true(tester, digest[3].len == 20, "chunk len append mode");
68 //tester->assert_false(tester, memcmp(digest[3].ptr, reference[3].ptr, 20), "prf_plus value append mode");
70 prf_plus
->destroy(prf_plus
);
74 void test_prf_plus_md5(protected_tester_t
*tester
)
78 0x58,0xCC,0x4C,0xA3,0x81,0x81,0xDA,0x7D,
79 0x19,0xA6,0x9F,0xB1,0xE8,0xD3,0xE7,0x96,
80 0xC2,0x2A,0x6E,0xCB,0x09,0x43,0xDC,0x6E,
81 0x75,0x22,0x34,0xAE,0xF8,0x53,0x7F,0xEC,
82 0x00,0xC9,0xF6,0x1C,0x4A,0x39,0xB4,0x29,
83 0x23,0xD8,0x24,0x22,0x95,0x52,0x77,0x29
86 u_int8_t shared_key[] = {
87 0xC0,0xDB,0x75,0x0A,0x40,0xBE,0xE2,0x8C,0x68,0x3C,0xB4,0xAA,0xE7,0xA7,0x6E,0xCC,
88 0x2A,0x4B,0x9C,0x8E,0xC6,0x71,0xAD,0xF4,0xB7,0xC4,0xD6,0x53,0x41,0xB3,0x4A,0xE4,
89 0x0D,0xC2,0x0C,0x60,0x9F,0x93,0x9E,0x87,0x30,0xCC,0xDC,0x51,0x9F,0x94,0x91,0x5D,
90 0x31,0xE0,0x6E,0x22,0x3A,0x66,0x53,0xA6,0xD4,0x54,0x5E,0x71,0x61,0xA6,0x64,0x3B,
91 0x19,0x40,0x6E,0x6F,0x3B,0xE3,0x64,0x3F,0x3B,0x68,0xEB,0x8E,0x4B,0x2A,0x53,0xEC,
92 0xB0,0xB6,0x8E,0x5C,0x42,0xA1,0xC2,0x7F,0x4F,0x0B,0x7D,0xFC,0xF6,0x7E,0xF5,0xC0,
93 0xBA,0xA8,0xFB,0x13,0xEF,0xA8,0xBD,0x90,0x95,0x08,0x2C,0x81,0xA9,0xDA,0x7D,0x45,
94 0xDC,0x35,0x33,0x75,0xA8,0x4D,0xE2,0x34,0xA9,0x66,0x7F,0xAD,0x04,0x3A,0xE5,0x21
97 u_int8_t skeyseed[] = {