Commit 5281a8e9 authored by mullers's avatar mullers
Browse files

KeyLen added to IkeSa and Sa

parent 967f5b36
Loading
Loading
Loading
Loading
+52 −97
Original line number Diff line number Diff line
@@ -435,10 +435,13 @@ group ipSecFns {
				spiResponder := PX_IKE_SPI,
				messageID := 0,
				ikeEncryptionAlgo := PX_IKE_ENCALGO,
			ikeEncryptionKey := PX_IKE_ENC_KEY,
				//ikeEncryptionKey := PX_IKE_ENC_KEY,
				ikeEncrKeyLen := omit,
				ikePseudoRandomFunction := PX_IKE_PSEUDORANDOM_FCT,
				prfKeyLen := omit,
				ikeIntegrityAlgo := PX_IKE_INTALGO,
			ikeIntegrityKey := PX_IKE_INT_KEY,
				//ikeIntegrityKey := PX_IKE_INT_KEY,
				ikeIntegrKeyLen := omit,
				diffieHellmanGroup := PX_IKE_DIFFIEHELLMAN_GROUP,
				diffieHellmanPrivKey := PX_IKE_DIFFIEHELLMAN_PRIVKEY,
				diffieHellmanSharedSecret := '00'O,
@@ -453,6 +456,11 @@ group ipSecFns {
				ikev2Header := omit,
				ikePayloadList := omit	
				}
			//smu 2007 todo
			//if(active) {
			//	prfKeyLen := f_getKeyLen	
			//	
			//}
		}
		
		// SAD-OUT
