Loading NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_Functions.ttcn +6 −94 Original line number Diff line number Diff line Loading @@ -46,17 +46,20 @@ group extHdrFns { if (f_isPresentHomeAddressOption(p_extHdrList, v_homeAddress) == e_success) { f_setMipHeader( v_homeAddress, p_dstAddr, p_extHdrList[i].mipHeader); p_extHdrList[i].mipHeader, p_ipv6Packet); } else if (f_isPresentRoutingHeaderType2(p_extHdrList, v_homeAddress) == e_success) { f_setMipHeader( p_srcAddr, v_homeAddress, p_extHdrList[i].mipHeader); p_extHdrList[i].mipHeader, p_ipv6Packet); } else { f_setMipHeader( p_srcAddr, p_dstAddr, p_extHdrList[i].mipHeader); p_extHdrList[i].mipHeader, p_ipv6Packet); } } else if (ischosen(p_extHdrList[i].tunneledIpv6)) { Loading Loading @@ -232,96 +235,5 @@ group extHdrFns { }//end function f_isPresentRoutingHeaderType2 /* * @desc This generates a random Init Cookie * @return Init Cookie */ function f_createInitCookie() runs on LibIpv6Node return Oct8 { var Oct8 v_cookie := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 8); return v_cookie; }//end f_createInitCookie /* * @desc This generates a Home Keygen Token * @param p_kcn Correspondant node's secret key * @param p_homeAddr Home address * @param p_nonce Home nonce * @return Home Keygen Token */ function f_createHomeKeygenToken(in octetstring p_kcn, in Ipv6Address p_homeAddr, in octetstring p_nonce) runs on LibIpv6Node return Oct8 { var octetstring v_mac := c_8ZeroBytes; var Oct8 v_token := c_8ZeroBytes; var UInt8 i; v_mac := fx_computeHMAC(p_kcn, p_homeAddr & p_nonce & int2oct(0,1), e_sha1 ); for ( i := 0; i < 8; i := i + 1 ) { v_token[i] := v_mac[i]; } return v_token; }//end f_createHomeKeygenToken /* * @desc This generates a Care-of Keygen Token * @param p_kcn Correspondant node's secret key * @param p_careOfAddr Care-of address * @param p_nonce Home nonce * @return Care-of Keygen Token */ function f_createCareOfKeygenToken(in octetstring p_kcn, in Ipv6Address p_careOfAddr, in octetstring p_nonce) runs on LibIpv6Node return Oct8 { var octetstring v_mac := c_8ZeroBytes; var Oct8 v_token := c_8ZeroBytes; var UInt8 i; v_mac := fx_computeHMAC(p_kcn, p_careOfAddr & p_nonce & int2oct(1,1), e_sha1 ); for ( i := 0; i < 8; i := i + 1 ) { v_token[i] := v_mac[i]; } return v_token; }//end f_createCareOfKeygenToken /* * @desc This generates a Binding Management Key * @param p_homeKeygenToken Home Keygen Token * @param p_careOfKeygenToken Care-of Keygen Token * @return Binding Management Key */ function f_createBindingManagementKey(in Oct8 p_homeKeygenToken, in Oct8 p_careOfKeygenToken) runs on LibIpv6Node return Oct8 { var octetstring v_key := c_8ZeroBytes; v_key := fx_computeHash(p_homeKeygenToken & p_careOfKeygenToken, e_sha1); return v_key; }//end f_createBindingManagementKey /* * @desc This generates a random Security Parameters Index * @return Security Parameters Index */ function f_createSecurityParametersIndex() runs on LibIpv6Node return Oct4 { var Oct4 v_spi := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 4); return v_spi; }//end f_createSecurityParametersIndex } // end module LibIpv6_CommonRfcs_Functions NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_TypesAndValues.ttcn +102 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ module LibIpv6_CommonRfcs_TypesAndValues { const UInt16 c_defSeqNo := 20; // for ICMP echo proc } group rfc3513AddressingArchitecture { group rfc4291AddressingArchitecture { type Oct16 Ipv6Address; type UInt8 PrefixLength ;//indicates nr of bits to be used as Prefix Loading @@ -35,7 +35,7 @@ module LibIpv6_CommonRfcs_TypesAndValues { } }//end group rfc3513AddressingArchitecture }//end group rfc4291AddressingArchitecture group ipv6Options { Loading Loading @@ -296,13 +296,110 @@ module LibIpv6_CommonRfcs_TypesAndValues { group security { type enumerated CryptoFunction { //Use c_cryptoDummyByte when no message needs to be specified in fx_cryptoFunction const Oct1 c_cryptoDummyByte := int2oct(0,1); type enumerated EncryptionAlgo { e_null(0), e_tripleDes_cbc(1), e_aes_cbc(2), e_aes_ctr(3), e_des_cbc(4) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated IntegrityAlgo { e_null(0), e_sha1(1) e_hmac_sha1_96(1), e_aes_xcbc_mac_96(2), e_hmac_md5_96(3), e_hmac_sha1_64(4), e_sha1_96(1) } with { encode "use=com.testingtech.ttcn.tci.*;"; //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated CombinedModeAlgo { e_null(0) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated CryptoAlgo { //EncryptionAlgo e_nullEnc(0), e_tripleDes_cbc(1), e_aes_cbc(2), e_aes_ctr(3), e_des_cbc(4), //IntegrityAlgo e_nullIntegrity(0), e_hmac_sha1_96(1),//ignore _96 TTCN takes care of it e_aes_xcbc_mac_96(2), e_hmac_md5_96(3), e_hmac_sha1_64(4),//ignore _64 TTCN takes care of it e_sha1_96(1) //CombinedModeAlgo } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } // type union CryptoAlgo { // EncryptionAlgo encryptionAlgo, // IntegrityAlgo integrityAlgo, // CombinedModeAlgo combinedModeAlgo // } type enumerated IpSecProtocolMode { e_transportMode (0), e_tunnelMode (1) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type record MipSecParams { Oct20 kbm } with { // encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } const UInt8 c_maxNrDa := 8; //Security Association type record Sa { UInt32 securityParametersIndex, UInt32 sequenceNumber, IntegrityAlgo ahIntegrityAlgo, octetstring ahIntegrityKey, EncryptionAlgo espEncryptionAlgo, octetstring espEncryptionKey, IntegrityAlgo espIntegrityAlgo, octetstring espIntegrityKey, CombinedModeAlgo espCombinedModeAlgo, octetstring espCombinedModeKey, IpSecProtocolMode ipSecProtocolMode } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } //Security Association Database type record length (1 .. c_maxNrDa) of Sa Sad; } // end security Loading NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_ExternalFunctions.ttcn +9 −16 Original line number Diff line number Diff line Loading @@ -77,36 +77,29 @@ // external function fx_dstOptHdrLength( in ExtensionHeader p_extHdr) // return UInt8; /* @desc This external function calculates a Message Authentication Code /* @desc Apply indicated crypto algorithm to the message. * Use when no message needs to be specified. * @param p_crypto Cryptographic function used to compute MAC * @param p_key Key used to compute the MAC * @param p_message Octetstring message * @param p_crypto Cryptographic function used to compute MAC * @return Message HMAC */ external function fx_computeHMAC(in octetstring p_key, in octetstring p_message, CryptoFunction p_crypto ) return octetstring; /* @desc This external function calculates a SHA1 hash * @param p_message Octetstring message * @param p_crypto Cryptographic function used to compute MAC * @return Message hash */ external function fx_computeHash(in octetstring p_message, CryptoFunction p_crypto ) external function fx_cryptoFunction( CryptoAlgo p_crypto, in octetstring p_key, in octetstring p_message) return octetstring; /* @desc This external function computes the Authenticator for * return routability procedure * The Ipv6Packet shall be used excluding the Authenticator field itself. * @param p_careOfAddr Care-of address * @param p_cnAddr Address of the correspondant * @param p_ipv6Packet Ipv6 Packet * @param p_kbm Binding management key * @return Authenticator */ external function fx_bindingAuthenticator(in octetstring p_careOfAddr, in Ipv6Address p_careOfAddr, in Ipv6Address cnAddr, external function fx_bindingAuthenticator(in Ipv6Address p_careOfAddr, in Ipv6Address p_cnAddr, in Ipv6Packet p_ipv6Packet, in octetstring p_kbm) in Oct20 p_kbm) return octetstring; /* @desc This external function computes Integrity Check Value Loading @@ -114,7 +107,7 @@ * @param p_sa Security association * @return Integrity Check Value */ external function fx_IntegrityCheckValue( in Ipv6Packet p_ipv6Packet, external function fx_integrityCheckValue( in Ipv6Packet p_ipv6Packet, in octetstring p_sa) return octetstring; Loading NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_Interface.ttcn +8 −5 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ module LibIpv6_Interface { //LibCommon import from LibCommon_Time all ; import from LibCommon_DataStrings all; //LibIpv6 import from LibIpv6_Rfc2460Root_TypesAndValues {type all}; import from LibIpv6_Rfc2463Icmpv6_TypesAndValues {type all}; Loading @@ -22,6 +23,7 @@ module LibIpv6_Interface { import from LibIpv6_Rfc3775Mipv6_TypesAndValues {type all}; import from LibIpv6_Rfc0768Udp_TypesAndValues all ; import from LibIpv6_Rfc4303Esp_TypesAndValues all; import from LibIpv6_CommonRfcs_TypesAndValues all; /* * @desc This type is used to define behavior within the IPv6 library Loading @@ -36,6 +38,8 @@ module LibIpv6_Interface { timer tc_ac:= PX_TAC; timer tc_noAc:= PX_TNOAC; timer tc_wait:= PX_TWAIT; //var Sad vc_sad; var MipSecParams vc_mipSecParams; } type port Ipv6Port message { Loading Loading @@ -72,8 +76,7 @@ module LibIpv6_Interface { //General IPv6 packet GeneralIpv6, //EspPackets EspTunnelModePacket, EspTransportModePacket EspPacket } /* Loading NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_ModuleParameters.ttcn +10 −0 Original line number Diff line number Diff line Loading @@ -24,4 +24,14 @@ module LibIpv6_ModuleParameters { */ modulepar {float PX_T_BUILD_GLA := 15.0} /* * @desc Shall IPSec be tested? */ modulepar {boolean PX_TEST_IPSEC := false} modulepar {UInt16 PX_HOME_NONCE_INDEX := 0} } // end module LibIpv6_ModuleParameters Loading
NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_Functions.ttcn +6 −94 Original line number Diff line number Diff line Loading @@ -46,17 +46,20 @@ group extHdrFns { if (f_isPresentHomeAddressOption(p_extHdrList, v_homeAddress) == e_success) { f_setMipHeader( v_homeAddress, p_dstAddr, p_extHdrList[i].mipHeader); p_extHdrList[i].mipHeader, p_ipv6Packet); } else if (f_isPresentRoutingHeaderType2(p_extHdrList, v_homeAddress) == e_success) { f_setMipHeader( p_srcAddr, v_homeAddress, p_extHdrList[i].mipHeader); p_extHdrList[i].mipHeader, p_ipv6Packet); } else { f_setMipHeader( p_srcAddr, p_dstAddr, p_extHdrList[i].mipHeader); p_extHdrList[i].mipHeader, p_ipv6Packet); } } else if (ischosen(p_extHdrList[i].tunneledIpv6)) { Loading Loading @@ -232,96 +235,5 @@ group extHdrFns { }//end function f_isPresentRoutingHeaderType2 /* * @desc This generates a random Init Cookie * @return Init Cookie */ function f_createInitCookie() runs on LibIpv6Node return Oct8 { var Oct8 v_cookie := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 8); return v_cookie; }//end f_createInitCookie /* * @desc This generates a Home Keygen Token * @param p_kcn Correspondant node's secret key * @param p_homeAddr Home address * @param p_nonce Home nonce * @return Home Keygen Token */ function f_createHomeKeygenToken(in octetstring p_kcn, in Ipv6Address p_homeAddr, in octetstring p_nonce) runs on LibIpv6Node return Oct8 { var octetstring v_mac := c_8ZeroBytes; var Oct8 v_token := c_8ZeroBytes; var UInt8 i; v_mac := fx_computeHMAC(p_kcn, p_homeAddr & p_nonce & int2oct(0,1), e_sha1 ); for ( i := 0; i < 8; i := i + 1 ) { v_token[i] := v_mac[i]; } return v_token; }//end f_createHomeKeygenToken /* * @desc This generates a Care-of Keygen Token * @param p_kcn Correspondant node's secret key * @param p_careOfAddr Care-of address * @param p_nonce Home nonce * @return Care-of Keygen Token */ function f_createCareOfKeygenToken(in octetstring p_kcn, in Ipv6Address p_careOfAddr, in octetstring p_nonce) runs on LibIpv6Node return Oct8 { var octetstring v_mac := c_8ZeroBytes; var Oct8 v_token := c_8ZeroBytes; var UInt8 i; v_mac := fx_computeHMAC(p_kcn, p_careOfAddr & p_nonce & int2oct(1,1), e_sha1 ); for ( i := 0; i < 8; i := i + 1 ) { v_token[i] := v_mac[i]; } return v_token; }//end f_createCareOfKeygenToken /* * @desc This generates a Binding Management Key * @param p_homeKeygenToken Home Keygen Token * @param p_careOfKeygenToken Care-of Keygen Token * @return Binding Management Key */ function f_createBindingManagementKey(in Oct8 p_homeKeygenToken, in Oct8 p_careOfKeygenToken) runs on LibIpv6Node return Oct8 { var octetstring v_key := c_8ZeroBytes; v_key := fx_computeHash(p_homeKeygenToken & p_careOfKeygenToken, e_sha1); return v_key; }//end f_createBindingManagementKey /* * @desc This generates a random Security Parameters Index * @return Security Parameters Index */ function f_createSecurityParametersIndex() runs on LibIpv6Node return Oct4 { var Oct4 v_spi := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 4); return v_spi; }//end f_createSecurityParametersIndex } // end module LibIpv6_CommonRfcs_Functions
NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_TypesAndValues.ttcn +102 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ module LibIpv6_CommonRfcs_TypesAndValues { const UInt16 c_defSeqNo := 20; // for ICMP echo proc } group rfc3513AddressingArchitecture { group rfc4291AddressingArchitecture { type Oct16 Ipv6Address; type UInt8 PrefixLength ;//indicates nr of bits to be used as Prefix Loading @@ -35,7 +35,7 @@ module LibIpv6_CommonRfcs_TypesAndValues { } }//end group rfc3513AddressingArchitecture }//end group rfc4291AddressingArchitecture group ipv6Options { Loading Loading @@ -296,13 +296,110 @@ module LibIpv6_CommonRfcs_TypesAndValues { group security { type enumerated CryptoFunction { //Use c_cryptoDummyByte when no message needs to be specified in fx_cryptoFunction const Oct1 c_cryptoDummyByte := int2oct(0,1); type enumerated EncryptionAlgo { e_null(0), e_tripleDes_cbc(1), e_aes_cbc(2), e_aes_ctr(3), e_des_cbc(4) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated IntegrityAlgo { e_null(0), e_sha1(1) e_hmac_sha1_96(1), e_aes_xcbc_mac_96(2), e_hmac_md5_96(3), e_hmac_sha1_64(4), e_sha1_96(1) } with { encode "use=com.testingtech.ttcn.tci.*;"; //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated CombinedModeAlgo { e_null(0) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type enumerated CryptoAlgo { //EncryptionAlgo e_nullEnc(0), e_tripleDes_cbc(1), e_aes_cbc(2), e_aes_ctr(3), e_des_cbc(4), //IntegrityAlgo e_nullIntegrity(0), e_hmac_sha1_96(1),//ignore _96 TTCN takes care of it e_aes_xcbc_mac_96(2), e_hmac_md5_96(3), e_hmac_sha1_64(4),//ignore _64 TTCN takes care of it e_sha1_96(1) //CombinedModeAlgo } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } // type union CryptoAlgo { // EncryptionAlgo encryptionAlgo, // IntegrityAlgo integrityAlgo, // CombinedModeAlgo combinedModeAlgo // } type enumerated IpSecProtocolMode { e_transportMode (0), e_tunnelMode (1) } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } type record MipSecParams { Oct20 kbm } with { // encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } const UInt8 c_maxNrDa := 8; //Security Association type record Sa { UInt32 securityParametersIndex, UInt32 sequenceNumber, IntegrityAlgo ahIntegrityAlgo, octetstring ahIntegrityKey, EncryptionAlgo espEncryptionAlgo, octetstring espEncryptionKey, IntegrityAlgo espIntegrityAlgo, octetstring espIntegrityKey, CombinedModeAlgo espCombinedModeAlgo, octetstring espCombinedModeKey, IpSecProtocolMode ipSecProtocolMode } with { //encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; } //Security Association Database type record length (1 .. c_maxNrDa) of Sa Sad; } // end security Loading
NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_ExternalFunctions.ttcn +9 −16 Original line number Diff line number Diff line Loading @@ -77,36 +77,29 @@ // external function fx_dstOptHdrLength( in ExtensionHeader p_extHdr) // return UInt8; /* @desc This external function calculates a Message Authentication Code /* @desc Apply indicated crypto algorithm to the message. * Use when no message needs to be specified. * @param p_crypto Cryptographic function used to compute MAC * @param p_key Key used to compute the MAC * @param p_message Octetstring message * @param p_crypto Cryptographic function used to compute MAC * @return Message HMAC */ external function fx_computeHMAC(in octetstring p_key, in octetstring p_message, CryptoFunction p_crypto ) return octetstring; /* @desc This external function calculates a SHA1 hash * @param p_message Octetstring message * @param p_crypto Cryptographic function used to compute MAC * @return Message hash */ external function fx_computeHash(in octetstring p_message, CryptoFunction p_crypto ) external function fx_cryptoFunction( CryptoAlgo p_crypto, in octetstring p_key, in octetstring p_message) return octetstring; /* @desc This external function computes the Authenticator for * return routability procedure * The Ipv6Packet shall be used excluding the Authenticator field itself. * @param p_careOfAddr Care-of address * @param p_cnAddr Address of the correspondant * @param p_ipv6Packet Ipv6 Packet * @param p_kbm Binding management key * @return Authenticator */ external function fx_bindingAuthenticator(in octetstring p_careOfAddr, in Ipv6Address p_careOfAddr, in Ipv6Address cnAddr, external function fx_bindingAuthenticator(in Ipv6Address p_careOfAddr, in Ipv6Address p_cnAddr, in Ipv6Packet p_ipv6Packet, in octetstring p_kbm) in Oct20 p_kbm) return octetstring; /* @desc This external function computes Integrity Check Value Loading @@ -114,7 +107,7 @@ * @param p_sa Security association * @return Integrity Check Value */ external function fx_IntegrityCheckValue( in Ipv6Packet p_ipv6Packet, external function fx_integrityCheckValue( in Ipv6Packet p_ipv6Packet, in octetstring p_sa) return octetstring; Loading
NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_Interface.ttcn +8 −5 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ module LibIpv6_Interface { //LibCommon import from LibCommon_Time all ; import from LibCommon_DataStrings all; //LibIpv6 import from LibIpv6_Rfc2460Root_TypesAndValues {type all}; import from LibIpv6_Rfc2463Icmpv6_TypesAndValues {type all}; Loading @@ -22,6 +23,7 @@ module LibIpv6_Interface { import from LibIpv6_Rfc3775Mipv6_TypesAndValues {type all}; import from LibIpv6_Rfc0768Udp_TypesAndValues all ; import from LibIpv6_Rfc4303Esp_TypesAndValues all; import from LibIpv6_CommonRfcs_TypesAndValues all; /* * @desc This type is used to define behavior within the IPv6 library Loading @@ -36,6 +38,8 @@ module LibIpv6_Interface { timer tc_ac:= PX_TAC; timer tc_noAc:= PX_TNOAC; timer tc_wait:= PX_TWAIT; //var Sad vc_sad; var MipSecParams vc_mipSecParams; } type port Ipv6Port message { Loading Loading @@ -72,8 +76,7 @@ module LibIpv6_Interface { //General IPv6 packet GeneralIpv6, //EspPackets EspTunnelModePacket, EspTransportModePacket EspPacket } /* Loading
NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_ModuleParameters.ttcn +10 −0 Original line number Diff line number Diff line Loading @@ -24,4 +24,14 @@ module LibIpv6_ModuleParameters { */ modulepar {float PX_T_BUILD_GLA := 15.0} /* * @desc Shall IPSec be tested? */ modulepar {boolean PX_TEST_IPSEC := false} modulepar {UInt16 PX_HOME_NONCE_INDEX := 0} } // end module LibIpv6_ModuleParameters