Loading ccsrc/Externals/LIB_NG_NAS_Functions_ext.cc +4 −4 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ namespace LIB__NG__NAS__Functions { } INTEGER fx__f1(const BITSTRING& p_authK, const BITSTRING& p_rand, const BITSTRING& p_sqn, const BITSTRING& p_amf, BITSTRING& p_mac_a) { loggers::get_instance().log_msg(">>> fx__f1: p_authK: ", p_authK); loggers::get_instance().log_msg(">>> fx__f1: p_rand: ", p_rand); loggers::get_instance().log_msg(">>> fx__f1: p_authK: ", bit2oct(p_authK)); loggers::get_instance().log_msg(">>> fx__f1: p_rand: ", bit2oct(p_rand)); rijndael r; OCTETSTRING authK = bit2oct(p_authK); Loading Loading @@ -74,8 +74,8 @@ namespace LIB__NG__NAS__Functions { } INTEGER fx__f1star(const BITSTRING& p_authK, const BITSTRING& p_rand, const BITSTRING& p_sqn, const BITSTRING& p_amf, BITSTRING& p_mac_s) { loggers::get_instance().log_msg(">>> fx__f1star: p_authK: ", p_authK); loggers::get_instance().log_msg(">>> fx__f1star: p_rand: ", p_rand); loggers::get_instance().log_msg(">>> fx__f1star: p_authK: ", bit2oct(p_authK)); loggers::get_instance().log_msg(">>> fx__f1star: p_rand: ", bit2oct(p_rand)); rijndael r; OCTETSTRING authK = bit2oct(p_authK); Loading ccsrc/Externals/common_ext.cc +10 −1 Original line number Diff line number Diff line Loading @@ -26,13 +26,17 @@ namespace CommonDefs { */ //INTEGER fx__KeyDerivationFunction(INTEGER const&, BITSTRING const&, OCTETSTRING const&){ BITSTRING fx__KeyDerivationFunction(const INTEGER& p__KDF, const BITSTRING& p__Key, const OCTETSTRING& p__String){ loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__KDF: ", p__KDF); loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__Key: ", bit2oct(p__Key)); hmac h; // hash_algorithms::sha_256: p__KDF == 1 (tsc_KDF_HMAC_SHA_256 see CommonDefs.ttcn) OCTETSTRING res; if (h.generate(p__String, bit2oct(p__Key), res) == -1) { loggers::get_instance().error("fx__KeyDerivationFunction: Key derivation failed"); return int2bit(0, 0); } loggers::get_instance().log_msg("<<< fx__KeyDerivationFunction: res: ", res); return oct2bit(res); } /** Loading @@ -42,6 +46,11 @@ namespace CommonDefs { */ //INTEGER fx__GetSystemTime(CommonDefs::Struct__tm__Type&, INTEGER&){ void fx__GetSystemTime(CommonDefs::Struct__tm__Type& p__Struct__tm, INTEGER& p__TimezoneInfo){ const time_t t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm* now = std::localtime(&t); p__Struct__tm = Struct__tm__Type(now->tm_sec, now->tm_min, now->tm_hour, now->tm_mday, now->tm_mon, now->tm_year, now->tm_wday, now->tm_yday, now->tm_isdst); p__TimezoneInfo = 0; // TODO FSCOM return; } //void fx__CalculateFCS32(BITSTRING const&) { Loading titan-test-system-framework @ 9ed59ebd Original line number Diff line number Diff line Subproject commit e7f13cca244490ee6f5fc6e80c6836384b562568 Subproject commit 9ed59ebd3c0a769688262f2370f6d3c3507b2a5f ttcn/Lib3GPP/Common/CommonDefs.ttcn +65 −63 Original line number Diff line number Diff line Loading @@ -14,77 +14,77 @@ module CommonDefs { //---------------------------------------------------------------------------- // type definitions: type bitstring B1_Type length(1); type bitstring B2_Type length(2); type bitstring B3_Type length(3); type bitstring B4_Type length(4); type bitstring B5_Type length(5); type bitstring B6_Type length(6); type bitstring B7_Type length(7); type bitstring B1_Type length(1) with { variant "FIELDLENGTH(1)" }; type bitstring B2_Type length(2) with { variant "FIELDLENGTH(2)" }; type bitstring B3_Type length(3) with { variant "FIELDLENGTH(3)" }; type bitstring B4_Type length(4) with { variant "FIELDLENGTH(4)" }; type bitstring B5_Type length(5) with { variant "FIELDLENGTH(5)" }; type bitstring B6_Type length(6) with { variant "FIELDLENGTH(6)" }; type bitstring B7_Type length(7) with { variant "FIELDLENGTH(7)" }; type bitstring B7_15_Type length(7..15); // NOTE: length restriction can only be a range but not two destinct lengths type bitstring B8_Type length(8); type bitstring B9_Type length(9); type bitstring B10_Type length(10); type bitstring B11_Type length(11); type bitstring B12_Type length(12); type bitstring B13_Type length(13); type bitstring B14_Type length(14); type bitstring B15_Type length(15); type bitstring B16_Type length(16); type bitstring B18_Type length(18); type bitstring B20_Type length(20); type bitstring B22_Type length(22); type bitstring B24_Type length(24); type bitstring B27_Type length(27); type bitstring B28_Type length(28); type bitstring B32_Type length(32); type bitstring B36_Type length(36); type bitstring B40_Type length(40); type bitstring B41_Type length(41); type bitstring B42_Type length(42); type bitstring B43_Type length(43); type bitstring B45_Type length(45); type bitstring B47_Type length(47); type bitstring B48_Type length(48); type bitstring B56_Type length(56); type bitstring B64_Type length(64); type bitstring B80_Type length(80); type bitstring B112_Type length(112); type bitstring B128_Type length(128); type bitstring B160_Type length(160); type bitstring B184_Type length(184); type bitstring B192_Type length(192); type bitstring B256_Type length(256); type bitstring B8_Type length(8) with { variant "FIELDLENGTH(8)" }; type bitstring B9_Type length(9) with { variant "FIELDLENGTH(9)" }; type bitstring B10_Type length(10) with { variant "FIELDLENGTH(10)" }; type bitstring B11_Type length(11) with { variant "FIELDLENGTH(11)" }; type bitstring B12_Type length(12) with { variant "FIELDLENGTH(12)" }; type bitstring B13_Type length(13) with { variant "FIELDLENGTH(13)" }; type bitstring B14_Type length(14) with { variant "FIELDLENGTH(14)" }; type bitstring B15_Type length(15) with { variant "FIELDLENGTH(15)" }; type bitstring B16_Type length(16) with { variant "FIELDLENGTH(16)" }; type bitstring B18_Type length(18) with { variant "FIELDLENGTH(18)" }; type bitstring B20_Type length(20) with { variant "FIELDLENGTH(20)" }; type bitstring B22_Type length(22) with { variant "FIELDLENGTH(22)" }; type bitstring B24_Type length(24) with { variant "FIELDLENGTH(24)" }; type bitstring B27_Type length(27) with { variant "FIELDLENGTH(27)" }; type bitstring B28_Type length(28) with { variant "FIELDLENGTH(28)" }; type bitstring B32_Type length(32) with { variant "FIELDLENGTH(32)" }; type bitstring B36_Type length(36) with { variant "FIELDLENGTH(36)" }; type bitstring B40_Type length(40) with { variant "FIELDLENGTH(40)" }; type bitstring B41_Type length(41) with { variant "FIELDLENGTH(41)" }; type bitstring B42_Type length(42) with { variant "FIELDLENGTH(42)" }; type bitstring B43_Type length(43) with { variant "FIELDLENGTH(43)" }; type bitstring B45_Type length(45) with { variant "FIELDLENGTH(45)" }; type bitstring B47_Type length(47) with { variant "FIELDLENGTH(47)" }; type bitstring B48_Type length(48) with { variant "FIELDLENGTH(48)" }; type bitstring B56_Type length(56) with { variant "FIELDLENGTH(56)" }; type bitstring B64_Type length(64) with { variant "FIELDLENGTH(64)" }; type bitstring B80_Type length(80) with { variant "FIELDLENGTH(80)" }; type bitstring B112_Type length(112) with { variant "FIELDLENGTH(112)" }; type bitstring B128_Type length(128) with { variant "FIELDLENGTH(128)" }; type bitstring B160_Type length(160) with { variant "FIELDLENGTH(160)" }; type bitstring B184_Type length(184) with { variant "FIELDLENGTH(184)" }; type bitstring B192_Type length(192) with { variant "FIELDLENGTH(192)" }; type bitstring B256_Type length(256) with { variant "FIELDLENGTH(256)" }; type bitstring B32_128_Type length(32..128); type B128_Type B128_Key_Type; /* 128 bit security key */ type B256_Type B256_Key_Type; /* 256 bit security key */ type octetstring O1_Type length(1); type octetstring O2_Type length(2); type octetstring O3_Type length(3); type octetstring O4_Type length(4); type octetstring O5_Type length(5); type octetstring O6_Type length(6); type octetstring O8_Type length(8); type octetstring O9_Type length(9); type octetstring O10_Type length(10); type octetstring O13_Type length(13); type octetstring O14_Type length(14); type octetstring O15_Type length(15); type octetstring O16_Type length(16); type octetstring O28_Type length(28); type octetstring O32_Type length(32); type octetstring O43_Type length(43); type hexstring H1_Type length(1); type hexstring H2_Type length(2); type hexstring H4_Type length(4); type hexstring H12_Type length(12); type hexstring H14_Type length(14); type octetstring O1_Type length(1) with { variant "FIELDLENGTH(1)" }; type octetstring O2_Type length(2) with { variant "FIELDLENGTH(2)" }; type octetstring O3_Type length(3) with { variant "FIELDLENGTH(3)" }; type octetstring O4_Type length(4) with { variant "FIELDLENGTH(4)" }; type octetstring O5_Type length(5) with { variant "FIELDLENGTH(5)" }; type octetstring O6_Type length(6) with { variant "FIELDLENGTH(6)" }; type octetstring O8_Type length(8) with { variant "FIELDLENGTH(8)" }; type octetstring O9_Type length(9) with { variant "FIELDLENGTH(9)" }; type octetstring O10_Type length(10) with { variant "FIELDLENGTH(10)" }; type octetstring O13_Type length(13) with { variant "FIELDLENGTH(13)" }; type octetstring O14_Type length(14) with { variant "FIELDLENGTH(14)" }; type octetstring O15_Type length(15) with { variant "FIELDLENGTH(15)" }; type octetstring O16_Type length(16) with { variant "FIELDLENGTH(16)" }; type octetstring O28_Type length(28) with { variant "FIELDLENGTH(28)" }; type octetstring O32_Type length(32) with { variant "FIELDLENGTH(32)" }; type octetstring O43_Type length(43) with { variant "FIELDLENGTH(43)" }; type hexstring H1_Type length(1) with { variant "FIELDLENGTH(1)" }; type hexstring H2_Type length(2) with { variant "FIELDLENGTH(2)" }; type hexstring H4_Type length(4) with { variant "FIELDLENGTH(4)" }; type hexstring H12_Type length(12) with { variant "FIELDLENGTH(12)" }; type hexstring H14_Type length(14) with { variant "FIELDLENGTH(14)" }; type O1_Type Octet_Type; type hexstring HalfOctet_Type length(1); type hexstring HalfOctet_Type length(1) with { variant "FIELDLENGTH(1)" }; type record of B8_Type B8_List_Type; Loading Loading @@ -1695,4 +1695,6 @@ module CommonDefs { } return omit; } } with { encode "RAW" } ttcn/Lib3GPP/NAS/NAS_CommonTypeDefs.ttcn +281 −21 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
ccsrc/Externals/LIB_NG_NAS_Functions_ext.cc +4 −4 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ namespace LIB__NG__NAS__Functions { } INTEGER fx__f1(const BITSTRING& p_authK, const BITSTRING& p_rand, const BITSTRING& p_sqn, const BITSTRING& p_amf, BITSTRING& p_mac_a) { loggers::get_instance().log_msg(">>> fx__f1: p_authK: ", p_authK); loggers::get_instance().log_msg(">>> fx__f1: p_rand: ", p_rand); loggers::get_instance().log_msg(">>> fx__f1: p_authK: ", bit2oct(p_authK)); loggers::get_instance().log_msg(">>> fx__f1: p_rand: ", bit2oct(p_rand)); rijndael r; OCTETSTRING authK = bit2oct(p_authK); Loading Loading @@ -74,8 +74,8 @@ namespace LIB__NG__NAS__Functions { } INTEGER fx__f1star(const BITSTRING& p_authK, const BITSTRING& p_rand, const BITSTRING& p_sqn, const BITSTRING& p_amf, BITSTRING& p_mac_s) { loggers::get_instance().log_msg(">>> fx__f1star: p_authK: ", p_authK); loggers::get_instance().log_msg(">>> fx__f1star: p_rand: ", p_rand); loggers::get_instance().log_msg(">>> fx__f1star: p_authK: ", bit2oct(p_authK)); loggers::get_instance().log_msg(">>> fx__f1star: p_rand: ", bit2oct(p_rand)); rijndael r; OCTETSTRING authK = bit2oct(p_authK); Loading
ccsrc/Externals/common_ext.cc +10 −1 Original line number Diff line number Diff line Loading @@ -26,13 +26,17 @@ namespace CommonDefs { */ //INTEGER fx__KeyDerivationFunction(INTEGER const&, BITSTRING const&, OCTETSTRING const&){ BITSTRING fx__KeyDerivationFunction(const INTEGER& p__KDF, const BITSTRING& p__Key, const OCTETSTRING& p__String){ loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__KDF: ", p__KDF); loggers::get_instance().log_msg(">>> fx__KeyDerivationFunction: p__Key: ", bit2oct(p__Key)); hmac h; // hash_algorithms::sha_256: p__KDF == 1 (tsc_KDF_HMAC_SHA_256 see CommonDefs.ttcn) OCTETSTRING res; if (h.generate(p__String, bit2oct(p__Key), res) == -1) { loggers::get_instance().error("fx__KeyDerivationFunction: Key derivation failed"); return int2bit(0, 0); } loggers::get_instance().log_msg("<<< fx__KeyDerivationFunction: res: ", res); return oct2bit(res); } /** Loading @@ -42,6 +46,11 @@ namespace CommonDefs { */ //INTEGER fx__GetSystemTime(CommonDefs::Struct__tm__Type&, INTEGER&){ void fx__GetSystemTime(CommonDefs::Struct__tm__Type& p__Struct__tm, INTEGER& p__TimezoneInfo){ const time_t t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); tm* now = std::localtime(&t); p__Struct__tm = Struct__tm__Type(now->tm_sec, now->tm_min, now->tm_hour, now->tm_mday, now->tm_mon, now->tm_year, now->tm_wday, now->tm_yday, now->tm_isdst); p__TimezoneInfo = 0; // TODO FSCOM return; } //void fx__CalculateFCS32(BITSTRING const&) { Loading
titan-test-system-framework @ 9ed59ebd Original line number Diff line number Diff line Subproject commit e7f13cca244490ee6f5fc6e80c6836384b562568 Subproject commit 9ed59ebd3c0a769688262f2370f6d3c3507b2a5f
ttcn/Lib3GPP/Common/CommonDefs.ttcn +65 −63 Original line number Diff line number Diff line Loading @@ -14,77 +14,77 @@ module CommonDefs { //---------------------------------------------------------------------------- // type definitions: type bitstring B1_Type length(1); type bitstring B2_Type length(2); type bitstring B3_Type length(3); type bitstring B4_Type length(4); type bitstring B5_Type length(5); type bitstring B6_Type length(6); type bitstring B7_Type length(7); type bitstring B1_Type length(1) with { variant "FIELDLENGTH(1)" }; type bitstring B2_Type length(2) with { variant "FIELDLENGTH(2)" }; type bitstring B3_Type length(3) with { variant "FIELDLENGTH(3)" }; type bitstring B4_Type length(4) with { variant "FIELDLENGTH(4)" }; type bitstring B5_Type length(5) with { variant "FIELDLENGTH(5)" }; type bitstring B6_Type length(6) with { variant "FIELDLENGTH(6)" }; type bitstring B7_Type length(7) with { variant "FIELDLENGTH(7)" }; type bitstring B7_15_Type length(7..15); // NOTE: length restriction can only be a range but not two destinct lengths type bitstring B8_Type length(8); type bitstring B9_Type length(9); type bitstring B10_Type length(10); type bitstring B11_Type length(11); type bitstring B12_Type length(12); type bitstring B13_Type length(13); type bitstring B14_Type length(14); type bitstring B15_Type length(15); type bitstring B16_Type length(16); type bitstring B18_Type length(18); type bitstring B20_Type length(20); type bitstring B22_Type length(22); type bitstring B24_Type length(24); type bitstring B27_Type length(27); type bitstring B28_Type length(28); type bitstring B32_Type length(32); type bitstring B36_Type length(36); type bitstring B40_Type length(40); type bitstring B41_Type length(41); type bitstring B42_Type length(42); type bitstring B43_Type length(43); type bitstring B45_Type length(45); type bitstring B47_Type length(47); type bitstring B48_Type length(48); type bitstring B56_Type length(56); type bitstring B64_Type length(64); type bitstring B80_Type length(80); type bitstring B112_Type length(112); type bitstring B128_Type length(128); type bitstring B160_Type length(160); type bitstring B184_Type length(184); type bitstring B192_Type length(192); type bitstring B256_Type length(256); type bitstring B8_Type length(8) with { variant "FIELDLENGTH(8)" }; type bitstring B9_Type length(9) with { variant "FIELDLENGTH(9)" }; type bitstring B10_Type length(10) with { variant "FIELDLENGTH(10)" }; type bitstring B11_Type length(11) with { variant "FIELDLENGTH(11)" }; type bitstring B12_Type length(12) with { variant "FIELDLENGTH(12)" }; type bitstring B13_Type length(13) with { variant "FIELDLENGTH(13)" }; type bitstring B14_Type length(14) with { variant "FIELDLENGTH(14)" }; type bitstring B15_Type length(15) with { variant "FIELDLENGTH(15)" }; type bitstring B16_Type length(16) with { variant "FIELDLENGTH(16)" }; type bitstring B18_Type length(18) with { variant "FIELDLENGTH(18)" }; type bitstring B20_Type length(20) with { variant "FIELDLENGTH(20)" }; type bitstring B22_Type length(22) with { variant "FIELDLENGTH(22)" }; type bitstring B24_Type length(24) with { variant "FIELDLENGTH(24)" }; type bitstring B27_Type length(27) with { variant "FIELDLENGTH(27)" }; type bitstring B28_Type length(28) with { variant "FIELDLENGTH(28)" }; type bitstring B32_Type length(32) with { variant "FIELDLENGTH(32)" }; type bitstring B36_Type length(36) with { variant "FIELDLENGTH(36)" }; type bitstring B40_Type length(40) with { variant "FIELDLENGTH(40)" }; type bitstring B41_Type length(41) with { variant "FIELDLENGTH(41)" }; type bitstring B42_Type length(42) with { variant "FIELDLENGTH(42)" }; type bitstring B43_Type length(43) with { variant "FIELDLENGTH(43)" }; type bitstring B45_Type length(45) with { variant "FIELDLENGTH(45)" }; type bitstring B47_Type length(47) with { variant "FIELDLENGTH(47)" }; type bitstring B48_Type length(48) with { variant "FIELDLENGTH(48)" }; type bitstring B56_Type length(56) with { variant "FIELDLENGTH(56)" }; type bitstring B64_Type length(64) with { variant "FIELDLENGTH(64)" }; type bitstring B80_Type length(80) with { variant "FIELDLENGTH(80)" }; type bitstring B112_Type length(112) with { variant "FIELDLENGTH(112)" }; type bitstring B128_Type length(128) with { variant "FIELDLENGTH(128)" }; type bitstring B160_Type length(160) with { variant "FIELDLENGTH(160)" }; type bitstring B184_Type length(184) with { variant "FIELDLENGTH(184)" }; type bitstring B192_Type length(192) with { variant "FIELDLENGTH(192)" }; type bitstring B256_Type length(256) with { variant "FIELDLENGTH(256)" }; type bitstring B32_128_Type length(32..128); type B128_Type B128_Key_Type; /* 128 bit security key */ type B256_Type B256_Key_Type; /* 256 bit security key */ type octetstring O1_Type length(1); type octetstring O2_Type length(2); type octetstring O3_Type length(3); type octetstring O4_Type length(4); type octetstring O5_Type length(5); type octetstring O6_Type length(6); type octetstring O8_Type length(8); type octetstring O9_Type length(9); type octetstring O10_Type length(10); type octetstring O13_Type length(13); type octetstring O14_Type length(14); type octetstring O15_Type length(15); type octetstring O16_Type length(16); type octetstring O28_Type length(28); type octetstring O32_Type length(32); type octetstring O43_Type length(43); type hexstring H1_Type length(1); type hexstring H2_Type length(2); type hexstring H4_Type length(4); type hexstring H12_Type length(12); type hexstring H14_Type length(14); type octetstring O1_Type length(1) with { variant "FIELDLENGTH(1)" }; type octetstring O2_Type length(2) with { variant "FIELDLENGTH(2)" }; type octetstring O3_Type length(3) with { variant "FIELDLENGTH(3)" }; type octetstring O4_Type length(4) with { variant "FIELDLENGTH(4)" }; type octetstring O5_Type length(5) with { variant "FIELDLENGTH(5)" }; type octetstring O6_Type length(6) with { variant "FIELDLENGTH(6)" }; type octetstring O8_Type length(8) with { variant "FIELDLENGTH(8)" }; type octetstring O9_Type length(9) with { variant "FIELDLENGTH(9)" }; type octetstring O10_Type length(10) with { variant "FIELDLENGTH(10)" }; type octetstring O13_Type length(13) with { variant "FIELDLENGTH(13)" }; type octetstring O14_Type length(14) with { variant "FIELDLENGTH(14)" }; type octetstring O15_Type length(15) with { variant "FIELDLENGTH(15)" }; type octetstring O16_Type length(16) with { variant "FIELDLENGTH(16)" }; type octetstring O28_Type length(28) with { variant "FIELDLENGTH(28)" }; type octetstring O32_Type length(32) with { variant "FIELDLENGTH(32)" }; type octetstring O43_Type length(43) with { variant "FIELDLENGTH(43)" }; type hexstring H1_Type length(1) with { variant "FIELDLENGTH(1)" }; type hexstring H2_Type length(2) with { variant "FIELDLENGTH(2)" }; type hexstring H4_Type length(4) with { variant "FIELDLENGTH(4)" }; type hexstring H12_Type length(12) with { variant "FIELDLENGTH(12)" }; type hexstring H14_Type length(14) with { variant "FIELDLENGTH(14)" }; type O1_Type Octet_Type; type hexstring HalfOctet_Type length(1); type hexstring HalfOctet_Type length(1) with { variant "FIELDLENGTH(1)" }; type record of B8_Type B8_List_Type; Loading Loading @@ -1695,4 +1695,6 @@ module CommonDefs { } return omit; } } with { encode "RAW" }
ttcn/Lib3GPP/NAS/NAS_CommonTypeDefs.ttcn +281 −21 File changed.Preview size limit exceeded, changes collapsed. Show changes