Loading NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_TypesAndValues.ttcn +38 −11 Original line number Diff line number Diff line Loading @@ -340,12 +340,12 @@ module LibIpv6_CommonRfcs_TypesAndValues { 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) e_nullIntegrity(5), e_hmac_sha1_96(6),//ignore _96 TTCN takes care of it e_aes_xcbc_mac_96(7), e_hmac_md5_96(8), e_hmac_sha1_64(9),//ignore _64 TTCN takes care of it e_sha1_96(10) //CombinedModeAlgo } with { Loading @@ -368,12 +368,39 @@ module LibIpv6_CommonRfcs_TypesAndValues { encode "TODO"; } type record MipSecParams { type enumerated IpSecProtocol{ e_esp (0), e_ah (1) } type record MipSec { MnSimuParams mnSimuParams, HaSimuParams haSimuParams, CnSimuParams cnSimuParams } type CnSimuParams HaSimuParams; type record CnSimuParams { //Keygen Token UInt16 homeNonceIndex, octetstring homeNonce, Oct20 kcn, Bit64 homeKeygenToken, Bit64 careOfKeygenToken, Bit64 receivedHomeInitCookie, Oct20 kbm } with { // encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; type record MnSimuParams { //Keygen Token UInt16 receivedHomeNonceIndex, //octetstring homeNonce, //Oct20 kcn, Bit64 receivedHomeKeygenToken, Bit64 receivedCareOfKeygenToken, Bit64 homeInitCookie, Oct20 kbm } const UInt8 c_maxNrDa := 8; Loading NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_Interface.ttcn +4 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ module LibIpv6_Interface { timer tc_noAc:= PX_TNOAC; timer tc_wait:= PX_TWAIT; //var Sad vc_sad; var MipSecParams vc_mipSecParams; var MipSec vc_mipSec; var Sad vc_sad; } type port Ipv6Port message { Loading Loading @@ -110,7 +111,8 @@ module LibIpv6_Interface { //Udp UdpPacket udpPacket, //General IPv6 packet GeneralIpv6 generalIpv6 GeneralIpv6 generalIpv6, EspPacket espPacket } with { encode "isPDU=LibIpv6_Interface;" Loading NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_ModuleParameters.ttcn +21 −5 Original line number Diff line number Diff line Loading @@ -25,13 +25,29 @@ module LibIpv6_ModuleParameters { modulepar {float PX_T_BUILD_GLA := 15.0} /* * @desc Shall IPSEC be tested? */ modulepar { boolean PX_IP_SEC := true } /* * @desc Shall IPSec be tested? * @desc Shall IPSEC be tested? */ modulepar {boolean PX_TEST_IPSEC := false} modulepar { IpSecProtocol PX_IP_SEC_PROTOCOL := e_esp } modulepar {UInt16 PX_HOME_NONCE_INDEX := 0} /* * @desc Which protocol mode shall be tested? */ modulepar { IpSecProtocolMode PX_IP_SEC_PROTOCOL_MODE := e_transportMode } /* * @desc Which Algo mode shall be used for Encryption? */ modulepar { EncryptionAlgo PX_ENCRYPTION_ALGO := e_tripleDes_cbc } /* * @desc Which Algo mode shall be used for Integrity? */ modulepar { IntegrityAlgo PX_INTEGRITY_ALGO := e_hmac_sha1_96 } } // end module LibIpv6_ModuleParameters NewModuleStructure/EtsiLibrary/LibIpv6/LibMobility/LibIpv6_Rfc3775Mipv6_ExtHdrFunctions.ttcn +57 −25 Original line number Diff line number Diff line Loading @@ -16,17 +16,46 @@ //LibIpv6 import from LibIpv6_CommonRfcs_TypesAndValues all ; import from LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues all; import from LibIpv6_Rfc3775Mipv6_ExtHdrTemplates all; //import from LibIpv6_Rfc3775Mipv6_ExtHdrTemplates all; import from LibIpv6_Interface all; import from LibIpv6_ExternalFunctions all; import from LibIpv6_CommonRfcs_Templates all; import from LibIpv6_CommonRfcs_TypesAndValues all; import from LibIpv6_ModuleParameters all; function f_initMipSecParams() runs on LibIpv6Node { vc_mipSec.cnSimuParams := { homeNonceIndex := f_createHomeNonceIndex(), homeNonce := f_createHomeNonce(), kcn := f_createKcn(), homeKeygenToken := c_64ZeroBits, careOfKeygenToken := c_64ZeroBits, receivedHomeInitCookie := c_64ZeroBits, kbm := c_20ZeroBytes } vc_mipSec.mnSimuParams := { receivedHomeNonceIndex := c_uInt16Zero, //homeNonce := f_createHomeNonce(), //kcn := f_createKcn(), receivedHomeKeygenToken := c_64ZeroBits, receivedCareOfKeygenToken := c_64ZeroBits, homeInitCookie := f_createInitCookie(), kbm := c_20ZeroBytes } vc_mipSec.haSimuParams := vc_mipSec.cnSimuParams; }//end function f_initMipSecParams /* * @desc This goes through the Mip header and calculates length, checksum * and other specific functions of the different messages * and other specific functions of the different messages. * This function is used when sending messages. * @param p_msg ExtensionHeaderList to be treated * @return execution status */ Loading @@ -39,35 +68,25 @@ var MipHeader v_mipHeader := valueof(p_mipHeader); var Ipv6Address v_homeAddress := c_16ZeroBytes ; if (ischosen(p_mipHeader.mipMessage.homeTestInit) and (PX_TEST_IPSEC == true)) { //if (ischosen(p_mipHeader.mipMessage.homeTestInit)) { //calc homeInitCookie p_mipHeader.mipMessage.homeTestInit.homeInitCookie := f_createInitCookie(); } else if (ischosen(p_mipHeader.mipMessage.homeTest) and (PX_TEST_IPSEC == true)) { //CN sends this message //calc homeNonceIndex TODO p_mipHeader.mipMessage.homeTest.homeNonceIndex := PX_HOME_NONCE_INDEX ; //calc homeInitCookie TODO p_mipHeader.mipMessage.homeTest.homeInitCookie := f_createInitCookie(); //calc homeKeygenToken TODO p_mipHeader.mipMessage.homeTest.homeKeygenToken := f_createHomeKeygenToken( f_createKcn(), p_dstAddr, //check that this is the mnHoa f_createHomeNonce()); } else if (ischosen(p_mipHeader.mipMessage.careOfTestInit) and (PX_TEST_IPSEC == true)) { //p_mipHeader.mipMessage.homeTestInit.homeInitCookie := f_createInitCookie(); //} //else if (ischosen(p_mipHeader.mipMessage.homeTest)) {//CNSimu sends this message //} //else if (ischosen(p_mipHeader.mipMessage.careOfTestInit) and (PX_TEST_IPSEC == true)) { //TODO } else if (ischosen(p_mipHeader.mipMessage.careOfTest) and (PX_TEST_IPSEC == true)) { //} //else if (ischosen(p_mipHeader.mipMessage.careOfTest) and (PX_TEST_IPSEC == true)) { //TODO } else if (ischosen(p_mipHeader.mipMessage.bindingUpdate) and (PX_TEST_IPSEC == true)) { //} if (ischosen(p_mipHeader.mipMessage.bindingUpdate)) { var UInt8 v_position := 0; if (f_isPresentBindingAuthorizationDataOption(p_mipHeader.mipMessage.bindingUpdate, v_position) == e_success) { var Oct20 v_bindingAuthenticator := fx_bindingAuthenticator( p_srcAddr,//careOfaddr p_dstAddr,//cnAddr p_ipv6Packet, vc_mipSecParams.kbm) ; vc_mipSec.mnSimuParams.kbm) ; p_mipHeader.mipMessage.bindingUpdate.mipOptions[v_position].mipBindingAuthorizationData := { mipOptType := 5, mipOptLen := lengthof(v_bindingAuthenticator), Loading @@ -75,9 +94,9 @@ } } } else if (ischosen(p_mipHeader.mipMessage.bindingAck) and (PX_TEST_IPSEC == true)) { // else if (ischosen(p_mipHeader.mipMessage.bindingAck) and (PX_TEST_IPSEC == true)) { //TODO } //} //calc mipHeaderLen p_mipHeader.headerLen := fx_mipHeaderLength(p_mipHeader); //set mipChecksum to zero Loading Loading @@ -120,6 +139,19 @@ return v_homeNonce; }//end f_createHomeNonce /* * @desc This generates a random Home Nonce Index * @return Init Cookie */ function f_createHomeNonceIndex() runs on LibIpv6Node return UInt16 { var Oct2 v_homeNonceIndex := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 2); return oct2int(v_homeNonceIndex); }//end f_createHomeNonceIndex /* * @desc This generates CN's secret key * @return Init Cookie Loading NewModuleStructure/EtsiLibrary/LibIpv6/LibMobility/LibIpv6_Rfc3775Mipv6_ExtHdrTemplates.ttcn +9 −6 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ //LibIpv6 import from LibIpv6_CommonRfcs_TypesAndValues all ; import from LibIpv6_CommonRfcs_Templates all ; import from LibIpv6_Rfc3775Mipv6_ExtHdrFunctions all; import from LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues all; import from LibIpv6_Rfc2460Root_TypesAndValues all; import from LibIpv6_Rfc3775Mipv6_TypesAndValues all; Loading Loading @@ -107,11 +108,13 @@ } } template MipMessage m_hot := { template MipMessage m_hot( UInt16 p_homeNonceIndex, Bit64 p_homeInitCookie, Bit64 p_homeKeygenToken) := { homeTest := { homeNonceIndex := c_uInt16Zero, homeInitCookie := c_64ZeroBits, homeKeygenToken := c_64ZeroBits, homeNonceIndex := p_homeNonceIndex,//c_uInt16Zero, homeInitCookie := p_homeInitCookie,//c_64ZeroBits, homeKeygenToken := p_homeKeygenToken, mipOptions := omit } } Loading @@ -125,10 +128,10 @@ } } template MipMessage m_hoti := { template MipMessage m_hoti(Bit64 p_homeInitCookie) := { homeTestInit := { reserved := c_uInt16Zero, homeInitCookie := c_64ZeroBits, homeInitCookie := p_homeInitCookie, mipOptions := omit } } Loading Loading
NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_CommonRfcs_TypesAndValues.ttcn +38 −11 Original line number Diff line number Diff line Loading @@ -340,12 +340,12 @@ module LibIpv6_CommonRfcs_TypesAndValues { 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) e_nullIntegrity(5), e_hmac_sha1_96(6),//ignore _96 TTCN takes care of it e_aes_xcbc_mac_96(7), e_hmac_md5_96(8), e_hmac_sha1_64(9),//ignore _64 TTCN takes care of it e_sha1_96(10) //CombinedModeAlgo } with { Loading @@ -368,12 +368,39 @@ module LibIpv6_CommonRfcs_TypesAndValues { encode "TODO"; } type record MipSecParams { type enumerated IpSecProtocol{ e_esp (0), e_ah (1) } type record MipSec { MnSimuParams mnSimuParams, HaSimuParams haSimuParams, CnSimuParams cnSimuParams } type CnSimuParams HaSimuParams; type record CnSimuParams { //Keygen Token UInt16 homeNonceIndex, octetstring homeNonce, Oct20 kcn, Bit64 homeKeygenToken, Bit64 careOfKeygenToken, Bit64 receivedHomeInitCookie, Oct20 kbm } with { // encode "use=com.testingtech.ttcn.tci.*;"; encode "TODO"; type record MnSimuParams { //Keygen Token UInt16 receivedHomeNonceIndex, //octetstring homeNonce, //Oct20 kcn, Bit64 receivedHomeKeygenToken, Bit64 receivedCareOfKeygenToken, Bit64 homeInitCookie, Oct20 kbm } const UInt8 c_maxNrDa := 8; Loading
NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_Interface.ttcn +4 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ module LibIpv6_Interface { timer tc_noAc:= PX_TNOAC; timer tc_wait:= PX_TWAIT; //var Sad vc_sad; var MipSecParams vc_mipSecParams; var MipSec vc_mipSec; var Sad vc_sad; } type port Ipv6Port message { Loading Loading @@ -110,7 +111,8 @@ module LibIpv6_Interface { //Udp UdpPacket udpPacket, //General IPv6 packet GeneralIpv6 generalIpv6 GeneralIpv6 generalIpv6, EspPacket espPacket } with { encode "isPDU=LibIpv6_Interface;" Loading
NewModuleStructure/EtsiLibrary/LibIpv6/LibCommonRfcs/LibIpv6_ModuleParameters.ttcn +21 −5 Original line number Diff line number Diff line Loading @@ -25,13 +25,29 @@ module LibIpv6_ModuleParameters { modulepar {float PX_T_BUILD_GLA := 15.0} /* * @desc Shall IPSEC be tested? */ modulepar { boolean PX_IP_SEC := true } /* * @desc Shall IPSec be tested? * @desc Shall IPSEC be tested? */ modulepar {boolean PX_TEST_IPSEC := false} modulepar { IpSecProtocol PX_IP_SEC_PROTOCOL := e_esp } modulepar {UInt16 PX_HOME_NONCE_INDEX := 0} /* * @desc Which protocol mode shall be tested? */ modulepar { IpSecProtocolMode PX_IP_SEC_PROTOCOL_MODE := e_transportMode } /* * @desc Which Algo mode shall be used for Encryption? */ modulepar { EncryptionAlgo PX_ENCRYPTION_ALGO := e_tripleDes_cbc } /* * @desc Which Algo mode shall be used for Integrity? */ modulepar { IntegrityAlgo PX_INTEGRITY_ALGO := e_hmac_sha1_96 } } // end module LibIpv6_ModuleParameters
NewModuleStructure/EtsiLibrary/LibIpv6/LibMobility/LibIpv6_Rfc3775Mipv6_ExtHdrFunctions.ttcn +57 −25 Original line number Diff line number Diff line Loading @@ -16,17 +16,46 @@ //LibIpv6 import from LibIpv6_CommonRfcs_TypesAndValues all ; import from LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues all; import from LibIpv6_Rfc3775Mipv6_ExtHdrTemplates all; //import from LibIpv6_Rfc3775Mipv6_ExtHdrTemplates all; import from LibIpv6_Interface all; import from LibIpv6_ExternalFunctions all; import from LibIpv6_CommonRfcs_Templates all; import from LibIpv6_CommonRfcs_TypesAndValues all; import from LibIpv6_ModuleParameters all; function f_initMipSecParams() runs on LibIpv6Node { vc_mipSec.cnSimuParams := { homeNonceIndex := f_createHomeNonceIndex(), homeNonce := f_createHomeNonce(), kcn := f_createKcn(), homeKeygenToken := c_64ZeroBits, careOfKeygenToken := c_64ZeroBits, receivedHomeInitCookie := c_64ZeroBits, kbm := c_20ZeroBytes } vc_mipSec.mnSimuParams := { receivedHomeNonceIndex := c_uInt16Zero, //homeNonce := f_createHomeNonce(), //kcn := f_createKcn(), receivedHomeKeygenToken := c_64ZeroBits, receivedCareOfKeygenToken := c_64ZeroBits, homeInitCookie := f_createInitCookie(), kbm := c_20ZeroBytes } vc_mipSec.haSimuParams := vc_mipSec.cnSimuParams; }//end function f_initMipSecParams /* * @desc This goes through the Mip header and calculates length, checksum * and other specific functions of the different messages * and other specific functions of the different messages. * This function is used when sending messages. * @param p_msg ExtensionHeaderList to be treated * @return execution status */ Loading @@ -39,35 +68,25 @@ var MipHeader v_mipHeader := valueof(p_mipHeader); var Ipv6Address v_homeAddress := c_16ZeroBytes ; if (ischosen(p_mipHeader.mipMessage.homeTestInit) and (PX_TEST_IPSEC == true)) { //if (ischosen(p_mipHeader.mipMessage.homeTestInit)) { //calc homeInitCookie p_mipHeader.mipMessage.homeTestInit.homeInitCookie := f_createInitCookie(); } else if (ischosen(p_mipHeader.mipMessage.homeTest) and (PX_TEST_IPSEC == true)) { //CN sends this message //calc homeNonceIndex TODO p_mipHeader.mipMessage.homeTest.homeNonceIndex := PX_HOME_NONCE_INDEX ; //calc homeInitCookie TODO p_mipHeader.mipMessage.homeTest.homeInitCookie := f_createInitCookie(); //calc homeKeygenToken TODO p_mipHeader.mipMessage.homeTest.homeKeygenToken := f_createHomeKeygenToken( f_createKcn(), p_dstAddr, //check that this is the mnHoa f_createHomeNonce()); } else if (ischosen(p_mipHeader.mipMessage.careOfTestInit) and (PX_TEST_IPSEC == true)) { //p_mipHeader.mipMessage.homeTestInit.homeInitCookie := f_createInitCookie(); //} //else if (ischosen(p_mipHeader.mipMessage.homeTest)) {//CNSimu sends this message //} //else if (ischosen(p_mipHeader.mipMessage.careOfTestInit) and (PX_TEST_IPSEC == true)) { //TODO } else if (ischosen(p_mipHeader.mipMessage.careOfTest) and (PX_TEST_IPSEC == true)) { //} //else if (ischosen(p_mipHeader.mipMessage.careOfTest) and (PX_TEST_IPSEC == true)) { //TODO } else if (ischosen(p_mipHeader.mipMessage.bindingUpdate) and (PX_TEST_IPSEC == true)) { //} if (ischosen(p_mipHeader.mipMessage.bindingUpdate)) { var UInt8 v_position := 0; if (f_isPresentBindingAuthorizationDataOption(p_mipHeader.mipMessage.bindingUpdate, v_position) == e_success) { var Oct20 v_bindingAuthenticator := fx_bindingAuthenticator( p_srcAddr,//careOfaddr p_dstAddr,//cnAddr p_ipv6Packet, vc_mipSecParams.kbm) ; vc_mipSec.mnSimuParams.kbm) ; p_mipHeader.mipMessage.bindingUpdate.mipOptions[v_position].mipBindingAuthorizationData := { mipOptType := 5, mipOptLen := lengthof(v_bindingAuthenticator), Loading @@ -75,9 +94,9 @@ } } } else if (ischosen(p_mipHeader.mipMessage.bindingAck) and (PX_TEST_IPSEC == true)) { // else if (ischosen(p_mipHeader.mipMessage.bindingAck) and (PX_TEST_IPSEC == true)) { //TODO } //} //calc mipHeaderLen p_mipHeader.headerLen := fx_mipHeaderLength(p_mipHeader); //set mipChecksum to zero Loading Loading @@ -120,6 +139,19 @@ return v_homeNonce; }//end f_createHomeNonce /* * @desc This generates a random Home Nonce Index * @return Init Cookie */ function f_createHomeNonceIndex() runs on LibIpv6Node return UInt16 { var Oct2 v_homeNonceIndex := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 2); return oct2int(v_homeNonceIndex); }//end f_createHomeNonceIndex /* * @desc This generates CN's secret key * @return Init Cookie Loading
NewModuleStructure/EtsiLibrary/LibIpv6/LibMobility/LibIpv6_Rfc3775Mipv6_ExtHdrTemplates.ttcn +9 −6 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ //LibIpv6 import from LibIpv6_CommonRfcs_TypesAndValues all ; import from LibIpv6_CommonRfcs_Templates all ; import from LibIpv6_Rfc3775Mipv6_ExtHdrFunctions all; import from LibIpv6_Rfc3775Mipv6_ExtHdrTypesAndValues all; import from LibIpv6_Rfc2460Root_TypesAndValues all; import from LibIpv6_Rfc3775Mipv6_TypesAndValues all; Loading Loading @@ -107,11 +108,13 @@ } } template MipMessage m_hot := { template MipMessage m_hot( UInt16 p_homeNonceIndex, Bit64 p_homeInitCookie, Bit64 p_homeKeygenToken) := { homeTest := { homeNonceIndex := c_uInt16Zero, homeInitCookie := c_64ZeroBits, homeKeygenToken := c_64ZeroBits, homeNonceIndex := p_homeNonceIndex,//c_uInt16Zero, homeInitCookie := p_homeInitCookie,//c_64ZeroBits, homeKeygenToken := p_homeKeygenToken, mipOptions := omit } } Loading @@ -125,10 +128,10 @@ } } template MipMessage m_hoti := { template MipMessage m_hoti(Bit64 p_homeInitCookie) := { homeTestInit := { reserved := c_uInt16Zero, homeInitCookie := c_64ZeroBits, homeInitCookie := p_homeInitCookie, mipOptions := omit } } Loading