@@ -462,14 +470,17 @@ group ipSecFns {
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrKeyLen := omit,
			icvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			icvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			// Combined mode
			espCombinedModeAlgo := PX_COMBINED_MODE_ALGO,
			espCombinedModeKey := PX_COMBINED_MODE_KEY/*f_createSecretKey()*/,
@@ -478,6 +489,9 @@ group ipSecFns {
			extentedSequenceNumbers := e_extentedSequenceNumbersNo
		}

		// espIntegrityAlgo := PX_INTEGRITY_ALGO,
		//	espIntegrityKey := PX_INTEGRITY_KEY

		// SAD-IN
		vc_sad[c_saIn] := {
			spi := PX_SPI/*f_createSpi()*/,
@@ -485,14 +499,17 @@ group ipSecFns {
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrKeyLen := omit,
			icvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			icvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			// Combined mode
			espCombinedModeAlgo := PX_COMBINED_MODE_ALGO,
			espCombinedModeKey := PX_COMBINED_MODE_KEY/*f_createSecretKey()*/,
@@ -508,14 +525,17 @@ group ipSecFns {
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrKeyLen := omit,
			icvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			icvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			// Combined mode
			espCombinedModeAlgo := PX_COMBINED_MODE_ALGO,
			espCombinedModeKey := PX_COMBINED_MODE_KEY/*f_createSecretKey()*/,
@@ -531,14 +551,17 @@ group ipSecFns {
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrKeyLen := omit,
			icvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			icvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			// Combined mode
			espCombinedModeAlgo := PX_COMBINED_MODE_ALGO,
			espCombinedModeKey := PX_COMBINED_MODE_KEY/*f_createSecretKey()*/,
@@ -554,14 +577,17 @@ group ipSecFns {
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrKeyLen := omit,
			icvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			icvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			// Combined mode
			espCombinedModeAlgo := PX_COMBINED_MODE_ALGO,
			espCombinedModeKey := PX_COMBINED_MODE_KEY/*f_createSecretKey()*/,
@@ -577,14 +603,17 @@ group ipSecFns {
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrKeyLen := omit,
			icvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			icvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			// Combined mode
			espCombinedModeAlgo := PX_COMBINED_MODE_ALGO,
			espCombinedModeKey := PX_COMBINED_MODE_KEY/*f_createSecretKey()*/,
@@ -597,78 +626,6 @@ group ipSecFns {
		
	}//end f_init_ipSecParams

	group fillIkeSa
	{
	
	/*
	 * @desc  Fills IkeSa with PIXIT values
	*/
	function f_initIkeSa()
	runs on LibIpv6Node
	{
		vc_ikeSad[0].spiInitiator := PX_IKE_SPI; 
		vc_ikeSad[0].spiResponder := PX_IKE_SPI;
		vc_ikeSad[0].messageID := 0; 
		vc_ikeSad[0].ikeEncryptionAlgo := PX_IKE_ENCALGO; 
		vc_ikeSad[0].ikeEncryptionKey := PX_IKE_ENC_KEY;
		vc_ikeSad[0].ikePseudoRandomFunction := PX_IKE_PSEUDORANDOM_FCT; 
		vc_ikeSad[0].ikeIntegrityAlgo := PX_IKE_INTALGO; 
		vc_ikeSad[0].ikeIntegrityKey := PX_IKE_INT_KEY;
		vc_ikeSad[0].diffieHellmanGroup := PX_IKE_DIFFIEHELLMAN_GROUP; 
		vc_ikeSad[0].diffieHellmanPrivKey := PX_IKE_DIFFIEHELLMAN_PRIVKEY;
		vc_ikeSad[0].nI := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 16);
		vc_ikeSad[0].nR := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 16);
		vc_ikeSad[0].proposalNr := 1;//smu not needed anymore delete
	} // end f_fillIkeSaFromPIXIT SaProposal


	/*
	 * @desc  Fills IkeSa with PIXIT values
	*/
	function f_fillIkeSaFromPixit()
	runs on LibIpv6Node
	{
		vc_ikeSad[0].spiInitiator := PX_IKE_SPI; 
		// vc_ikeSad[0].spiResponder := ; fill from IKE Header
		vc_ikeSad[0].messageID := 0; 
		vc_ikeSad[0].ikeEncryptionAlgo := PX_IKE_ENCALGO; 
		// p_ikeSa.ikeEncryptionKey := ; ToDo!!!
		vc_ikeSad[0].ikePseudoRandomFunction := PX_IKE_PSEUDORANDOM_FCT; 
		vc_ikeSad[0].ikeIntegrityAlgo := PX_IKE_INTALGO; 
		// p_ikeSa.ikeIntegrityKey := ; ToDo!!!
		vc_ikeSad[0].diffieHellmanGroup := PX_IKE_DIFFIEHELLMAN_GROUP; 
		vc_ikeSad[0].diffieHellmanPrivKey := PX_IKE_DIFFIEHELLMAN_PRIVKEY; 
	} // end f_fillIkeSaFromPIXIT SaProposal



	/*
	 * @desc  Fills IkeSa with data from one Security Association proposal
 	 * @param p_SaProposal received SA proposal
	*/
	function f_fillIkeSaFromSaProposal(in SaProposal p_SaProposal)
	runs on LibIpv6Node
	return FncRetCode
	{
		var FncRetCode v_ret;
		// vc_ikeSad[0].spiInitiator := ; fill from IKE Header
		vc_ikeSad[0].spiResponder := PX_IKE_SPI;
		vc_ikeSad[0].messageID := 0; 
		vc_ikeSad[0].ikeEncryptionAlgo := PX_IKE_ENCALGO; 
		// p_ikeSa.ikeEncryptionKey := ; ToDo!!!
		vc_ikeSad[0].ikePseudoRandomFunction := PX_IKE_PSEUDORANDOM_FCT; 
		vc_ikeSad[0].ikeIntegrityAlgo := PX_IKE_INTALGO; 
		// p_ikeSa.ikeIntegrityKey := ; ToDo!!!
		vc_ikeSad[0].diffieHellmanGroup := PX_IKE_DIFFIEHELLMAN_GROUP; 
		vc_ikeSad[0].diffieHellmanPrivKey := PX_IKE_DIFFIEHELLMAN_PRIVKEY; 

		v_ret := e_success ;
		return v_ret;
	} // end f_fillIkeSaFromSaProposal

} // end group fillIkeSa


	function f_getLenSaProposalList(in template SaProposalList p_saProposalList)
	return UInt8 {
		var UInt8 v_len := 0;
@@ -729,8 +686,6 @@ group ipSecFns {
		
	}
	
	
	
}//end ipSecFns

} // end module LibIpv6_CommonRfcs_Functions
+9 −3
Original line number Diff line number Diff line
@@ -13,8 +13,10 @@
module LibIpv6_Interface_TypesAndValues {

	//LibCommon
	import from LibCommon_Sync all;
	import from LibCommon_Time all ;
	import from LibCommon_DataStrings all;
	import from LibCommon_AbstractData all;
	import from LibCommon_BasicTypesAndValues all;
	//LibIpv6
	import from LibIpv6_Rfc2463Icmpv6_TypesAndValues {type all};
@@ -44,6 +46,10 @@ module LibIpv6_Interface_TypesAndValues {
			var Sad vc_sad;
			var IkeSad vc_ikeSad;
			timer tc_loop := PX_LOOP ;
			var StringStack v_stateStack:= c_initStringStack;
			port SyncPort syncSendPort;
			port SyncPort syncPort;
			timer tc_sync := PX_TSYNC_TIME_LIMIT;
		}

		type port Ipv6Port message {
+3 −3
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ module LibIpv6_ModuleParameters {
	*/
	modulepar {EncryptionAlgo PX_IKE_ENCALGO := e_encr_desIv64}

	modulepar {octetstring PX_IKE_ENC_KEY := '010203040506'O}
//	modulepar {octetstring PX_IKE_ENC_KEY := '010203040506'O}

	/*
	 * @desc Which pseudo random function shall be used for testing IKE?
@@ -105,7 +105,7 @@ module LibIpv6_ModuleParameters {
	*/
	modulepar {IntegrityAlgo PX_IKE_INTALGO := e_auth_hmacMd5_96}

	modulepar {octetstring PX_IKE_INT_KEY := '010203040506'O}
//	modulepar {octetstring PX_IKE_INT_KEY := '010203040506'O}

	/*
	 * @desc Which Diffie-Hellman group shall be used for testing IKE?
@@ -126,7 +126,7 @@ module LibIpv6_ModuleParameters {
	/*
	 * @desc Which pre-shared secret shall be used for calculating the AUTH value?
    */
	modulepar {octetstring PX_SHARED_SECRET := '0123456789ABCDEF'O}
	modulepar {octetstring PX_PRE_SHARED_SECRET := '0123456789ABCDEF'O}

	/*
	 * @desc Which identification data (type = ID_IPV6_ADDR) shall be used for sending in Identification payloads?
+175 −132

File changed.

Preview size limit exceeded, changes collapsed.

+10 −9
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@
	group ikeSaInitResponseTemplates {


		template IkeSaInitResponse mw_ikeSaInitRes (	template Ipv6Address p_src,
		template IkeSaInitResponse mw_ikeSaInitRsp (	template Ipv6Address p_src,
												    	template Ipv6Address p_dst,
														UInt16 p_udpSourcePort,
														UInt16 p_udpDestPort,
@@ -135,11 +135,12 @@
			}}
		}

		template IkeSaInitResponse m_ikeSaInitRes (	template Ipv6Address p_src,
		template IkeSaInitResponse m_ikeSaInitRsp (	template Ipv6Address p_src,
													template Ipv6Address p_dst,
													UInt16 p_udpsourcePort,
													UInt16 p_udpdestPort,
													Oct8 p_initiatorSpi,
													Oct8 p_responderSpi,
													UInt8 p_nextPayload,
													UInt32 p_messageID,
													template IkePayloadList p_ikepayloads) := {
@@ -154,7 +155,7 @@
				// IKEv2 Header
				ikev2Header := {
					initiatorSpi  := p_initiatorSpi,
					responderSpi  := c_8ZeroBytes,
					responderSpi  := p_responderSpi,
					nextPayload   := p_nextPayload,
					majorVersion  := c_ikeMajorVersion2,
					minorVersion  := c_ikeMinorVersion0,
@@ -257,7 +258,7 @@

	group ikeAuthResponseTemplates {

		template IkeAuthResponse mw_ikeAuthRes (template Ipv6Address p_src,
		template IkeAuthResponse mw_ikeAuthRsp (template Ipv6Address p_src,
												template Ipv6Address p_dst,
												UInt16 p_udpsourcePort,
												UInt16 p_udpdestPort,
@@ -300,7 +301,7 @@
		template IkePayloadList mw_ikeSaInitReqPLL :=
		superset ( mw_securityAssociationIkePL, mw_noncePL, mw_keyExchangePL);

		template IkePayloadList mw_ikeSaInitResPLL :=
		template IkePayloadList mw_ikeSaInitRspPLL :=
		superset ( mw_securityAssociationIkePL, mw_noncePL, mw_keyExchangePL);

		template IkePayloadList mw_encryptedPLL(template IkePayloadList p_ikepayloads) :=
@@ -309,7 +310,7 @@
		template IkePayloadList mw_ikeAuthReqPLL :=
		superset ( mw_securityAssociationPL, mw_identificationPL, mw_trafficSelectorPL, mw_trafficSelectorPL, mw_authPL);

		template IkePayloadList mw_ikeAuthResPLL :=
		template IkePayloadList mw_ikeAuthRspPLL :=
		superset ( mw_securityAssociationPL, mw_identificationPL, mw_trafficSelectorPL, mw_trafficSelectorPL, mw_authPL);

		}//end group payLoadListTemplates
Loading