Commit 56405873 authored by mullers's avatar mullers
Browse files

f_sendIkeInit + f_sendIkeAuth

parent 68c30ccf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -239,4 +239,7 @@
	external function fx_setIkeSecurityParameters(in IkeSa p_ikeSa)
	return FncRetCode;

	external function fx_calcAuth()
	return octetstring;

}// end module LibIpv6_ExternalFunctions
+14 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
	import from LibIpv6_ExternalFunctions all;
	import from LibIpv6_CommonRfcs_Functions all;
	import from LibIpv6_CommonRfcs_TypesAndValues all;
	import from LibIpv6_Rfc4306Ikev2_TypesAndValues all;
	
group rfc2460Root_Functions {
	
@@ -196,6 +197,19 @@ group rfc2460Root_Functions {
		}
		v_ret := f_setAuthHeader (v_activeIpv6Packet);

		//smu added
		if (ispresent(v_activeIpv6Packet.ipv6Payload)) {
			if (ischosen(v_activeIpv6Packet.ipv6Payload.ikeMsg)) {
			
				//length  in octets of this user datagram  including the header and the data.
				v_activeIpv6Packet.ipv6Payload.ikeMsg.msgLength := 0;
				v_activeIpv6Packet.ipv6Payload.ikeMsg.checksum := 0;
			}
			
			
		}
		

		p_ipv6Packet := v_activeIpv6Packet;

		return v_ret;
+14 −10
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ module LibIpv6_Interface_Templates {
	import from LibIpv6_Rfc2463Icmpv6_TypesAndValues all;

	group rfc2460Root_Templates {

		template Ipv6Packet mw_ipPkt := ? ;

		group ipv6HeaderTemplates {
			/*
			 *	@param  p_nextHdr Next header identifier value to be used.
@@ -1317,6 +1320,16 @@ module LibIpv6_Interface_Templates {

	group rfc4303Esp_ExtHdrTemplates {

		/*
		* @desc This templates is the IPpacket to will be encrypted
		*/
		template EspIpDatagram m_espIpDatagram(
			template ExtensionHeaderList p_extHdrList,
			template Ipv6Payload p_ipv6Payload) := {
			extHdrList := p_extHdrList,
			ipv6Payload := p_ipv6Payload
		}

		template ExtensionHeader m_extHdr_espHeader(
			in UInt32 p_spi,
			in UInt32 p_seqNr,
@@ -1380,14 +1393,5 @@ module LibIpv6_Interface_Templates {


	} //end group rfc4303Esp_ExtHdrTemplates
	group cryptoTemplates {

		template EspIpDatagram m_espIpDatagram(
			template ExtensionHeaderList p_extHdrList,
			template Ipv6Payload p_ipv6Payload) := {
			extHdrList := p_extHdrList,
			ipv6Payload := p_ipv6Payload
		}

	} //end group cryptoTemplates
} // end module LibIpv6_Interface_Templates
+660 −854
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ module LibIpv6_Interface_TypesAndValues {

	}//end group libTestSystem

	group ipv6Packet {
	group ipv6PacketDefs {

		/*
		 * @desc PDU type derived from RFC2463 clause 4.1
@@ -120,8 +120,6 @@ module LibIpv6_Interface_TypesAndValues {
			variant (extHdrList) "fieldPresent=SupportFunctions.isExtensionHeader(valueOf(getTag('nextHeader')));";
		}
	
		//Alias
		//Imported from Rfc 2463
		type Ipv6Packet DestinationUnreachable
		with {
			variant "isPDU;use=com.testingtech.ttcn.tci.codec.helper.*;present=SupportFunctions.checkHeaderAndType(dec, 58, 1)";
@@ -393,7 +391,6 @@ module LibIpv6_Interface_TypesAndValues {
			variant "isPDU=LibIpv6_Interface_TypesAndValues;"
		}

		template Ipv6Packet mw_ipPkt := ? ;
		
		/*
		*  @desc This type is intended to be used to send "hand encoded"
@@ -402,9 +399,9 @@ module LibIpv6_Interface_TypesAndValues {
	    */
		type octetstring RawIpv6Packet;

	}//end group ipv6Packet
	}//end group ipv6PacketDefs

	group rfc2460Root_TypesAndValues {
	group ipv6HeaderDef {
	
			group ipv6Header {

@@ -444,7 +441,7 @@ module LibIpv6_Interface_TypesAndValues {

		} // end ipv6Header
	
	}//end group rfc2460Root_TypesAndValues
	}//end group ipv6HeaderDef

		group extensionHeaders {

@@ -1089,197 +1086,6 @@ module LibIpv6_Interface_TypesAndValues {

} // end extensionHeaders

	group cryptoTypes {

		/*
		 * @desc High level switch to select/deselect Security TCs/Fns
		*/
		type enumerated IpSecSwitch {
			e_securityOn(0),	
			e_securityOff(1)
		}
		with {
			variant "use=com.testingtech.ttcn.tci.LibIpv6_Interface_TypesAndValues.*;";
		}
		
		type enumerated EncryptionAlgo {
			e_null(0),
			e_tripleDes_cbc(1),//iv needed
			e_aes_cbc(2),//iv needed
			e_aes_ctr(3),//iv needed
			e_des_cbc(4)//iv needed
		}
		with {
			variant "use=com.testingtech.ttcn.tci.LibIpv6_Interface_TypesAndValues.*;";
		}

		type enumerated IntegrityAlgo {
			e_null(0),
			e_hmac_sha1_96(1),//RFC4305
			//not yet implemented e_aes_xcbc_mac_96(2),//RFC4305
			e_hmac_md5_96(3),//RFC4305
			e_sha1(4),//used in MIPv6 5.2.5 to calculate KBM
			e_sha1_96(5),//used in MIPv6 5.2.5 to calculate KBM
			e_hmac_sha1_64(6)//used in MIPv6 5.2.5 to calculate HomeKeyGenToken
		}
		with {
			variant "use=com.testingtech.ttcn.tci.LibIpv6_Interface_TypesAndValues.*;";
		}

		type enumerated CombinedModeAlgo {
			e_null(0)
		}
		with {
			variant "use=com.testingtech.ttcn.tci.LibIpv6_Interface_TypesAndValues.*;";
		}

		type enumerated IpSecProtocolMode {
			e_transportMode (0),
			e_tunnelMode (1)
		}
		with {
			variant "use=com.testingtech.ttcn.tci.LibIpv6_Interface_TypesAndValues.*;";
		}

		type enumerated IpSecProtocol{
			e_esp (0),
			e_ah (1)
		}
		with {
			variant "use=com.testingtech.ttcn.tci.LibIpv6_Interface_TypesAndValues.*;";
		}

		//Security Association Database
		type record length (1 .. c_maxNrDa) of Sa Sad;
		const UInt8 c_maxNrDa := 8;
		const UInt8 c_saOut := 0;
		const UInt8 c_saIn := 1;
		const UInt8 c_saRrpOut := 2;
		const UInt8 c_saRrpIn := 3; 
		const UInt8 c_saCnOut := 4;
		const UInt8 c_saCnIn := 5;
		

		//Security Association
		type record Sa {
			UInt32 spi,
			UInt32 seqNr,
			IntegrityAlgo ahIntegrityAlgo,
			octetstring	ahIntegrityKey,
			UInt8 icvLen,
			UInt icvPadLen,
			EncryptionAlgo espEncryptionAlgo,
			octetstring	espEncryptionKey,
			IntegrityAlgo espIntegrityAlgo,
			octetstring	espIntegrityKey,
			CombinedModeAlgo espCombinedModeAlgo,
			octetstring	espCombinedModeKey,
			IpSecProtocolMode ipSecProtocolMode		
		}
		with {
			//variant "use=com.testingtech.ttcn.tci.*;";
			variant "DTE TODO";
		}

		/* @desc Result of fx_encrypt
		*
		*/
		type record EncryptResult {
			octetstring		iv optional,	
			octetstring 	ciphertextData optional,
			octetstring 	tfcPadding optional
		}

	group mobileSecurity {

		type record MipSec {
			MnSimuParams mnSimuParams,
			CnSimuParams cnSimuParams
		}

		type record CnSimuParams {
			UInt16 		nonceIndex,
			NonceList 	nonceList,
			KcnList 	kcnList,
			Bit64 		receivedHomeInitCookie,
			Bit64 		receivedCareOfInitCookie,
			Bit64 		homeKeygenToken,
			Bit64 		careOfKeygenToken,
			Oct20 		kbm
		}

		type record MnSimuParams {
			Bit64 	homeInitCookie,
			Bit64 	careOfInitCookie,
			UInt16 	receivedHomeNonceIndex,
			Bit64 	receivedHomeKeygenToken,
			UInt16 	receivedCareOfNonceIndex,
			Bit64 	receivedCareOfKeygenToken,
			Oct20 kbm
		}

		type octetstring Nonce;
		type Oct20 Kcn;
		type record length (1 .. c_maxNrNonce) of Kcn KcnList;

		type record length (1 .. c_maxNrNonce) of Nonce NonceList;
		const UInt8 c_maxNrNonce := 8;

	} // end group mobileSecurity

	group ikeSecurity
	{
		type record SevenSecrets {
			octetstring sK_d,
			octetstring sK_ai,
			octetstring sK_ar,
			octetstring sK_ei,
			octetstring sK_er,
			octetstring sK_pi,
			octetstring sK_pr
		}
		with {
			variant "TODO";
		}

	//IKE Security Association Database
		type record length (1 .. c_maxNrIkeDa) of IkeSa IkeSad;
		const UInt8 c_maxNrIkeDa := 8;


		//IKE Security Association
		type record IkeSa {
			Oct8 spiInitiator,
			Oct8 spiResponder,
			UInt32 messageID,
			IkeEncryptionAlgo ikeEncryptionAlgo,
			octetstring	ikeEncryptionKey,
			IkePseudoRandomFunction ikePseudoRandomFunction,
			IkeIntegrityAlgo ikeIntegrityAlgo,
			octetstring	ikeIntegrityKey,
			DiffieHellmanGroup diffieHellmanGroup,
			octetstring diffieHellmanPrivKey,
			octetstring diffieHellmanSharedSecret,
			SevenSecrets sevenSecrets,
			octetstring nI,//new smu nonce
			octetstring nR,//new smu nonce
			UInt8 proposalNr,//new smu nonce
			UInt16 udpSourcePort, // new PS udp port
			UInt16 udpDestPort // new PS udp port
		}
		with {
			variant "TODO";
		}
	}//end group ikeSecurity
	}//end group cryptoTypes


	group integrityTypes {
	
		type record IntegrityResult {
			octetstring icv optional	
		}

	}//end group integrityTypes

} // end module LibIpv6_Interface_TypesAndValues
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ module LibIpv6_ModuleParameters {
	/*
	 * @desc Which SPI shall be used for testing IKE?
	*/
	modulepar {Oct8 PX_IKE_SPI := '0000000000000001'O}  
	modulepar {Oct8 PX_IKE_SPI := '0000000000000001'O}  //SMU this can be random, no pixit needed, delete later

	/*
	 * @desc Which encryption algorithm shall be used for testing IKE?
Loading