test_eap_sim_common.c
Go to the documentation of this file.
00001 /*
00002  * Test program for EAP-SIM PRF
00003  * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation.
00008  *
00009  * Alternatively, this software may be distributed under the terms of BSD
00010  * license.
00011  *
00012  * See README and COPYING for more details.
00013  */
00014 
00015 #include "eap_common/eap_sim_common.c"
00016 
00017 
00018 static int test_eap_sim_prf(void)
00019 {
00020         /* http://csrc.nist.gov/encryption/dss/Examples-1024bit.pdf */
00021         u8 xkey[] = {
00022                 0xbd, 0x02, 0x9b, 0xbe, 0x7f, 0x51, 0x96, 0x0b,
00023                 0xcf, 0x9e, 0xdb, 0x2b, 0x61, 0xf0, 0x6f, 0x0f,
00024                 0xeb, 0x5a, 0x38, 0xb6
00025         };
00026         u8 w[] = {
00027                 0x20, 0x70, 0xb3, 0x22, 0x3d, 0xba, 0x37, 0x2f,
00028                 0xde, 0x1c, 0x0f, 0xfc, 0x7b, 0x2e, 0x3b, 0x49,
00029                 0x8b, 0x26, 0x06, 0x14, 0x3c, 0x6c, 0x18, 0xba,
00030                 0xcb, 0x0f, 0x6c, 0x55, 0xba, 0xbb, 0x13, 0x78,
00031                 0x8e, 0x20, 0xd7, 0x37, 0xa3, 0x27, 0x51, 0x16
00032         };
00033         u8 buf[40];
00034 
00035         printf("Testing EAP-SIM PRF (FIPS 186-2 + change notice 1)\n");
00036         eap_sim_prf(xkey, buf, sizeof(buf));
00037         if (memcmp(w, buf, sizeof(w) != 0)) {
00038                 printf("eap_sim_prf failed\n");
00039                 return 1;
00040         }
00041 
00042         return 0;
00043 }
00044 
00045 
00046 int main(int argc, char *argv[])
00047 {
00048         int errors = 0;
00049 
00050         errors += test_eap_sim_prf();
00051 
00052         return errors;
00053 }


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:36