/****************************************************************************** * Copyright (c) 2000-2019 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html ******************************************************************************/ // // File: TCCSecurity_Example.ttcn // Description: TCC Useful testcases: Security testcases. // Rev: R32A // Prodnr: CNL 113 472 // Updated: 2013-02-08 // Contact: http://ttcn.ericsson.se /////////////////////////////////////////////// module TCCSecurity_Example { import from TCCSecurity_Functions all; type component Security_CT { var DigestData dg; var AKAInput aka_input; var SIMOutput sim_output; }; type component IKEv2_CT { var DigestData dg; var AKAInput aka_input; var SIMOutput sim_output; }; ////////////////////////////////////////////////////////////// // Security functions ////////////////////////////////////////////////////////////// type record DigestData { charstring nonce, charstring cnonce, charstring user, charstring realm, charstring passwd, charstring alg, charstring nonceCount, charstring method, charstring qop, charstring URI, charstring HEntity } type record AKAInput { octetstring OP, octetstring k, octetstring rand, octetstring sqn, octetstring amf } type record SIMOutput { octetstring sres, octetstring kc } const octetstring c_OP := '00'O; // test f_calculateDigestResponse function testcase f_test_digestresponse() runs on Security_CT { log(" ----------- f_calculateDigestResponse ----------- "); dg := { nonce := "dcd98b7102dd2f0e8b11d0f600bfb0c093", cnonce := "0a4f113b", user := "Mufasa", realm := "testrealm@host.com", passwd := "password", alg := "MD5", nonceCount := "00000001", method := "GET", qop := "auth", URI := "/dir/index.html", HEntity := "d41d8cd98f00b204e9800998ecf8427e" // MD5 hash of entity body } log("Data to compute digest from: ", dg); log("Digest response: ", f_calculateDigestResponse( dg.nonce, dg.cnonce, dg.user, dg.realm, dg.passwd, dg.alg, dg.nonceCount, dg.method, dg.qop, dg.URI, dg.HEntity)); // no check setverdict(pass); } testcase f_test_MD5() runs on Security_CT { var charstring v_hash := f_calculateMD5("") log("MD5 Hash of empty string: ", v_hash) log("Expected: ", "d41d8cd98f00b204e9800998ecf8427e"); if (v_hash == "d41d8cd98f00b204e9800998ecf8427e") { setverdict(pass); } else { setverdict(fail, "MD5 Hash test failed"); } } testcase tc_HMACMD5() runs on Security_CT { var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog"); var octetstring key := char2oct("key"); while (lengthof(key) < 64) { key := key & '00'O; } var octetstring hash := f_calculateHMACMD5(msg, key); log("HMAC MD5 Hash: ", hash); log("Expected: ", '80070713463e7749b90c2dc24911e275'O); if(hash == '80070713463e7749b90c2dc24911e275'O) { setverdict(pass); } else { setverdict(fail, "MD5 Hash test failed"); } } testcase tc_HMACMD5_2() runs on Security_CT { var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog"); var octetstring key := char2oct("key"); var octetstring hash := f_calculate_HMAC_MD5(key,msg,16); log("HMAC MD5 Hash: ", hash); log("Expected: ", '80070713463e7749b90c2dc24911e275'O); if(hash == '80070713463e7749b90c2dc24911e275'O) { setverdict(pass); } else { setverdict(fail, "MD5 Hash test 2 failed"); } } testcase tc_HMACMD5_3() runs on Security_CT { var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog"); var octetstring key := char2oct("key"); var octetstring hash := f_calculate_HMAC_MD5(key,msg,8); log("HMAC MD5 Hash: ", hash); log("Expected: ", '80070713463e7749'O); if(hash == '80070713463e7749'O) { setverdict(pass); } else { setverdict(fail, "MD5 Hash test 2 failed"); } } testcase tc_HMACMD5_4() runs on Security_CT { var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog"); var octetstring key := char2oct("01234567890123456789012345678901234567890123456789012345678901234"); var octetstring hash := f_calculate_HMAC_MD5(key,msg,16); log("HMAC MD5 Hash: ", hash); log("Expected: ", '6c5f927cd3311e7d2cc569d8f2bfcf98'O); if(hash == '6c5f927cd3311e7d2cc569d8f2bfcf98'O) { setverdict(pass); } else { setverdict(fail, "MD5 Hash test 2 failed"); } } testcase tc_HMAC_SHA1() runs on Security_CT { var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog"); var octetstring key := char2oct("key"); var octetstring hash := f_calculate_HMAC_SHA1(key,msg,20); log("HMAC SHA1Hash: ", hash); log("Expected: ", 'de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9'O); if(hash == 'de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9'O) { setverdict(pass); } else { setverdict(fail, "SHA1 Hash test 2 failed"); } } testcase tc_HMAC_SHA256() runs on Security_CT { var octetstring msg := char2oct("The quick brown fox jumps over the lazy dog"); var octetstring key := char2oct("key"); var octetstring hash := f_calculate_HMAC_SHA256(key,msg,32); log("HMAC SHA256Hash: ", hash); log("Expected: ", 'f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8'O); if(hash == 'f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8'O) { setverdict(pass); } else { setverdict(fail, "SHA256 Hash test 2 failed"); } } // test tc_AKA_functions function testcase tc_AKA_functions() runs on Security_CT { log(" ----------- tc_AKA_functions ----------- "); aka_input := { OP := '00'O, k := str2oct("1234567890123456"), rand := int2oct(9876, 16), sqn := int2oct(1234, 6), amf := '0000'O } log("AMF: ", str2oct("12")); log("Data to compute AKA output from: ", aka_input); log("f_IMSAKA_f1 output MAC-A: ", f_IMSAKA_f1 ( aka_input.OP, aka_input.k, aka_input.rand, aka_input.sqn, aka_input.amf ) ); log("f_IMSAKA_f2 output RES: ", f_IMSAKA_f2 ( aka_input.OP, aka_input.k, aka_input.rand ) ); log("f_IMSAKA_f3 output CK: ", f_IMSAKA_f3 ( aka_input.OP, aka_input.k, aka_input.rand ) ); log("f_IMSAKA_f4 output IK: ", f_IMSAKA_f4 ( aka_input.OP, aka_input.k, aka_input.rand ) ); log("f_IMSAKA_f5 output AK: ", f_IMSAKA_f5 ( aka_input.OP, aka_input.k, aka_input.rand ) ); log("f_IMSAKA_f1star output MAC-S: ", f_IMSAKA_f1star ( aka_input.OP, aka_input.k, aka_input.rand, aka_input.sqn, aka_input.amf ) ); log("f_IMSAKA_f5star output AK-S: ", f_IMSAKA_f5star ( aka_input.OP, aka_input.k, aka_input.rand ) ); log("f_IMSAKA_calculateAUTN output AUTN: ", f_IMSAKA_calculateAUTN ( aka_input.sqn, f_IMSAKA_f5(aka_input.OP,aka_input.k,aka_input.rand), aka_input.amf, f_IMSAKA_f1(aka_input.OP,aka_input.k,aka_input.rand,aka_input.sqn,aka_input.amf) ) ); f_EAPSIM_A3A8(aka_input.k, aka_input.rand, sim_output.sres, sim_output.kc) log("sim_output.sres: ", sim_output.sres, " sim_output.sres: ", sim_output.kc); setverdict(pass); } testcase tc_EIA() runs on Security_CT { var BIT_32 v_MAC := f_calculate128_EIA3 ( '00000000000000000000000000000000'O, //key '00000000'O, 0, '0'B, '0'B ) log(v_MAC); if (v_MAC == oct2bit('c8a9595e'O)) {setverdict(pass)} else {setverdict(fail)} } testcase tc_EEA() runs on Security_CT { var bitstring v_oct := f_calculate128_EEA3 ( '173d14ba5003731d7a60049470f00a29'O, '66035492'O, 15, '0'B, oct2bit('6cf65340735552ab0c9752fa6f9025fe0bd675d9005875b2'O) & '0'B ) log(v_oct); if (v_oct == ( oct2bit('a6c85fc66afb8533aafc2518dfe784940ee1e4b030238cc8'O) & '0'B)) {setverdict(pass)} else {setverdict(fail)} } testcase tc_3des_ecb() runs on Security_CT { var octetstring vl_key := '000102030405060708090A0B0C0D0E0F0011223344556677'O var octetstring vl_data := '61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523973DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047'O log(vl_data) var octetstring vl_encrypted_data := ef_3DES_ECB_Encrypt(vl_data, vl_key); log(vl_encrypted_data) var octetstring vl_decrypted_data := ef_3DES_ECB_Decrypt(vl_encrypted_data, vl_key); log(vl_decrypted_data) if(match(vl_data, vl_decrypted_data)) { setverdict(pass); } else { log(match(vl_data, vl_decrypted_data)) setverdict(fail); } } testcase tc_DH1024() runs on IKEv2_CT { var octetstring vl_key_other := '73DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047E90E4E5013F173AE9E61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF5239'O log("Public key:") log(vl_key_other) var octetstring vl_priv_key := '9FCF731129397EF7DC51562D71DD819DE35891B739BD6BE7A5177F676F1A06775A0E915E3758130FE5493B95C7A67F11F45E4C541DDD2834E4A9248F18EE2597936499C97D25227C4A4B78BABD4F33BBC3E3A2C591369A3A4FAF3D851839249E23E90D15051268986E562D76D756F7FAF942FFBC4669199A3C04E31335E2BD70'O log("Private key:") log(vl_priv_key) var octetstring vl_shared_secret := ef_DH_shared_secret(vl_key_other, vl_priv_key); log("Shared secret:") log(vl_shared_secret) } testcase tc_DH2048() runs on IKEv2_CT { var octetstring vl_key_other := '73DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047E90E4E5013F173AE9E61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523961A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523973DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047E90E4E5013F173AE9E'O log("Public key:") log(vl_key_other) var octetstring vl_priv_key := '61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523973DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047E90E4E5013F173AE9E0E915E3758130FE5493B95C7A67F11F45E4C541DDD2834E4A9248F18EE2597936499C97D25227C4A4B789FCF731129397EF7DC51562D71DD819DE35891B739BD6BE7A5177F676F1A06775ABABD4F33BBC3E3A2C591369A3A4FAF3D851839249E23E90D15051268986E562D76D756F7FAF942FFBC4669199A3C04E31335E2BD70'O log("Private key:") log(vl_priv_key) var octetstring vl_shared_secret := ef_DH_shared_secret(vl_key_other, vl_priv_key); log("Shared secret:") log(vl_shared_secret) } testcase tc_3DES_CBC() runs on IKEv2_CT { var octetstring vl_data := '61A7D3BEAA4C7DBD1FA3B2237A8CC92AE6575BADF894A34643D74AFF502BF523973DF1637453388CC4C06EC02D8AB44E3EDC866555BC0FDC56D0B2029110D7A1A1F585B65FB84D3674EC87B30BF5E7E8F747330549C77A9CCD348B7898825302408CE53D25ED62D56CA0FFACC0DFECDC9CFCBD03279047'O var octetstring vl_key := '000102030405060708090A0B0C0D0E0F0011223344556677'O var octetstring vl_iv := '0001020304050607'O var octetstring vl_encrypted := ef_3DES_CBC_Encrypt(vl_data, vl_key, vl_iv); log("Encrypted data: ") log(vl_encrypted) var octetstring vl_decrypted := ef_3DES_CBC_Decrypt(vl_encrypted, vl_key, vl_iv); log("Decrypted data: ") log(vl_decrypted) log("Original data: ") log(vl_data) if(match(vl_data, vl_decrypted)) { setverdict(pass); } else { log(match(vl_data, vl_decrypted)) setverdict(fail); } } testcase tc_AES_XCBC_128_no_data() runs on IKEv2_CT { var octetstring vl_data := ''O var octetstring vl_key := '000102030405060708090a0b0c0d0e0f'O var octetstring vl_computed_value := ef_Calculate_AES_XCBC_128(vl_data, vl_key, 16); log("Computed value: ") log(vl_computed_value) var octetstring vl_xcbc_value := '75f0251d528ac01c4573dfd584d79f29'O log("XCBC value: ") log(vl_xcbc_value) if(match(vl_computed_value, vl_xcbc_value)) { setverdict(pass); } else { log(match(vl_computed_value, vl_xcbc_value)) setverdict(fail); } } testcase tc_AES_XCBC_128_20byte_data() runs on IKEv2_CT { var octetstring vl_data := '000102030405060708090a0b0c0d0e0f10111213'O var octetstring vl_key := '000102030405060708090a0b0c0d0e0f'O var octetstring vl_computed_value := ef_Calculate_AES_XCBC_128(vl_data, vl_key, 16); log("Computed value: ") log(vl_computed_value) var octetstring vl_xcbc_value := '47f51b4564966215b8985c63055ed308'O log("XCBC value: ") log(vl_xcbc_value) if(match(vl_computed_value, vl_xcbc_value)) { setverdict(pass); } else { log(match(vl_computed_value, vl_xcbc_value)) setverdict(fail); } } testcase tc_test_f_calculate128_EEA1() runs on Security_CT{ var OCT_16 key := '5ACB1D644C0D51204EA5F1451010D852'O var OCT_4 count := 'FA556B26'O var INT_5 bearer := 3 var BIT_1 direction := '1'B var BIT_1_65504 msg_in := oct2bit('AD9C441F890B38C457A49D421407E8'O) var BIT_1_65504 msg_out:= f_calculate128_EEA1(key,count,bearer,direction,msg_in); log(msg_out) if(msg_out=='101110100000111100110001001100000000001100110100110001010110101101010010101001110100100101111100101110101100000001000110'B){ setverdict(pass) } else { setverdict(fail) } } testcase tc_test_f_calculate128_EIA1() runs on Security_CT{ var OCT_16 key := '2BD6459F82C5B300952C49104881FF48'O var OCT_4 count := '38A6F056'O var integer bearer := 31; var BIT_1 direction := '0'B var BIT_1_65504 msg_in := '0011001100110010001101000110001001100011001110010011100001100001001101110011010001111001'B //substr(oct2bit('6B227737296F393C8079353EDC87E2E805D2EC49A4F2D8E0'O),0,88); var BIT_1_65504 msg_out:= f_calculate128_EIA1(key,count,bearer,direction,msg_in); log(msg_out) if(msg_out=='01110011000111110001000101100101'B){ setverdict(pass) } else { setverdict(fail) } } testcase tc_test_f_calculate128_EIA2_1() runs on Security_CT{ var OCT_16 key := 'd3c5d592327fb11c4035c6680af8c6d1'O var OCT_4 count := '398a59b4'O var integer bearer := 26; var BIT_1 direction := '1'B var octetstring msg_in := '484583d5afe082ae'O var octetstring msg_out:= f_calculate128_EIA2(key,count,bearer,direction,msg_in); log("Result ",msg_out) log("Expected ",'B93787E6'O) if(msg_out=='B93787E6'O){ setverdict(pass) } else { setverdict(fail) } } testcase tc_test_f_calculate128_EIA2_2() runs on Security_CT{ var OCT_16 key := 'b3120ffdb2cf6af4e73eaf2ef4ebec69'O var OCT_4 count := '296f393c'O var integer bearer := 11; var BIT_1 direction := '1'B var octetstring msg_in := '00000000000000000101010101010101e0958045f3a0bba4e3968346f0a3b8a7c02a018ae640765226b987c913e6cbf083570016cf83efbc61c082513e21561a427c009d28c298eface78ed6d56c2d4505ad032e9c04dc60e73a81696da665c6c48603a57b45ab33221585e68ee3169187fb0239528632dd656c807ea3248b7b46d002b2b5c7458eb85b9ce95879e0340859055e3b0abbc3eace8719caa80265c97205d5dc4bcc902fe1839629ed71328a0f0449f588557e6898860e042aecd84b2404c212c9222da5bf8a89ef6797870cf50771a60f66a2ee62853657addf04cdde07fa414e11f12b4d81b9b4e8ac538ea30666688d881f6c348421992f31b94f8806ed8fccff4c9123b89642527ad613b109bf75167485f1268bf884b4cd23d29a0934925703d634098f7767f1be7491e708a8bb949a3873708aef4a36239e50cc08235cd5ed6bbe578668a17b58c1171d0b90e813a9e4f58a89d719b11042d6360b1b0f52deb730a58d58faf46315954b0a872691475977dc88c0d733feff54600a0cc1d0300aaaeb94572c6e95b01ae90de04f1dce47f87e8fa7bebf77e1dbc20d6ba85cb9143d518b285dfa04b698bf0cf7819f20fa7a288eb0703d995c59940c7c66de57a9b70f82379b70e2031e450fcfd2181326fcd28d8823baaa80df6e0f443559647539fd8907c0ffd9d79c130ed81c9afd9b7e848c9fed38443d5d380e53fbdb8ac8c3d3f06876054f122461107de92fea09c6f6923a188d53afe54a10f60e6e9d5a03d996b5fbc820f8a637116a27ad04b444a0932dd60fbd12671c11e1c0ec73e789879faa3d42c64d20cd1252742a3768c25a901585888ecee1e612d9936b403b0775949a66cdfd99a29b1345baa8d9d5400c91024b0a607363b013ce5de9ae869d3b8d95b0570b3c2d391422d32450cbcfae96652286e96dec1214a9346527980a8192eac1c39a3aaf6f15351da6be764df89772ec0407d06e4415befae7c92580df9bf507497c8f2995160d4e218daacb02944abf83340ce8be1686a960faf90e2d90c55cc6475babc3171a80a363174954955d7101dab16ae8179167e21444b443a9eaaa7c91de36d118c39d389f8dd4469a846c9a262bf7fa18487a79e8de11699e0b8fdf557cb48719d453ba713056109b93a218c89675ac195fb4fb06639b3797144955b3c9327d1aec003d42ecd0ea98abf19ffb4af3561a67e77c35bf15c59c2412da881db02b1bfbcebfac5152bc99bc3f1d15f771001b7029fedb028f8b852bc4407eb83f891c9ca733254fdd1e9edb56919ce9fea21c174072521c18319a54b5d4efbebddf1d8b69b1cbf25f489fcc981372547cf41d008ef0bca1926f934b735e090b3b251eb33a36f82ed9b29cf4cb944188fa0e1e38dd778f7d1c9d987b28d132dfb9731fa4f4b416935be49de30516af3578581f2f13f561c0663361941eab249a4bc123f8d15cd711a956a1bf20fe6eb78aea2373361da0426c79a530c3bb1de0c99722ef1fde39ac2b00a0a8ee7c800a08bc2264f89f4effe627ac2f0531fb554f6d21d74c590a70adfaa390bdfbb3d68e46215cab187d2368d5a71f5ebec081cd3b20c082dbe4cd2faca28773795d6b0c10204b659a939ef29bbe1088243624429927a7eb576dd3a00ea5e01af5d47583b2272c0c161a806521a16ff9b0a722c0cf26b025d5836e2258a4f7d4773ac801e4263bc294f43def7fa8703f3a4197463525887652b0b2a4a2a7cf87f00914871e25039113c7e1618da34064b57a43c463249fb8d05e0f26f4a6d84972e7a9054824145f91295cdbe39a6f920facc659712b46a54ba295bbe6a90154e91b33985a2bcd420ad5c67ec9ad8eb7ac6864db272a516bc94c2839b0a8169a6bf58e1a0c2ada8c883b7bf497a49171268ed15ddd2969384e7ff4bf4aab2ec9ecc6529cf629e2df0f08a77a65afa12aa9b505df8b287ef6cc91493d1caa39076e28ef1ea028f5118de61ae02bb6aefc3343a050292f199f401857b2bead5e6ee2a1f191022f9278016f047791a9d18da7d2a6d27f2e0e51c2f6ea30e8ac49a0604f4c13542e85b68381b9fdcfa0ce4b2d341354852d360245c536b612af71f3e77c9095ae2dbde504b265733dabfe10a20fc7d6d32c21ccc72b8b3444ae663d65922d17f82caa2b865cd88913d291a65899026ea1328439723c198c36b0c3c8d085bfaf8a320fde334b4a4919b44c2b95f6e8ecf73393f7f0d2a40e60b1d406526b022ddc331810b1a5f7c347bd53ed1f105d6a0d30aba477e178889ab2ec55d558deab2630204336962b4db5b663b6902b89e85b31bc6af50fc50accb3fb9b57b663297031378db47896d7fbaf6c600add2c67f936db037986db856eb49cf2db3f7da6d23650e438f1884041b013119e4c2ae5af37cccdfb68660738b58b3c59d1c0248437472aba1f35ca1fb90cd714aa9f635534f49e7c5bba81c2b6b36fdee21ca27e347f793d2ce944edb23c8c9b914be10335e350feb5070394b7a4a15c0ca120283568b7bfc254fe838b137a2147ce7c113a3a4d65499d9e86b87dbcc7f03bbd3a3ab1aa243ece5ba9bcf25f82836cfe473b2d83e7a7201cd0b96a72451e863f6c3ba664a6d073d1f7b5ed990865d978bd3815d06094fc9a2aba5221c22d5ab996389e3721e3af5f05beddc2875e0dfaeb39021ee27a41187cbb45ef40c3e73bc03989f9a30d12c54ba7d2141da8a875493e65776ef35f97debc2286cc4af9b4623eee902f840c52f1b8ad658939aef71f3f72b9ec1de21588bd35484ea44436343ff95ead6ab1d8afb1b2a303df1b71e53c4aea6b2e3e9372be0d1bc99798b0ce3cc10d2a596d565dba82f88ce4cff3b33d5d24e9c0831124bf1ad54b792532983dd6c3a8b7d0'O var octetstring msg_out:= f_calculate128_EIA2(key,count,bearer,direction,msg_in); log("Result ",msg_out) log("Expected ",'ebd5ccb0'O) if(msg_out=='ebd5ccb0'O){ setverdict(pass) } else { setverdict(fail) } } testcase tc_test_f_calculate128_EIA2_3() runs on Security_CT{ var OCT_16 key := '83fd23a244a74cf358da3019f1722635'O var OCT_4 count := '36af6144'O var integer bearer := 15; var BIT_1 direction := '1'B var octetstring msg_in:='35c68716633c66fb750c266865d53c11ea05b1e9fa49c8398d48e1efa5909d3947902837f5ae96d5a05bc8d61ca8dbef1b13a4b4abfe4fb1006045b674bb54729304c382be53a5af05556176f6eaa2ef1d05e4b083181ee674cda5a485f74d7a'O var octetstring msg_out:= f_calculate128_EIA2(key,count,bearer,direction,msg_in); log("Result ",msg_out) log("Expected ",'e657e182'O) if(msg_out=='e657e182'O){ setverdict(pass) } else { setverdict(fail) } } testcase tc_test_f_calculate128_EEA2() runs on Security_CT{ var OCT_16 key := 'd3c5d592327fb11c4035c6680af8c6d1'O var OCT_4 count := '398a59b4'O var integer bearer := 21; var BIT_1 direction := '1'B var octetstring msg_in := '981ba6824c1bfb1ab485472029b71d808ce33e2cc3c0b5fc1f3de8a6dc66b1f0'O var octetstring msg_out:= f_calculate128_EEA2(key,count,bearer,direction,msg_in); log(msg_out) if(msg_out=='E9FED8A63D155304D71DF20BF3E82214B20ED7DAD2F233DC3C22D7BDEEED8E78'O){ setverdict(pass) } else { setverdict(fail) } } // execute security tests control { log(" ################### Security ################### "); execute(f_test_digestresponse()); execute(f_test_MD5()); execute(tc_AKA_functions()); execute(tc_HMACMD5()); execute(tc_HMACMD5_2()); execute(tc_HMACMD5_3()); execute(tc_HMACMD5_4()); execute(tc_HMAC_SHA1()); execute(tc_HMAC_SHA256()); execute(tc_EIA()); execute(tc_EEA()); execute(tc_3des_ecb()); execute(tc_DH1024()); execute(tc_DH2048()); execute(tc_3DES_CBC()); execute(tc_AES_XCBC_128_no_data()); execute(tc_AES_XCBC_128_20byte_data()); execute(tc_test_f_calculate128_EEA1()) execute(tc_test_f_calculate128_EIA1()) execute(tc_test_f_calculate128_EIA2_1()) execute(tc_test_f_calculate128_EIA2_2()) execute(tc_test_f_calculate128_EIA2_3()) execute(tc_test_f_calculate128_EEA2()) } } with {extension "version R32A"}