00001
00025 #include "includes.h"
00026
00027 #include "common.h"
00028 #include "milenage.h"
00029 #include "aes_wrap.h"
00030
00031
00043 static void milenage_f1(const u8 *opc, const u8 *k, const u8 *_rand,
00044 const u8 *sqn, const u8 *amf, u8 *mac_a, u8 *mac_s)
00045 {
00046 u8 tmp1[16], tmp2[16], tmp3[16];
00047 int i;
00048
00049
00050 for (i = 0; i < 16; i++)
00051 tmp1[i] = _rand[i] ^ opc[i];
00052 aes_128_encrypt_block(k, tmp1, tmp1);
00053
00054
00055 memcpy(tmp2, sqn, 6);
00056 memcpy(tmp2 + 6, amf, 2);
00057 memcpy(tmp2 + 8, tmp2, 8);
00058
00059
00060
00061
00062 for (i = 0; i < 16; i++)
00063 tmp3[(i + 8) % 16] = tmp2[i] ^ opc[i];
00064
00065 for (i = 0; i < 16; i++)
00066 tmp3[i] ^= tmp1[i];
00067
00068
00069
00070 aes_128_encrypt_block(k, tmp3, tmp1);
00071 for (i = 0; i < 16; i++)
00072 tmp1[i] ^= opc[i];
00073 if (mac_a)
00074 memcpy(mac_a, tmp1, 8);
00075 if (mac_s)
00076 memcpy(mac_s, tmp1 + 8, 8);
00077 }
00078
00079
00092 static void milenage_f2345(const u8 *opc, const u8 *k, const u8 *_rand,
00093 u8 *res, u8 *ck, u8 *ik, u8 *ak, u8 *akstar)
00094 {
00095 u8 tmp1[16], tmp2[16], tmp3[16];
00096 int i;
00097
00098
00099 for (i = 0; i < 16; i++)
00100 tmp1[i] = _rand[i] ^ opc[i];
00101 aes_128_encrypt_block(k, tmp1, tmp2);
00102
00103
00104
00105
00106
00107
00108
00109
00110 for (i = 0; i < 16; i++)
00111 tmp1[i] = tmp2[i] ^ opc[i];
00112 tmp1[15] ^= 1;
00113
00114 aes_128_encrypt_block(k, tmp1, tmp3);
00115 for (i = 0; i < 16; i++)
00116 tmp3[i] ^= opc[i];
00117 if (res)
00118 memcpy(res, tmp3 + 8, 8);
00119 if (ak)
00120 memcpy(ak, tmp3, 6);
00121
00122
00123 if (ck) {
00124
00125 for (i = 0; i < 16; i++)
00126 tmp1[(i + 12) % 16] = tmp2[i] ^ opc[i];
00127 tmp1[15] ^= 2;
00128 aes_128_encrypt_block(k, tmp1, ck);
00129 for (i = 0; i < 16; i++)
00130 ck[i] ^= opc[i];
00131 }
00132
00133
00134 if (ik) {
00135
00136 for (i = 0; i < 16; i++)
00137 tmp1[(i + 8) % 16] = tmp2[i] ^ opc[i];
00138 tmp1[15] ^= 4;
00139 aes_128_encrypt_block(k, tmp1, ik);
00140 for (i = 0; i < 16; i++)
00141 ik[i] ^= opc[i];
00142 }
00143
00144
00145 if (akstar) {
00146
00147 for (i = 0; i < 16; i++)
00148 tmp1[(i + 4) % 16] = tmp2[i] ^ opc[i];
00149 tmp1[15] ^= 8;
00150 aes_128_encrypt_block(k, tmp1, tmp1);
00151 for (i = 0; i < 6; i++)
00152 akstar[i] = tmp1[i] ^ opc[i];
00153 }
00154 }
00155
00156
00171 void milenage_generate(const u8 *opc, const u8 *amf, const u8 *k,
00172 const u8 *sqn, const u8 *_rand, u8 *autn, u8 *ik,
00173 u8 *ck, u8 *res, size_t *res_len)
00174 {
00175 int i;
00176 u8 mac_a[16], ak[6];
00177
00178 if (*res_len < 8) {
00179 *res_len = 0;
00180 return;
00181 }
00182 *res_len = 8;
00183 milenage_f1(opc, k, _rand, sqn, amf, mac_a, NULL);
00184 milenage_f2345(opc, k, _rand, res, ck, ik, ak, NULL);
00185
00186
00187 for (i = 0; i < 6; i++)
00188 autn[i] = sqn[i] ^ ak[i];
00189 memcpy(autn + 6, amf, 2);
00190 memcpy(autn + 8, mac_a, 8);
00191 }
00192
00193
00204 int milenage_auts(const u8 *opc, const u8 *k, const u8 *_rand, const u8 *auts,
00205 u8 *sqn)
00206 {
00207 u8 amf[2] = { 0x00, 0x00 };
00208 u8 ak[6], mac_s[8];
00209 int i;
00210
00211 milenage_f2345(opc, k, _rand, NULL, NULL, NULL, NULL, ak);
00212 for (i = 0; i < 6; i++)
00213 sqn[i] = auts[i] ^ ak[i];
00214 milenage_f1(opc, k, _rand, sqn, amf, NULL, mac_s);
00215 if (memcmp(mac_s, auts + 6, 8) != 0)
00216 return -1;
00217 return 0;
00218 }
00219
00220
00230 void gsm_milenage(const u8 *opc, const u8 *k, const u8 *_rand, u8 *sres,
00231 u8 *kc)
00232 {
00233 u8 res[8], ck[16], ik[16];
00234 int i;
00235
00236 milenage_f2345(opc, k, _rand, res, ck, ik, NULL, NULL);
00237
00238 for (i = 0; i < 8; i++)
00239 kc[i] = ck[i] ^ ck[i + 8] ^ ik[i] ^ ik[i + 8];
00240
00241 #ifdef GSM_MILENAGE_ALT_SRES
00242 memcpy(sres, res, 4);
00243 #else
00244 for (i = 0; i < 4; i++)
00245 sres[i] = res[i] ^ res[i + 4];
00246 #endif
00247 }
00248
00249
00250 #ifdef TEST_MAIN_MILENAGE
00251
00252 extern int wpa_debug_level;
00253
00254
00262 static void milenage_opc(const u8 *op, const u8 *k, u8 *opc)
00263 {
00264 int i;
00265
00266 aes_128_encrypt_block(k, op, opc);
00267 for (i = 0; i < 16; i++)
00268 opc[i] ^= op[i];
00269 }
00270
00271
00272 struct gsm_milenage_test_set {
00273 u8 ki[16];
00274 u8 rand[16];
00275 u8 opc[16];
00276 u8 sres1[4];
00277 u8 sres2[4];
00278 u8 kc[8];
00279 };
00280
00281 static const struct gsm_milenage_test_set gsm_test_sets[] =
00282 {
00283 {
00284
00285 { 0x46, 0x5b, 0x5c, 0xe8, 0xb1, 0x99, 0xb4, 0x9f,
00286 0xaa, 0x5f, 0x0a, 0x2e, 0xe2, 0x38, 0xa6, 0xbc },
00287 { 0x23, 0x55, 0x3c, 0xbe, 0x96, 0x37, 0xa8, 0x9d,
00288 0x21, 0x8a, 0xe6, 0x4d, 0xae, 0x47, 0xbf, 0x35 },
00289 { 0xcd, 0x63, 0xcb, 0x71, 0x95, 0x4a, 0x9f, 0x4e,
00290 0x48, 0xa5, 0x99, 0x4e, 0x37, 0xa0, 0x2b, 0xaf },
00291 { 0x46, 0xf8, 0x41, 0x6a },
00292 { 0xa5, 0x42, 0x11, 0xd5 },
00293 { 0xea, 0xe4, 0xbe, 0x82, 0x3a, 0xf9, 0xa0, 0x8b }
00294 }, {
00295
00296 { 0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0,
00297 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f },
00298 { 0x9f, 0x7c, 0x8d, 0x02, 0x1a, 0xcc, 0xf4, 0xdb,
00299 0x21, 0x3c, 0xcf, 0xf0, 0xc7, 0xf7, 0x1a, 0x6a },
00300 { 0x10, 0x06, 0x02, 0x0f, 0x0a, 0x47, 0x8b, 0xf6,
00301 0xb6, 0x99, 0xf1, 0x5c, 0x06, 0x2e, 0x42, 0xb3 },
00302 { 0x8c, 0x30, 0x8a, 0x5e },
00303 { 0x80, 0x11, 0xc4, 0x8c },
00304 { 0xaa, 0x01, 0x73, 0x9b, 0x8c, 0xaa, 0x97, 0x6d }
00305 }, {
00306
00307 { 0x9e, 0x59, 0x44, 0xae, 0xa9, 0x4b, 0x81, 0x16,
00308 0x5c, 0x82, 0xfb, 0xf9, 0xf3, 0x2d, 0xb7, 0x51 },
00309 { 0xce, 0x83, 0xdb, 0xc5, 0x4a, 0xc0, 0x27, 0x4a,
00310 0x15, 0x7c, 0x17, 0xf8, 0x0d, 0x01, 0x7b, 0xd6 },
00311 { 0xa6, 0x4a, 0x50, 0x7a, 0xe1, 0xa2, 0xa9, 0x8b,
00312 0xb8, 0x8e, 0xb4, 0x21, 0x01, 0x35, 0xdc, 0x87 },
00313 { 0xcf, 0xbc, 0xe3, 0xfe },
00314 { 0xf3, 0x65, 0xcd, 0x68 },
00315 { 0x9a, 0x8e, 0xc9, 0x5f, 0x40, 0x8c, 0xc5, 0x07 }
00316 }, {
00317
00318 { 0x4a, 0xb1, 0xde, 0xb0, 0x5c, 0xa6, 0xce, 0xb0,
00319 0x51, 0xfc, 0x98, 0xe7, 0x7d, 0x02, 0x6a, 0x84 },
00320 { 0x74, 0xb0, 0xcd, 0x60, 0x31, 0xa1, 0xc8, 0x33,
00321 0x9b, 0x2b, 0x6c, 0xe2, 0xb8, 0xc4, 0xa1, 0x86 },
00322 { 0xdc, 0xf0, 0x7c, 0xbd, 0x51, 0x85, 0x52, 0x90,
00323 0xb9, 0x2a, 0x07, 0xa9, 0x89, 0x1e, 0x52, 0x3e },
00324 { 0x96, 0x55, 0xe2, 0x65 },
00325 { 0x58, 0x60, 0xfc, 0x1b },
00326 { 0xcd, 0xc1, 0xdc, 0x08, 0x41, 0xb8, 0x1a, 0x22 }
00327 }, {
00328
00329 { 0x6c, 0x38, 0xa1, 0x16, 0xac, 0x28, 0x0c, 0x45,
00330 0x4f, 0x59, 0x33, 0x2e, 0xe3, 0x5c, 0x8c, 0x4f },
00331 { 0xee, 0x64, 0x66, 0xbc, 0x96, 0x20, 0x2c, 0x5a,
00332 0x55, 0x7a, 0xbb, 0xef, 0xf8, 0xba, 0xbf, 0x63 },
00333 { 0x38, 0x03, 0xef, 0x53, 0x63, 0xb9, 0x47, 0xc6,
00334 0xaa, 0xa2, 0x25, 0xe5, 0x8f, 0xae, 0x39, 0x34 },
00335 { 0x13, 0x68, 0x8f, 0x17 },
00336 { 0x16, 0xc8, 0x23, 0x3f },
00337 { 0xdf, 0x75, 0xbc, 0x5e, 0xa8, 0x99, 0x87, 0x9f }
00338 }, {
00339
00340 { 0x2d, 0x60, 0x9d, 0x4d, 0xb0, 0xac, 0x5b, 0xf0,
00341 0xd2, 0xc0, 0xde, 0x26, 0x70, 0x14, 0xde, 0x0d },
00342 { 0x19, 0x4a, 0xa7, 0x56, 0x01, 0x38, 0x96, 0xb7,
00343 0x4b, 0x4a, 0x2a, 0x3b, 0x0a, 0xf4, 0x53, 0x9e },
00344 { 0xc3, 0x5a, 0x0a, 0xb0, 0xbc, 0xbf, 0xc9, 0x25,
00345 0x2c, 0xaf, 0xf1, 0x5f, 0x24, 0xef, 0xbd, 0xe0 },
00346 { 0x55, 0x3d, 0x00, 0xb3 },
00347 { 0x8c, 0x25, 0xa1, 0x6c },
00348 { 0x84, 0xb4, 0x17, 0xae, 0x3a, 0xea, 0xb4, 0xf3 }
00349 }, {
00350
00351 { 0xa5, 0x30, 0xa7, 0xfe, 0x42, 0x8f, 0xad, 0x10,
00352 0x82, 0xc4, 0x5e, 0xdd, 0xfc, 0xe1, 0x38, 0x84 },
00353 { 0x3a, 0x4c, 0x2b, 0x32, 0x45, 0xc5, 0x0e, 0xb5,
00354 0xc7, 0x1d, 0x08, 0x63, 0x93, 0x95, 0x76, 0x4d },
00355 { 0x27, 0x95, 0x3e, 0x49, 0xbc, 0x8a, 0xf6, 0xdc,
00356 0xc6, 0xe7, 0x30, 0xeb, 0x80, 0x28, 0x6b, 0xe3 },
00357 { 0x59, 0xf1, 0xa4, 0x4a },
00358 { 0xa6, 0x32, 0x41, 0xe1 },
00359 { 0x3b, 0x4e, 0x24, 0x4c, 0xdc, 0x60, 0xce, 0x03 }
00360 }, {
00361
00362 { 0xd9, 0x15, 0x1c, 0xf0, 0x48, 0x96, 0xe2, 0x58,
00363 0x30, 0xbf, 0x2e, 0x08, 0x26, 0x7b, 0x83, 0x60 },
00364 { 0xf7, 0x61, 0xe5, 0xe9, 0x3d, 0x60, 0x3f, 0xeb,
00365 0x73, 0x0e, 0x27, 0x55, 0x6c, 0xb8, 0xa2, 0xca },
00366 { 0xc4, 0xc9, 0x3e, 0xff, 0xe8, 0xa0, 0x81, 0x38,
00367 0xc2, 0x03, 0xd4, 0xc2, 0x7c, 0xe4, 0xe3, 0xd9 },
00368 { 0x50, 0x58, 0x88, 0x61 },
00369 { 0x4a, 0x90, 0xb2, 0x17 },
00370 { 0x8d, 0x4e, 0xc0, 0x1d, 0xe5, 0x97, 0xac, 0xfe }
00371 }, {
00372
00373 { 0xa0, 0xe2, 0x97, 0x1b, 0x68, 0x22, 0xe8, 0xd3,
00374 0x54, 0xa1, 0x8c, 0xc2, 0x35, 0x62, 0x4e, 0xcb },
00375 { 0x08, 0xef, 0xf8, 0x28, 0xb1, 0x3f, 0xdb, 0x56,
00376 0x27, 0x22, 0xc6, 0x5c, 0x7f, 0x30, 0xa9, 0xb2 },
00377 { 0x82, 0xa2, 0x6f, 0x22, 0xbb, 0xa9, 0xe9, 0x48,
00378 0x8f, 0x94, 0x9a, 0x10, 0xd9, 0x8e, 0x9c, 0xc4 },
00379 { 0xcd, 0xe6, 0xb0, 0x27 },
00380 { 0x4b, 0xc2, 0x21, 0x2d },
00381 { 0xd8, 0xde, 0xbc, 0x4f, 0xfb, 0xcd, 0x60, 0xaa }
00382 }, {
00383
00384 { 0x0d, 0xa6, 0xf7, 0xba, 0x86, 0xd5, 0xea, 0xc8,
00385 0xa1, 0x9c, 0xf5, 0x63, 0xac, 0x58, 0x64, 0x2d },
00386 { 0x67, 0x9a, 0xc4, 0xdb, 0xac, 0xd7, 0xd2, 0x33,
00387 0xff, 0x9d, 0x68, 0x06, 0xf4, 0x14, 0x9c, 0xe3 },
00388 { 0x0d, 0xb1, 0x07, 0x1f, 0x87, 0x67, 0x56, 0x2c,
00389 0xa4, 0x3a, 0x0a, 0x64, 0xc4, 0x1e, 0x8d, 0x08 },
00390 { 0x02, 0xd1, 0x3a, 0xcd },
00391 { 0x6f, 0xc3, 0x0f, 0xee },
00392 { 0xf0, 0xea, 0xa5, 0x0a, 0x1e, 0xdc, 0xeb, 0xb7 }
00393 }, {
00394
00395 { 0x77, 0xb4, 0x58, 0x43, 0xc8, 0x8e, 0x58, 0xc1,
00396 0x0d, 0x20, 0x26, 0x84, 0x51, 0x5e, 0xd4, 0x30 },
00397 { 0x4c, 0x47, 0xeb, 0x30, 0x76, 0xdc, 0x55, 0xfe,
00398 0x51, 0x06, 0xcb, 0x20, 0x34, 0xb8, 0xcd, 0x78 },
00399 { 0xd4, 0x83, 0xaf, 0xae, 0x56, 0x24, 0x09, 0xa3,
00400 0x26, 0xb5, 0xbb, 0x0b, 0x20, 0xc4, 0xd7, 0x62 },
00401 { 0x44, 0x38, 0x9d, 0x01 },
00402 { 0xae, 0xfa, 0x35, 0x7b },
00403 { 0x82, 0xdb, 0xab, 0x7f, 0x83, 0xf0, 0x63, 0xda }
00404 }, {
00405
00406 { 0x72, 0x9b, 0x17, 0x72, 0x92, 0x70, 0xdd, 0x87,
00407 0xcc, 0xdf, 0x1b, 0xfe, 0x29, 0xb4, 0xe9, 0xbb },
00408 { 0x31, 0x1c, 0x4c, 0x92, 0x97, 0x44, 0xd6, 0x75,
00409 0xb7, 0x20, 0xf3, 0xb7, 0xe9, 0xb1, 0xcb, 0xd0 },
00410 { 0x22, 0x8c, 0x2f, 0x2f, 0x06, 0xac, 0x32, 0x68,
00411 0xa9, 0xe6, 0x16, 0xee, 0x16, 0xdb, 0x4b, 0xa1 },
00412 { 0x03, 0xe0, 0xfd, 0x84 },
00413 { 0x98, 0xdb, 0xbd, 0x09 },
00414 { 0x3c, 0x66, 0xcb, 0x98, 0xca, 0xb2, 0xd3, 0x3d }
00415 }, {
00416
00417 { 0xd3, 0x2d, 0xd2, 0x3e, 0x89, 0xdc, 0x66, 0x23,
00418 0x54, 0xca, 0x12, 0xeb, 0x79, 0xdd, 0x32, 0xfa },
00419 { 0xcf, 0x7d, 0x0a, 0xb1, 0xd9, 0x43, 0x06, 0x95,
00420 0x0b, 0xf1, 0x20, 0x18, 0xfb, 0xd4, 0x68, 0x87 },
00421 { 0xd2, 0x2a, 0x4b, 0x41, 0x80, 0xa5, 0x32, 0x57,
00422 0x08, 0xa5, 0xff, 0x70, 0xd9, 0xf6, 0x7e, 0xc7 },
00423 { 0xbe, 0x73, 0xb3, 0xdc },
00424 { 0xaf, 0x4a, 0x41, 0x1e },
00425 { 0x96, 0x12, 0xb5, 0xd8, 0x8a, 0x41, 0x30, 0xbb }
00426 }, {
00427
00428 { 0xaf, 0x7c, 0x65, 0xe1, 0x92, 0x72, 0x21, 0xde,
00429 0x59, 0x11, 0x87, 0xa2, 0xc5, 0x98, 0x7a, 0x53 },
00430 { 0x1f, 0x0f, 0x85, 0x78, 0x46, 0x4f, 0xd5, 0x9b,
00431 0x64, 0xbe, 0xd2, 0xd0, 0x94, 0x36, 0xb5, 0x7a },
00432 { 0xa4, 0xcf, 0x5c, 0x81, 0x55, 0xc0, 0x8a, 0x7e,
00433 0xff, 0x41, 0x8e, 0x54, 0x43, 0xb9, 0x8e, 0x55 },
00434 { 0x8f, 0xe0, 0x19, 0xc7 },
00435 { 0x7b, 0xff, 0xa5, 0xc2 },
00436 { 0x75, 0xa1, 0x50, 0xdf, 0x3c, 0x6a, 0xed, 0x08 }
00437 }, {
00438
00439 { 0x5b, 0xd7, 0xec, 0xd3, 0xd3, 0x12, 0x7a, 0x41,
00440 0xd1, 0x25, 0x39, 0xbe, 0xd4, 0xe7, 0xcf, 0x71 },
00441 { 0x59, 0xb7, 0x5f, 0x14, 0x25, 0x1c, 0x75, 0x03,
00442 0x1d, 0x0b, 0xcb, 0xac, 0x1c, 0x2c, 0x04, 0xc7 },
00443 { 0x76, 0x08, 0x9d, 0x3c, 0x0f, 0xf3, 0xef, 0xdc,
00444 0x6e, 0x36, 0x72, 0x1d, 0x4f, 0xce, 0xb7, 0x47 },
00445 { 0x27, 0x20, 0x2b, 0x82 },
00446 { 0x7e, 0x3f, 0x44, 0xc7 },
00447 { 0xb7, 0xf9, 0x2e, 0x42, 0x6a, 0x36, 0xfe, 0xc5 }
00448 }, {
00449
00450 { 0x6c, 0xd1, 0xc6, 0xce, 0xb1, 0xe0, 0x1e, 0x14,
00451 0xf1, 0xb8, 0x23, 0x16, 0xa9, 0x0b, 0x7f, 0x3d },
00452 { 0xf6, 0x9b, 0x78, 0xf3, 0x00, 0xa0, 0x56, 0x8b,
00453 0xce, 0x9f, 0x0c, 0xb9, 0x3c, 0x4b, 0xe4, 0xc9 },
00454 { 0xa2, 0x19, 0xdc, 0x37, 0xf1, 0xdc, 0x7d, 0x66,
00455 0x73, 0x8b, 0x58, 0x43, 0xc7, 0x99, 0xf2, 0x06 },
00456 { 0xdd, 0xd7, 0xef, 0xe6 },
00457 { 0x70, 0xf6, 0xbd, 0xb9 },
00458 { 0x88, 0xd9, 0xde, 0x10, 0xa2, 0x20, 0x04, 0xc5 }
00459 }, {
00460
00461 { 0xb7, 0x3a, 0x90, 0xcb, 0xcf, 0x3a, 0xfb, 0x62,
00462 0x2d, 0xba, 0x83, 0xc5, 0x8a, 0x84, 0x15, 0xdf },
00463 { 0xb1, 0x20, 0xf1, 0xc1, 0xa0, 0x10, 0x2a, 0x2f,
00464 0x50, 0x7d, 0xd5, 0x43, 0xde, 0x68, 0x28, 0x1f },
00465 { 0xdf, 0x0c, 0x67, 0x86, 0x8f, 0xa2, 0x5f, 0x74,
00466 0x8b, 0x70, 0x44, 0xc6, 0xe7, 0xc2, 0x45, 0xb8 },
00467 { 0x67, 0xe4, 0xff, 0x3f },
00468 { 0x47, 0x9d, 0xd2, 0x5c },
00469 { 0xa8, 0x19, 0xe5, 0x77, 0xa8, 0xd6, 0x17, 0x5b }
00470 }, {
00471
00472 { 0x51, 0x22, 0x25, 0x02, 0x14, 0xc3, 0x3e, 0x72,
00473 0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0 },
00474 { 0x81, 0xe9, 0x2b, 0x6c, 0x0e, 0xe0, 0xe1, 0x2e,
00475 0xbc, 0xeb, 0xa8, 0xd9, 0x2a, 0x99, 0xdf, 0xa5 },
00476 { 0x98, 0x1d, 0x46, 0x4c, 0x7c, 0x52, 0xeb, 0x6e,
00477 0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf },
00478 { 0x8a, 0x3b, 0x8d, 0x17 },
00479 { 0x28, 0xd7, 0xb0, 0xf2 },
00480 { 0x9a, 0x8d, 0x0e, 0x88, 0x3f, 0xf0, 0x88, 0x7a }
00481 }, {
00482
00483 { 0x90, 0xdc, 0xa4, 0xed, 0xa4, 0x5b, 0x53, 0xcf,
00484 0x0f, 0x12, 0xd7, 0xc9, 0xc3, 0xbc, 0x6a, 0x89 },
00485 { 0x9f, 0xdd, 0xc7, 0x20, 0x92, 0xc6, 0xad, 0x03,
00486 0x6b, 0x6e, 0x46, 0x47, 0x89, 0x31, 0x5b, 0x78 },
00487 { 0xcb, 0x9c, 0xcc, 0xc4, 0xb9, 0x25, 0x8e, 0x6d,
00488 0xca, 0x47, 0x60, 0x37, 0x9f, 0xb8, 0x25, 0x81 },
00489 { 0xdf, 0x58, 0x52, 0x2f },
00490 { 0xa9, 0x51, 0x00, 0xe2 },
00491 { 0xed, 0x29, 0xb2, 0xf1, 0xc2, 0x7f, 0x9f, 0x34 }
00492 }
00493 };
00494
00495 #define NUM_GSM_TESTS (sizeof(gsm_test_sets) / sizeof(gsm_test_sets[0]))
00496
00497
00498 struct milenage_test_set {
00499 u8 k[16];
00500 u8 rand[16];
00501 u8 sqn[6];
00502 u8 amf[2];
00503 u8 op[16];
00504 u8 opc[16];
00505 u8 f1[8];
00506 u8 f1star[8];
00507 u8 f2[8];
00508 u8 f3[16];
00509 u8 f4[16];
00510 u8 f5[6];
00511 u8 f5star[6];
00512 };
00513
00514 static const struct milenage_test_set test_sets[] =
00515 {
00516 {
00517
00518 { 0x46, 0x5b, 0x5c, 0xe8, 0xb1, 0x99, 0xb4, 0x9f,
00519 0xaa, 0x5f, 0x0a, 0x2e, 0xe2, 0x38, 0xa6, 0xbc },
00520 { 0x23, 0x55, 0x3c, 0xbe, 0x96, 0x37, 0xa8, 0x9d,
00521 0x21, 0x8a, 0xe6, 0x4d, 0xae, 0x47, 0xbf, 0x35 },
00522 { 0xff, 0x9b, 0xb4, 0xd0, 0xb6, 0x07 },
00523 { 0xb9, 0xb9 },
00524 { 0xcd, 0xc2, 0x02, 0xd5, 0x12, 0x3e, 0x20, 0xf6,
00525 0x2b, 0x6d, 0x67, 0x6a, 0xc7, 0x2c, 0xb3, 0x18 },
00526 { 0xcd, 0x63, 0xcb, 0x71, 0x95, 0x4a, 0x9f, 0x4e,
00527 0x48, 0xa5, 0x99, 0x4e, 0x37, 0xa0, 0x2b, 0xaf },
00528 { 0x4a, 0x9f, 0xfa, 0xc3, 0x54, 0xdf, 0xaf, 0xb3 },
00529 { 0x01, 0xcf, 0xaf, 0x9e, 0xc4, 0xe8, 0x71, 0xe9 },
00530 { 0xa5, 0x42, 0x11, 0xd5, 0xe3, 0xba, 0x50, 0xbf },
00531 { 0xb4, 0x0b, 0xa9, 0xa3, 0xc5, 0x8b, 0x2a, 0x05,
00532 0xbb, 0xf0, 0xd9, 0x87, 0xb2, 0x1b, 0xf8, 0xcb },
00533 { 0xf7, 0x69, 0xbc, 0xd7, 0x51, 0x04, 0x46, 0x04,
00534 0x12, 0x76, 0x72, 0x71, 0x1c, 0x6d, 0x34, 0x41 },
00535 { 0xaa, 0x68, 0x9c, 0x64, 0x83, 0x70 },
00536 { 0x45, 0x1e, 0x8b, 0xec, 0xa4, 0x3b }
00537 }, {
00538
00539 { 0x46, 0x5b, 0x5c, 0xe8, 0xb1, 0x99, 0xb4, 0x9f,
00540 0xaa, 0x5f, 0x0a, 0x2e, 0xe2, 0x38, 0xa6, 0xbc },
00541 { 0x23, 0x55, 0x3c, 0xbe, 0x96, 0x37, 0xa8, 0x9d,
00542 0x21, 0x8a, 0xe6, 0x4d, 0xae, 0x47, 0xbf, 0x35 },
00543 { 0xff, 0x9b, 0xb4, 0xd0, 0xb6, 0x07 },
00544 { 0xb9, 0xb9 },
00545 { 0xcd, 0xc2, 0x02, 0xd5, 0x12, 0x3e, 0x20, 0xf6,
00546 0x2b, 0x6d, 0x67, 0x6a, 0xc7, 0x2c, 0xb3, 0x18 },
00547 { 0xcd, 0x63, 0xcb, 0x71, 0x95, 0x4a, 0x9f, 0x4e,
00548 0x48, 0xa5, 0x99, 0x4e, 0x37, 0xa0, 0x2b, 0xaf },
00549 { 0x4a, 0x9f, 0xfa, 0xc3, 0x54, 0xdf, 0xaf, 0xb3 },
00550 { 0x01, 0xcf, 0xaf, 0x9e, 0xc4, 0xe8, 0x71, 0xe9 },
00551 { 0xa5, 0x42, 0x11, 0xd5, 0xe3, 0xba, 0x50, 0xbf },
00552 { 0xb4, 0x0b, 0xa9, 0xa3, 0xc5, 0x8b, 0x2a, 0x05,
00553 0xbb, 0xf0, 0xd9, 0x87, 0xb2, 0x1b, 0xf8, 0xcb },
00554 { 0xf7, 0x69, 0xbc, 0xd7, 0x51, 0x04, 0x46, 0x04,
00555 0x12, 0x76, 0x72, 0x71, 0x1c, 0x6d, 0x34, 0x41 },
00556 { 0xaa, 0x68, 0x9c, 0x64, 0x83, 0x70 },
00557 { 0x45, 0x1e, 0x8b, 0xec, 0xa4, 0x3b }
00558 }, {
00559
00560 { 0xfe, 0xc8, 0x6b, 0xa6, 0xeb, 0x70, 0x7e, 0xd0,
00561 0x89, 0x05, 0x75, 0x7b, 0x1b, 0xb4, 0x4b, 0x8f },
00562 { 0x9f, 0x7c, 0x8d, 0x02, 0x1a, 0xcc, 0xf4, 0xdb,
00563 0x21, 0x3c, 0xcf, 0xf0, 0xc7, 0xf7, 0x1a, 0x6a },
00564 { 0x9d, 0x02, 0x77, 0x59, 0x5f, 0xfc },
00565 { 0x72, 0x5c },
00566 { 0xdb, 0xc5, 0x9a, 0xdc, 0xb6, 0xf9, 0xa0, 0xef,
00567 0x73, 0x54, 0x77, 0xb7, 0xfa, 0xdf, 0x83, 0x74 },
00568 { 0x10, 0x06, 0x02, 0x0f, 0x0a, 0x47, 0x8b, 0xf6,
00569 0xb6, 0x99, 0xf1, 0x5c, 0x06, 0x2e, 0x42, 0xb3 },
00570 { 0x9c, 0xab, 0xc3, 0xe9, 0x9b, 0xaf, 0x72, 0x81 },
00571 { 0x95, 0x81, 0x4b, 0xa2, 0xb3, 0x04, 0x43, 0x24 },
00572 { 0x80, 0x11, 0xc4, 0x8c, 0x0c, 0x21, 0x4e, 0xd2 },
00573 { 0x5d, 0xbd, 0xbb, 0x29, 0x54, 0xe8, 0xf3, 0xcd,
00574 0xe6, 0x65, 0xb0, 0x46, 0x17, 0x9a, 0x50, 0x98 },
00575 { 0x59, 0xa9, 0x2d, 0x3b, 0x47, 0x6a, 0x04, 0x43,
00576 0x48, 0x70, 0x55, 0xcf, 0x88, 0xb2, 0x30, 0x7b },
00577 { 0x33, 0x48, 0x4d, 0xc2, 0x13, 0x6b },
00578 { 0xde, 0xac, 0xdd, 0x84, 0x8c, 0xc6 }
00579 }, {
00580
00581 { 0x9e, 0x59, 0x44, 0xae, 0xa9, 0x4b, 0x81, 0x16,
00582 0x5c, 0x82, 0xfb, 0xf9, 0xf3, 0x2d, 0xb7, 0x51 },
00583 { 0xce, 0x83, 0xdb, 0xc5, 0x4a, 0xc0, 0x27, 0x4a,
00584 0x15, 0x7c, 0x17, 0xf8, 0x0d, 0x01, 0x7b, 0xd6 },
00585 { 0x0b, 0x60, 0x4a, 0x81, 0xec, 0xa8 },
00586 { 0x9e, 0x09 },
00587 { 0x22, 0x30, 0x14, 0xc5, 0x80, 0x66, 0x94, 0xc0,
00588 0x07, 0xca, 0x1e, 0xee, 0xf5, 0x7f, 0x00, 0x4f },
00589 { 0xa6, 0x4a, 0x50, 0x7a, 0xe1, 0xa2, 0xa9, 0x8b,
00590 0xb8, 0x8e, 0xb4, 0x21, 0x01, 0x35, 0xdc, 0x87 },
00591 { 0x74, 0xa5, 0x82, 0x20, 0xcb, 0xa8, 0x4c, 0x49 },
00592 { 0xac, 0x2c, 0xc7, 0x4a, 0x96, 0x87, 0x18, 0x37 },
00593 { 0xf3, 0x65, 0xcd, 0x68, 0x3c, 0xd9, 0x2e, 0x96 },
00594 { 0xe2, 0x03, 0xed, 0xb3, 0x97, 0x15, 0x74, 0xf5,
00595 0xa9, 0x4b, 0x0d, 0x61, 0xb8, 0x16, 0x34, 0x5d },
00596 { 0x0c, 0x45, 0x24, 0xad, 0xea, 0xc0, 0x41, 0xc4,
00597 0xdd, 0x83, 0x0d, 0x20, 0x85, 0x4f, 0xc4, 0x6b },
00598 { 0xf0, 0xb9, 0xc0, 0x8a, 0xd0, 0x2e },
00599 { 0x60, 0x85, 0xa8, 0x6c, 0x6f, 0x63 }
00600 }, {
00601
00602 { 0x4a, 0xb1, 0xde, 0xb0, 0x5c, 0xa6, 0xce, 0xb0,
00603 0x51, 0xfc, 0x98, 0xe7, 0x7d, 0x02, 0x6a, 0x84 },
00604 { 0x74, 0xb0, 0xcd, 0x60, 0x31, 0xa1, 0xc8, 0x33,
00605 0x9b, 0x2b, 0x6c, 0xe2, 0xb8, 0xc4, 0xa1, 0x86 },
00606 { 0xe8, 0x80, 0xa1, 0xb5, 0x80, 0xb6 },
00607 { 0x9f, 0x07 },
00608 { 0x2d, 0x16, 0xc5, 0xcd, 0x1f, 0xdf, 0x6b, 0x22,
00609 0x38, 0x35, 0x84, 0xe3, 0xbe, 0xf2, 0xa8, 0xd8 },
00610 { 0xdc, 0xf0, 0x7c, 0xbd, 0x51, 0x85, 0x52, 0x90,
00611 0xb9, 0x2a, 0x07, 0xa9, 0x89, 0x1e, 0x52, 0x3e },
00612 { 0x49, 0xe7, 0x85, 0xdd, 0x12, 0x62, 0x6e, 0xf2 },
00613 { 0x9e, 0x85, 0x79, 0x03, 0x36, 0xbb, 0x3f, 0xa2 },
00614 { 0x58, 0x60, 0xfc, 0x1b, 0xce, 0x35, 0x1e, 0x7e },
00615 { 0x76, 0x57, 0x76, 0x6b, 0x37, 0x3d, 0x1c, 0x21,
00616 0x38, 0xf3, 0x07, 0xe3, 0xde, 0x92, 0x42, 0xf9 },
00617 { 0x1c, 0x42, 0xe9, 0x60, 0xd8, 0x9b, 0x8f, 0xa9,
00618 0x9f, 0x27, 0x44, 0xe0, 0x70, 0x8c, 0xcb, 0x53 },
00619 { 0x31, 0xe1, 0x1a, 0x60, 0x91, 0x18 },
00620 { 0xfe, 0x25, 0x55, 0xe5, 0x4a, 0xa9 }
00621 }, {
00622
00623 { 0x6c, 0x38, 0xa1, 0x16, 0xac, 0x28, 0x0c, 0x45,
00624 0x4f, 0x59, 0x33, 0x2e, 0xe3, 0x5c, 0x8c, 0x4f },
00625 { 0xee, 0x64, 0x66, 0xbc, 0x96, 0x20, 0x2c, 0x5a,
00626 0x55, 0x7a, 0xbb, 0xef, 0xf8, 0xba, 0xbf, 0x63 },
00627 { 0x41, 0x4b, 0x98, 0x22, 0x21, 0x81 },
00628 { 0x44, 0x64 },
00629 { 0x1b, 0xa0, 0x0a, 0x1a, 0x7c, 0x67, 0x00, 0xac,
00630 0x8c, 0x3f, 0xf3, 0xe9, 0x6a, 0xd0, 0x87, 0x25 },
00631 { 0x38, 0x03, 0xef, 0x53, 0x63, 0xb9, 0x47, 0xc6,
00632 0xaa, 0xa2, 0x25, 0xe5, 0x8f, 0xae, 0x39, 0x34 },
00633 { 0x07, 0x8a, 0xdf, 0xb4, 0x88, 0x24, 0x1a, 0x57 },
00634 { 0x80, 0x24, 0x6b, 0x8d, 0x01, 0x86, 0xbc, 0xf1 },
00635 { 0x16, 0xc8, 0x23, 0x3f, 0x05, 0xa0, 0xac, 0x28 },
00636 { 0x3f, 0x8c, 0x75, 0x87, 0xfe, 0x8e, 0x4b, 0x23,
00637 0x3a, 0xf6, 0x76, 0xae, 0xde, 0x30, 0xba, 0x3b },
00638 { 0xa7, 0x46, 0x6c, 0xc1, 0xe6, 0xb2, 0xa1, 0x33,
00639 0x7d, 0x49, 0xd3, 0xb6, 0x6e, 0x95, 0xd7, 0xb4 },
00640 { 0x45, 0xb0, 0xf6, 0x9a, 0xb0, 0x6c },
00641 { 0x1f, 0x53, 0xcd, 0x2b, 0x11, 0x13 }
00642 }, {
00643
00644 { 0x2d, 0x60, 0x9d, 0x4d, 0xb0, 0xac, 0x5b, 0xf0,
00645 0xd2, 0xc0, 0xde, 0x26, 0x70, 0x14, 0xde, 0x0d },
00646 { 0x19, 0x4a, 0xa7, 0x56, 0x01, 0x38, 0x96, 0xb7,
00647 0x4b, 0x4a, 0x2a, 0x3b, 0x0a, 0xf4, 0x53, 0x9e },
00648 { 0x6b, 0xf6, 0x94, 0x38, 0xc2, 0xe4 },
00649 { 0x5f, 0x67 },
00650 { 0x46, 0x0a, 0x48, 0x38, 0x54, 0x27, 0xaa, 0x39,
00651 0x26, 0x4a, 0xac, 0x8e, 0xfc, 0x9e, 0x73, 0xe8 },
00652 { 0xc3, 0x5a, 0x0a, 0xb0, 0xbc, 0xbf, 0xc9, 0x25,
00653 0x2c, 0xaf, 0xf1, 0x5f, 0x24, 0xef, 0xbd, 0xe0 },
00654 { 0xbd, 0x07, 0xd3, 0x00, 0x3b, 0x9e, 0x5c, 0xc3 },
00655 { 0xbc, 0xb6, 0xc2, 0xfc, 0xad, 0x15, 0x22, 0x50 },
00656 { 0x8c, 0x25, 0xa1, 0x6c, 0xd9, 0x18, 0xa1, 0xdf },
00657 { 0x4c, 0xd0, 0x84, 0x60, 0x20, 0xf8, 0xfa, 0x07,
00658 0x31, 0xdd, 0x47, 0xcb, 0xdc, 0x6b, 0xe4, 0x11 },
00659 { 0x88, 0xab, 0x80, 0xa4, 0x15, 0xf1, 0x5c, 0x73,
00660 0x71, 0x12, 0x54, 0xa1, 0xd3, 0x88, 0xf6, 0x96 },
00661 { 0x7e, 0x64, 0x55, 0xf3, 0x4c, 0xf3 },
00662 { 0xdc, 0x6d, 0xd0, 0x1e, 0x8f, 0x15 }
00663 }, {
00664
00665 { 0xa5, 0x30, 0xa7, 0xfe, 0x42, 0x8f, 0xad, 0x10,
00666 0x82, 0xc4, 0x5e, 0xdd, 0xfc, 0xe1, 0x38, 0x84 },
00667 { 0x3a, 0x4c, 0x2b, 0x32, 0x45, 0xc5, 0x0e, 0xb5,
00668 0xc7, 0x1d, 0x08, 0x63, 0x93, 0x95, 0x76, 0x4d },
00669 { 0xf6, 0x3f, 0x5d, 0x76, 0x87, 0x84 },
00670 { 0xb9, 0x0e },
00671 { 0x51, 0x1c, 0x6c, 0x4e, 0x83, 0xe3, 0x8c, 0x89,
00672 0xb1, 0xc5, 0xd8, 0xdd, 0xe6, 0x24, 0x26, 0xfa },
00673 { 0x27, 0x95, 0x3e, 0x49, 0xbc, 0x8a, 0xf6, 0xdc,
00674 0xc6, 0xe7, 0x30, 0xeb, 0x80, 0x28, 0x6b, 0xe3 },
00675 { 0x53, 0x76, 0x1f, 0xbd, 0x67, 0x9b, 0x0b, 0xad },
00676 { 0x21, 0xad, 0xfd, 0x33, 0x4a, 0x10, 0xe7, 0xce },
00677 { 0xa6, 0x32, 0x41, 0xe1, 0xff, 0xc3, 0xe5, 0xab },
00678 { 0x10, 0xf0, 0x5b, 0xab, 0x75, 0xa9, 0x9a, 0x5f,
00679 0xbb, 0x98, 0xa9, 0xc2, 0x87, 0x67, 0x9c, 0x3b },
00680 { 0xf9, 0xec, 0x08, 0x65, 0xeb, 0x32, 0xf2, 0x23,
00681 0x69, 0xca, 0xde, 0x40, 0xc5, 0x9c, 0x3a, 0x44 },
00682 { 0x88, 0x19, 0x6c, 0x47, 0x98, 0x6f },
00683 { 0xc9, 0x87, 0xa3, 0xd2, 0x31, 0x15 }
00684 }, {
00685
00686 { 0xd9, 0x15, 0x1c, 0xf0, 0x48, 0x96, 0xe2, 0x58,
00687 0x30, 0xbf, 0x2e, 0x08, 0x26, 0x7b, 0x83, 0x60 },
00688 { 0xf7, 0x61, 0xe5, 0xe9, 0x3d, 0x60, 0x3f, 0xeb,
00689 0x73, 0x0e, 0x27, 0x55, 0x6c, 0xb8, 0xa2, 0xca },
00690 { 0x47, 0xee, 0x01, 0x99, 0x82, 0x0a },
00691 { 0x91, 0x13 },
00692 { 0x75, 0xfc, 0x22, 0x33, 0xa4, 0x42, 0x94, 0xee,
00693 0x8e, 0x6d, 0xe2, 0x5c, 0x43, 0x53, 0xd2, 0x6b },
00694 { 0xc4, 0xc9, 0x3e, 0xff, 0xe8, 0xa0, 0x81, 0x38,
00695 0xc2, 0x03, 0xd4, 0xc2, 0x7c, 0xe4, 0xe3, 0xd9 },
00696 { 0x66, 0xcc, 0x4b, 0xe4, 0x48, 0x62, 0xaf, 0x1f },
00697 { 0x7a, 0x4b, 0x8d, 0x7a, 0x87, 0x53, 0xf2, 0x46 },
00698 { 0x4a, 0x90, 0xb2, 0x17, 0x1a, 0xc8, 0x3a, 0x76 },
00699 { 0x71, 0x23, 0x6b, 0x71, 0x29, 0xf9, 0xb2, 0x2a,
00700 0xb7, 0x7e, 0xa7, 0xa5, 0x4c, 0x96, 0xda, 0x22 },
00701 { 0x90, 0x52, 0x7e, 0xba, 0xa5, 0x58, 0x89, 0x68,
00702 0xdb, 0x41, 0x72, 0x73, 0x25, 0xa0, 0x4d, 0x9e },
00703 { 0x82, 0xa0, 0xf5, 0x28, 0x7a, 0x71 },
00704 { 0x52, 0x7d, 0xbf, 0x41, 0xf3, 0x5f }
00705 }, {
00706
00707 { 0xa0, 0xe2, 0x97, 0x1b, 0x68, 0x22, 0xe8, 0xd3,
00708 0x54, 0xa1, 0x8c, 0xc2, 0x35, 0x62, 0x4e, 0xcb },
00709 { 0x08, 0xef, 0xf8, 0x28, 0xb1, 0x3f, 0xdb, 0x56,
00710 0x27, 0x22, 0xc6, 0x5c, 0x7f, 0x30, 0xa9, 0xb2 },
00711 { 0xdb, 0x5c, 0x06, 0x64, 0x81, 0xe0 },
00712 { 0x71, 0x6b },
00713 { 0x32, 0x37, 0x92, 0xfa, 0xca, 0x21, 0xfb, 0x4d,
00714 0x5d, 0x6f, 0x13, 0xc1, 0x45, 0xa9, 0xd2, 0xc1 },
00715 { 0x82, 0xa2, 0x6f, 0x22, 0xbb, 0xa9, 0xe9, 0x48,
00716 0x8f, 0x94, 0x9a, 0x10, 0xd9, 0x8e, 0x9c, 0xc4 },
00717 { 0x94, 0x85, 0xfe, 0x24, 0x62, 0x1c, 0xb9, 0xf6 },
00718 { 0xbc, 0xe3, 0x25, 0xce, 0x03, 0xe2, 0xe9, 0xb9 },
00719 { 0x4b, 0xc2, 0x21, 0x2d, 0x86, 0x24, 0x91, 0x0a },
00720 { 0x08, 0xce, 0xf6, 0xd0, 0x04, 0xec, 0x61, 0x47,
00721 0x1a, 0x3c, 0x3c, 0xda, 0x04, 0x81, 0x37, 0xfa },
00722 { 0xed, 0x03, 0x18, 0xca, 0x5d, 0xeb, 0x92, 0x06,
00723 0x27, 0x2f, 0x6e, 0x8f, 0xa6, 0x4b, 0xa4, 0x11 },
00724 { 0xa2, 0xf8, 0x58, 0xaa, 0x9e, 0x5d },
00725 { 0x74, 0xe7, 0x6f, 0xbb, 0xec, 0x38 }
00726 }, {
00727
00728 { 0x0d, 0xa6, 0xf7, 0xba, 0x86, 0xd5, 0xea, 0xc8,
00729 0xa1, 0x9c, 0xf5, 0x63, 0xac, 0x58, 0x64, 0x2d },
00730 { 0x67, 0x9a, 0xc4, 0xdb, 0xac, 0xd7, 0xd2, 0x33,
00731 0xff, 0x9d, 0x68, 0x06, 0xf4, 0x14, 0x9c, 0xe3 },
00732 { 0x6e, 0x23, 0x31, 0xd6, 0x92, 0xad },
00733 { 0x22, 0x4a },
00734 { 0x4b, 0x9a, 0x26, 0xfa, 0x45, 0x9e, 0x3a, 0xcb,
00735 0xff, 0x36, 0xf4, 0x01, 0x5d, 0xe3, 0xbd, 0xc1 },
00736 { 0x0d, 0xb1, 0x07, 0x1f, 0x87, 0x67, 0x56, 0x2c,
00737 0xa4, 0x3a, 0x0a, 0x64, 0xc4, 0x1e, 0x8d, 0x08 },
00738 { 0x28, 0x31, 0xd7, 0xae, 0x90, 0x88, 0xe4, 0x92 },
00739 { 0x9b, 0x2e, 0x16, 0x95, 0x11, 0x35, 0xd5, 0x23 },
00740 { 0x6f, 0xc3, 0x0f, 0xee, 0x6d, 0x12, 0x35, 0x23 },
00741 { 0x69, 0xb1, 0xca, 0xe7, 0xc7, 0x42, 0x9d, 0x97,
00742 0x5e, 0x24, 0x5c, 0xac, 0xb0, 0x5a, 0x51, 0x7c },
00743 { 0x74, 0xf2, 0x4e, 0x8c, 0x26, 0xdf, 0x58, 0xe1,
00744 0xb3, 0x8d, 0x7d, 0xcd, 0x4f, 0x1b, 0x7f, 0xbd },
00745 { 0x4c, 0x53, 0x9a, 0x26, 0xe1, 0xfa },
00746 { 0x07, 0x86, 0x1e, 0x12, 0x69, 0x28 }
00747 }, {
00748
00749 { 0x77, 0xb4, 0x58, 0x43, 0xc8, 0x8e, 0x58, 0xc1,
00750 0x0d, 0x20, 0x26, 0x84, 0x51, 0x5e, 0xd4, 0x30 },
00751 { 0x4c, 0x47, 0xeb, 0x30, 0x76, 0xdc, 0x55, 0xfe,
00752 0x51, 0x06, 0xcb, 0x20, 0x34, 0xb8, 0xcd, 0x78 },
00753 { 0xfe, 0x1a, 0x87, 0x31, 0x00, 0x5d },
00754 { 0xad, 0x25 },
00755 { 0xbf, 0x32, 0x86, 0xc7, 0xa5, 0x14, 0x09, 0xce,
00756 0x95, 0x72, 0x4d, 0x50, 0x3b, 0xfe, 0x6e, 0x70 },
00757 { 0xd4, 0x83, 0xaf, 0xae, 0x56, 0x24, 0x09, 0xa3,
00758 0x26, 0xb5, 0xbb, 0x0b, 0x20, 0xc4, 0xd7, 0x62 },
00759 { 0x08, 0x33, 0x2d, 0x7e, 0x9f, 0x48, 0x45, 0x70 },
00760 { 0xed, 0x41, 0xb7, 0x34, 0x48, 0x9d, 0x52, 0x07 },
00761 { 0xae, 0xfa, 0x35, 0x7b, 0xea, 0xc2, 0xa8, 0x7a },
00762 { 0x90, 0x8c, 0x43, 0xf0, 0x56, 0x9c, 0xb8, 0xf7,
00763 0x4b, 0xc9, 0x71, 0xe7, 0x06, 0xc3, 0x6c, 0x5f },
00764 { 0xc2, 0x51, 0xdf, 0x0d, 0x88, 0x8d, 0xd9, 0x32,
00765 0x9b, 0xcf, 0x46, 0x65, 0x5b, 0x22, 0x6e, 0x40 },
00766 { 0x30, 0xff, 0x25, 0xcd, 0xad, 0xf6 },
00767 { 0xe8, 0x4e, 0xd0, 0xd4, 0x67, 0x7e }
00768 }, {
00769
00770 { 0x72, 0x9b, 0x17, 0x72, 0x92, 0x70, 0xdd, 0x87,
00771 0xcc, 0xdf, 0x1b, 0xfe, 0x29, 0xb4, 0xe9, 0xbb },
00772 { 0x31, 0x1c, 0x4c, 0x92, 0x97, 0x44, 0xd6, 0x75,
00773 0xb7, 0x20, 0xf3, 0xb7, 0xe9, 0xb1, 0xcb, 0xd0 },
00774 { 0xc8, 0x5c, 0x4c, 0xf6, 0x59, 0x16 },
00775 { 0x5b, 0xb2 },
00776 { 0xd0, 0x4c, 0x9c, 0x35, 0xbd, 0x22, 0x62, 0xfa,
00777 0x81, 0x0d, 0x29, 0x24, 0xd0, 0x36, 0xfd, 0x13 },
00778 { 0x22, 0x8c, 0x2f, 0x2f, 0x06, 0xac, 0x32, 0x68,
00779 0xa9, 0xe6, 0x16, 0xee, 0x16, 0xdb, 0x4b, 0xa1 },
00780 { 0xff, 0x79, 0x4f, 0xe2, 0xf8, 0x27, 0xeb, 0xf8 },
00781 { 0x24, 0xfe, 0x4d, 0xc6, 0x1e, 0x87, 0x4b, 0x52 },
00782 { 0x98, 0xdb, 0xbd, 0x09, 0x9b, 0x3b, 0x40, 0x8d },
00783 { 0x44, 0xc0, 0xf2, 0x3c, 0x54, 0x93, 0xcf, 0xd2,
00784 0x41, 0xe4, 0x8f, 0x19, 0x7e, 0x1d, 0x10, 0x12 },
00785 { 0x0c, 0x9f, 0xb8, 0x16, 0x13, 0x88, 0x4c, 0x25,
00786 0x35, 0xdd, 0x0e, 0xab, 0xf3, 0xb4, 0x40, 0xd8 },
00787 { 0x53, 0x80, 0xd1, 0x58, 0xcf, 0xe3 },
00788 { 0x87, 0xac, 0x3b, 0x55, 0x9f, 0xb6 }
00789 }, {
00790
00791 { 0xd3, 0x2d, 0xd2, 0x3e, 0x89, 0xdc, 0x66, 0x23,
00792 0x54, 0xca, 0x12, 0xeb, 0x79, 0xdd, 0x32, 0xfa },
00793 { 0xcf, 0x7d, 0x0a, 0xb1, 0xd9, 0x43, 0x06, 0x95,
00794 0x0b, 0xf1, 0x20, 0x18, 0xfb, 0xd4, 0x68, 0x87 },
00795 { 0x48, 0x41, 0x07, 0xe5, 0x6a, 0x43 },
00796 { 0xb5, 0xe6 },
00797 { 0xfe, 0x75, 0x90, 0x5b, 0x9d, 0xa4, 0x7d, 0x35,
00798 0x62, 0x36, 0xd0, 0x31, 0x4e, 0x09, 0xc3, 0x2e },
00799 { 0xd2, 0x2a, 0x4b, 0x41, 0x80, 0xa5, 0x32, 0x57,
00800 0x08, 0xa5, 0xff, 0x70, 0xd9, 0xf6, 0x7e, 0xc7 },
00801 { 0xcf, 0x19, 0xd6, 0x2b, 0x6a, 0x80, 0x98, 0x66 },
00802 { 0x5d, 0x26, 0x95, 0x37, 0xe4, 0x5e, 0x2c, 0xe6 },
00803 { 0xaf, 0x4a, 0x41, 0x1e, 0x11, 0x39, 0xf2, 0xc2 },
00804 { 0x5a, 0xf8, 0x6b, 0x80, 0xed, 0xb7, 0x0d, 0xf5,
00805 0x29, 0x2c, 0xc1, 0x12, 0x1c, 0xba, 0xd5, 0x0c },
00806 { 0x7f, 0x4d, 0x6a, 0xe7, 0x44, 0x0e, 0x18, 0x78,
00807 0x9a, 0x8b, 0x75, 0xad, 0x3f, 0x42, 0xf0, 0x3a },
00808 { 0x21, 0x7a, 0xf4, 0x92, 0x72, 0xad },
00809 { 0x90, 0x0e, 0x10, 0x1c, 0x67, 0x7e }
00810 }, {
00811
00812 { 0xaf, 0x7c, 0x65, 0xe1, 0x92, 0x72, 0x21, 0xde,
00813 0x59, 0x11, 0x87, 0xa2, 0xc5, 0x98, 0x7a, 0x53 },
00814 { 0x1f, 0x0f, 0x85, 0x78, 0x46, 0x4f, 0xd5, 0x9b,
00815 0x64, 0xbe, 0xd2, 0xd0, 0x94, 0x36, 0xb5, 0x7a },
00816 { 0x3d, 0x62, 0x7b, 0x01, 0x41, 0x8d },
00817 { 0x84, 0xf6 },
00818 { 0x0c, 0x7a, 0xcb, 0x8d, 0x95, 0xb7, 0xd4, 0xa3,
00819 0x1c, 0x5a, 0xca, 0x6d, 0x26, 0x34, 0x5a, 0x88 },
00820 { 0xa4, 0xcf, 0x5c, 0x81, 0x55, 0xc0, 0x8a, 0x7e,
00821 0xff, 0x41, 0x8e, 0x54, 0x43, 0xb9, 0x8e, 0x55 },
00822 { 0xc3, 0x7c, 0xae, 0x78, 0x05, 0x64, 0x20, 0x32 },
00823 { 0x68, 0xcd, 0x09, 0xa4, 0x52, 0xd8, 0xdb, 0x7c },
00824 { 0x7b, 0xff, 0xa5, 0xc2, 0xf4, 0x1f, 0xbc, 0x05 },
00825 { 0x3f, 0x8c, 0x3f, 0x3c, 0xcf, 0x76, 0x25, 0xbf,
00826 0x77, 0xfc, 0x94, 0xbc, 0xfd, 0x22, 0xfd, 0x26 },
00827 { 0xab, 0xcb, 0xae, 0x8f, 0xd4, 0x61, 0x15, 0xe9,
00828 0x96, 0x1a, 0x55, 0xd0, 0xda, 0x5f, 0x20, 0x78 },
00829 { 0x83, 0x7f, 0xd7, 0xb7, 0x44, 0x19 },
00830 { 0x56, 0xe9, 0x7a, 0x60, 0x90, 0xb1 }
00831 }, {
00832
00833 { 0x5b, 0xd7, 0xec, 0xd3, 0xd3, 0x12, 0x7a, 0x41,
00834 0xd1, 0x25, 0x39, 0xbe, 0xd4, 0xe7, 0xcf, 0x71 },
00835 { 0x59, 0xb7, 0x5f, 0x14, 0x25, 0x1c, 0x75, 0x03,
00836 0x1d, 0x0b, 0xcb, 0xac, 0x1c, 0x2c, 0x04, 0xc7 },
00837 { 0xa2, 0x98, 0xae, 0x89, 0x29, 0xdc },
00838 { 0xd0, 0x56 },
00839 { 0xf9, 0x67, 0xf7, 0x60, 0x38, 0xb9, 0x20, 0xa9,
00840 0xcd, 0x25, 0xe1, 0x0c, 0x08, 0xb4, 0x99, 0x24 },
00841 { 0x76, 0x08, 0x9d, 0x3c, 0x0f, 0xf3, 0xef, 0xdc,
00842 0x6e, 0x36, 0x72, 0x1d, 0x4f, 0xce, 0xb7, 0x47 },
00843 { 0xc3, 0xf2, 0x5c, 0xd9, 0x43, 0x09, 0x10, 0x7e },
00844 { 0xb0, 0xc8, 0xba, 0x34, 0x36, 0x65, 0xaf, 0xcc },
00845 { 0x7e, 0x3f, 0x44, 0xc7, 0x59, 0x1f, 0x6f, 0x45 },
00846 { 0xd4, 0x2b, 0x2d, 0x61, 0x5e, 0x49, 0xa0, 0x3a,
00847 0xc2, 0x75, 0xa5, 0xae, 0xf9, 0x7a, 0xf8, 0x92 },
00848 { 0x0b, 0x3f, 0x8d, 0x02, 0x4f, 0xe6, 0xbf, 0xaf,
00849 0xaa, 0x98, 0x2b, 0x8f, 0x82, 0xe3, 0x19, 0xc2 },
00850 { 0x5b, 0xe1, 0x14, 0x95, 0x52, 0x5d },
00851 { 0x4d, 0x6a, 0x34, 0xa1, 0xe4, 0xeb }
00852 }, {
00853
00854 { 0x6c, 0xd1, 0xc6, 0xce, 0xb1, 0xe0, 0x1e, 0x14,
00855 0xf1, 0xb8, 0x23, 0x16, 0xa9, 0x0b, 0x7f, 0x3d },
00856 { 0xf6, 0x9b, 0x78, 0xf3, 0x00, 0xa0, 0x56, 0x8b,
00857 0xce, 0x9f, 0x0c, 0xb9, 0x3c, 0x4b, 0xe4, 0xc9 },
00858 { 0xb4, 0xfc, 0xe5, 0xfe, 0xb0, 0x59 },
00859 { 0xe4, 0xbb },
00860 { 0x07, 0x8b, 0xfc, 0xa9, 0x56, 0x46, 0x59, 0xec,
00861 0xd8, 0x85, 0x1e, 0x84, 0xe6, 0xc5, 0x9b, 0x48 },
00862 { 0xa2, 0x19, 0xdc, 0x37, 0xf1, 0xdc, 0x7d, 0x66,
00863 0x73, 0x8b, 0x58, 0x43, 0xc7, 0x99, 0xf2, 0x06 },
00864 { 0x69, 0xa9, 0x08, 0x69, 0xc2, 0x68, 0xcb, 0x7b },
00865 { 0x2e, 0x0f, 0xdc, 0xf9, 0xfd, 0x1c, 0xfa, 0x6a },
00866 { 0x70, 0xf6, 0xbd, 0xb9, 0xad, 0x21, 0x52, 0x5f },
00867 { 0x6e, 0xda, 0xf9, 0x9e, 0x5b, 0xd9, 0xf8, 0x5d,
00868 0x5f, 0x36, 0xd9, 0x1c, 0x12, 0x72, 0xfb, 0x4b },
00869 { 0xd6, 0x1c, 0x85, 0x3c, 0x28, 0x0d, 0xd9, 0xc4,
00870 0x6f, 0x29, 0x7b, 0xae, 0xc3, 0x86, 0xde, 0x17 },
00871 { 0x1c, 0x40, 0x8a, 0x85, 0x8b, 0x3e },
00872 { 0xaa, 0x4a, 0xe5, 0x2d, 0xaa, 0x30 }
00873 }, {
00874
00875 { 0xb7, 0x3a, 0x90, 0xcb, 0xcf, 0x3a, 0xfb, 0x62,
00876 0x2d, 0xba, 0x83, 0xc5, 0x8a, 0x84, 0x15, 0xdf },
00877 { 0xb1, 0x20, 0xf1, 0xc1, 0xa0, 0x10, 0x2a, 0x2f,
00878 0x50, 0x7d, 0xd5, 0x43, 0xde, 0x68, 0x28, 0x1f },
00879 { 0xf1, 0xe8, 0xa5, 0x23, 0xa3, 0x6d },
00880 { 0x47, 0x1b },
00881 { 0xb6, 0x72, 0x04, 0x7e, 0x00, 0x3b, 0xb9, 0x52,
00882 0xdc, 0xa6, 0xcb, 0x8a, 0xf0, 0xe5, 0xb7, 0x79 },
00883 { 0xdf, 0x0c, 0x67, 0x86, 0x8f, 0xa2, 0x5f, 0x74,
00884 0x8b, 0x70, 0x44, 0xc6, 0xe7, 0xc2, 0x45, 0xb8 },
00885 { 0xeb, 0xd7, 0x03, 0x41, 0xbc, 0xd4, 0x15, 0xb0 },
00886 { 0x12, 0x35, 0x9f, 0x5d, 0x82, 0x22, 0x0c, 0x14 },
00887 { 0x47, 0x9d, 0xd2, 0x5c, 0x20, 0x79, 0x2d, 0x63 },
00888 { 0x66, 0x19, 0x5d, 0xbe, 0xd0, 0x31, 0x32, 0x74,
00889 0xc5, 0xca, 0x77, 0x66, 0x61, 0x5f, 0xa2, 0x5e },
00890 { 0x66, 0xbe, 0xc7, 0x07, 0xeb, 0x2a, 0xfc, 0x47,
00891 0x6d, 0x74, 0x08, 0xa8, 0xf2, 0x92, 0x7b, 0x36 },
00892 { 0xae, 0xfd, 0xaa, 0x5d, 0xdd, 0x99 },
00893 { 0x12, 0xec, 0x2b, 0x87, 0xfb, 0xb1 }
00894 }, {
00895
00896 { 0x51, 0x22, 0x25, 0x02, 0x14, 0xc3, 0x3e, 0x72,
00897 0x3a, 0x5d, 0xd5, 0x23, 0xfc, 0x14, 0x5f, 0xc0 },
00898 { 0x81, 0xe9, 0x2b, 0x6c, 0x0e, 0xe0, 0xe1, 0x2e,
00899 0xbc, 0xeb, 0xa8, 0xd9, 0x2a, 0x99, 0xdf, 0xa5 },
00900 { 0x16, 0xf3, 0xb3, 0xf7, 0x0f, 0xc2 },
00901 { 0xc3, 0xab },
00902 { 0xc9, 0xe8, 0x76, 0x32, 0x86, 0xb5, 0xb9, 0xff,
00903 0xbd, 0xf5, 0x6e, 0x12, 0x97, 0xd0, 0x88, 0x7b },
00904 { 0x98, 0x1d, 0x46, 0x4c, 0x7c, 0x52, 0xeb, 0x6e,
00905 0x50, 0x36, 0x23, 0x49, 0x84, 0xad, 0x0b, 0xcf },
00906 { 0x2a, 0x5c, 0x23, 0xd1, 0x5e, 0xe3, 0x51, 0xd5 },
00907 { 0x62, 0xda, 0xe3, 0x85, 0x3f, 0x3a, 0xf9, 0xd2 },
00908 { 0x28, 0xd7, 0xb0, 0xf2, 0xa2, 0xec, 0x3d, 0xe5 },
00909 { 0x53, 0x49, 0xfb, 0xe0, 0x98, 0x64, 0x9f, 0x94,
00910 0x8f, 0x5d, 0x2e, 0x97, 0x3a, 0x81, 0xc0, 0x0f },
00911 { 0x97, 0x44, 0x87, 0x1a, 0xd3, 0x2b, 0xf9, 0xbb,
00912 0xd1, 0xdd, 0x5c, 0xe5, 0x4e, 0x3e, 0x2e, 0x5a },
00913 { 0xad, 0xa1, 0x5a, 0xeb, 0x7b, 0xb8 },
00914 { 0xd4, 0x61, 0xbc, 0x15, 0x47, 0x5d }
00915 }, {
00916
00917 { 0x90, 0xdc, 0xa4, 0xed, 0xa4, 0x5b, 0x53, 0xcf,
00918 0x0f, 0x12, 0xd7, 0xc9, 0xc3, 0xbc, 0x6a, 0x89 },
00919 { 0x9f, 0xdd, 0xc7, 0x20, 0x92, 0xc6, 0xad, 0x03,
00920 0x6b, 0x6e, 0x46, 0x47, 0x89, 0x31, 0x5b, 0x78 },
00921 { 0x20, 0xf8, 0x13, 0xbd, 0x41, 0x41 },
00922 { 0x61, 0xdf },
00923 { 0x3f, 0xfc, 0xfe, 0x5b, 0x7b, 0x11, 0x11, 0x58,
00924 0x99, 0x20, 0xd3, 0x52, 0x8e, 0x84, 0xe6, 0x55 },
00925 { 0xcb, 0x9c, 0xcc, 0xc4, 0xb9, 0x25, 0x8e, 0x6d,
00926 0xca, 0x47, 0x60, 0x37, 0x9f, 0xb8, 0x25, 0x81 },
00927 { 0x09, 0xdb, 0x94, 0xea, 0xb4, 0xf8, 0x14, 0x9e },
00928 { 0xa2, 0x94, 0x68, 0xaa, 0x97, 0x75, 0xb5, 0x27 },
00929 { 0xa9, 0x51, 0x00, 0xe2, 0x76, 0x09, 0x52, 0xcd },
00930 { 0xb5, 0xf2, 0xda, 0x03, 0x88, 0x3b, 0x69, 0xf9,
00931 0x6b, 0xf5, 0x2e, 0x02, 0x9e, 0xd9, 0xac, 0x45 },
00932 { 0xb4, 0x72, 0x13, 0x68, 0xbc, 0x16, 0xea, 0x67,
00933 0x87, 0x5c, 0x55, 0x98, 0x68, 0x8b, 0xb0, 0xef },
00934 { 0x83, 0xcf, 0xd5, 0x4d, 0xb9, 0x13 },
00935 { 0x4f, 0x20, 0x39, 0x39, 0x2d, 0xdc }
00936 }
00937 };
00938
00939 #define NUM_TESTS (sizeof(test_sets) / sizeof(test_sets[0]))
00940
00941
00942 int main(int argc, char *argv[])
00943 {
00944 u8 buf[16], buf2[16], buf3[16], buf4[16], buf5[16], opc[16];
00945 u8 auts[14], sqn[6], _rand[16];
00946 int ret = 0, res, i;
00947 const struct milenage_test_set *t;
00948 size_t res_len;
00949
00950 wpa_debug_level = 0;
00951
00952 printf("Milenage test sets\n");
00953 for (i = 0; i < NUM_TESTS; i++) {
00954 t = &test_sets[i];
00955 printf("Test Set %d\n", i + 1);
00956
00957 milenage_opc(t->op, t->k, opc);
00958 if (memcmp(opc, t->opc, 16) != 0) {
00959 printf("- milenage_opc failed\n");
00960 ret++;
00961 }
00962
00963 milenage_f1(opc, t->k, t->rand, t->sqn, t->amf, buf, buf2);
00964 if (memcmp(buf, t->f1, 8) != 0) {
00965 printf("- milenage_f1 failed\n");
00966 ret++;
00967 }
00968 if (memcmp(buf2, t->f1star, 8) != 0) {
00969 printf("- milenage_f1* failed\n");
00970 ret++;
00971 }
00972
00973 milenage_f2345(opc, t->k, t->rand, buf, buf2, buf3, buf4,
00974 buf5);
00975 if (memcmp(buf, t->f2, 8) != 0) {
00976 printf("- milenage_f2 failed\n");
00977 ret++;
00978 }
00979 if (memcmp(buf2, t->f3, 16) != 0) {
00980 printf("- milenage_f3 failed\n");
00981 ret++;
00982 }
00983 if (memcmp(buf3, t->f4, 16) != 0) {
00984 printf("- milenage_f4 failed\n");
00985 ret++;
00986 }
00987 if (memcmp(buf4, t->f5, 6) != 0) {
00988 printf("- milenage_f5 failed\n");
00989 ret++;
00990 }
00991 if (memcmp(buf5, t->f5star, 6) != 0) {
00992 printf("- milenage_f5* failed\n");
00993 ret++;
00994 }
00995 }
00996
00997 printf("milenage_auts test:\n");
00998 memcpy(auts, "\x4f\x20\x39\x39\x2d\xdd", 6);
00999 memcpy(auts + 6, "\x4b\xb4\x31\x6e\xd4\xa1\x46\x88", 8);
01000 res = milenage_auts(t->opc, t->k, t->rand, auts, buf);
01001 printf("AUTS for test set %d: %d / SQN=%02x%02x%02x%02x%02x%02x\n",
01002 i, res, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
01003 if (res)
01004 ret++;
01005
01006 memset(_rand, 0xaa, sizeof(_rand));
01007 memcpy(auts,
01008 "\x43\x68\x1a\xd3\xda\xf0\x06\xbc\xde\x40\x5a\x20\x72\x67", 14);
01009 res = milenage_auts(t->opc, t->k, _rand, auts, buf);
01010 printf("AUTS from a test USIM: %d / SQN=%02x%02x%02x%02x%02x%02x\n",
01011 res, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
01012 if (res)
01013 ret++;
01014
01015 printf("milenage_generate test:\n");
01016 memcpy(sqn, "\x00\x00\x00\x00\x40\x44", 6);
01017 memcpy(_rand, "\x12\x69\xb8\x23\x41\x39\x35\x66\xfb\x99\x41\xe9\x84"
01018 "\x4f\xe6\x2f", 16);
01019 res_len = 8;
01020 milenage_generate(t->opc, t->amf, t->k, sqn, _rand, buf, buf2, buf3,
01021 buf4, &res_len);
01022 wpa_hexdump(MSG_DEBUG, "SQN", sqn, 6);
01023 wpa_hexdump(MSG_DEBUG, "RAND", _rand, 16);
01024 wpa_hexdump(MSG_DEBUG, "AUTN", buf, 16);
01025 wpa_hexdump(MSG_DEBUG, "IK", buf2, 16);
01026 wpa_hexdump(MSG_DEBUG, "CK", buf3, 16);
01027 wpa_hexdump(MSG_DEBUG, "RES", buf4, res_len);
01028
01029 printf("GSM-Milenage test sets\n");
01030 for (i = 0; i < NUM_GSM_TESTS; i++) {
01031 const struct gsm_milenage_test_set *g;
01032 u8 sres[4], kc[8];
01033 g = &gsm_test_sets[i];
01034 printf("Test Set %d\n", i + 1);
01035 gsm_milenage(g->opc, g->ki, g->rand, sres, kc);
01036 if (memcmp(g->kc, kc, 8) != 0) {
01037 printf("- gsm_milenage Kc failed\n");
01038 ret++;
01039 }
01040 #ifdef GSM_MILENAGE_ALT_SRES
01041 if (memcmp(g->sres2, sres, 4) != 0) {
01042 printf("- gsm_milenage SRES#2 failed\n");
01043 ret++;
01044 }
01045 #else
01046 if (memcmp(g->sres1, sres, 4) != 0) {
01047 printf("- gsm_milenage SRES#1 failed\n");
01048 ret++;
01049 }
01050 #endif
01051 }
01052
01053 if (ret)
01054 printf("Something failed\n");
01055 else
01056 printf("OK\n");
01057
01058 return ret;
01059 }
01060 #endif
01061