50 RCSID(
"$Id: 2f9da199428902824666050e86c23d5345f526f9 $")
52 #include <freeradius-devel/util/sha1.h>
71 for(i = 19; i >= 0; i--) {
72 s = a->
p[i] + b->
p[i] + carry;
95 onesixty xval, xkey, w_0, w_1, sum, one;
112 memcpy(&xkey, mk,
sizeof(xkey));
115 memset(&one, 0,
sizeof(one));
120 for (j = 0; j < 4; j++) {
128 memcpy(
zeros, xval.
p, 20);
129 #ifndef WITH_OPENSSL_SHA1
147 memcpy(
zeros, xval.
p, 20);
148 #ifndef WITH_OPENSSL_SHA1
168 #ifdef TESTING_FIPS186_PRF
172 #include <freeradius-devel/util/acutest.h>
221 static uint8_t xkey[] = { 0xbd, 0x02, 0x9b, 0xbe, 0x7f, 0x51, 0x96, 0x0b,
222 0xcf, 0x9e, 0xdb, 0x2b, 0x61, 0xf0, 0x6f, 0x0f,
223 0xeb, 0x5a, 0x38, 0xb6 };
225 static uint8_t exp[] = { 0x20, 0x70, 0xb3, 0x22, 0x3d, 0xba, 0x37, 0x2f,
226 0xde, 0x1c, 0x0f, 0xfc, 0x7b, 0x2e, 0x3b, 0x49,
227 0x8b, 0x26, 0x06, 0x14, 0x3c, 0x6c, 0x18, 0xba,
228 0xcb, 0x0f, 0x6c, 0x55, 0xba, 0xbb, 0x13, 0x78,
229 0x8e, 0x20, 0xd7, 0x37, 0xa3, 0x27, 0x51, 0x16 };
231 static void test_fips186prf(
void)
235 fr_sim_fips186_2prf(res, xkey);
237 TEST_CHECK(memcmp(exp, res,
sizeof(exp)) == 0);
242 {
"test_fips186prf", test_fips186prf },
void fr_aka_sim_fips186_2prf(uint8_t out[static 160], uint8_t mk[static 20])
Implement the FIPS-186-2 PRF to derive keying material from the MK.
static void onesixty_add_mod(onesixty *sum, onesixty *a, onesixty *b)
static const uint8_t zeros[RADIUS_AUTH_VECTOR_LENGTH]
void fr_sha1_init(fr_sha1_ctx *context)
void fr_sha1_final_no_len(uint8_t digest[static SHA1_DIGEST_LENGTH], fr_sha1_ctx *context)
void fr_sha1_transform(uint32_t state[static 5], uint8_t const buffer[static 64])
Master include file to access all functions and structures in the library.
static size_t char ** out