Commit 908a733c authored by mullers's avatar mullers
Browse files

IkeIntegrityAlgo merged to IntegrityAlgo

IkeEncryptionAlgo merged to EncryptionAlgo
parent 56313e32
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -292,13 +292,13 @@ group ipSecFns {
	function f_getIcvLen(IntegrityAlgo p_integrityAlgo)
	runs on LibIpv6Node
	return UInt8 {
		if(p_integrityAlgo == e_sha1) {
		if(p_integrityAlgo == e_auth_sha1/*e_sha1*/) {
			return 20;
		}
		else if (p_integrityAlgo == e_hmac_sha1_64){
		else if (p_integrityAlgo == e_auth_hmacSha1_64/*e_hmac_sha1_64*/){
			return 8;
		}
		else if(p_integrityAlgo == e_null) {
		else if(p_integrityAlgo == e_auth_null/*e_null*/) {
			return 0;	
		}
		
@@ -309,13 +309,13 @@ group ipSecFns {
	function f_getIcvPadLen(IntegrityAlgo p_integrityAlgo)
	runs on LibIpv6Node
	return UInt8 {
		if(p_integrityAlgo == e_sha1) {
		if(p_integrityAlgo == e_auth_sha1/*e_sha1*/) {
			return 0;
		}
		else if (p_integrityAlgo == e_hmac_sha1_64){
		else if (p_integrityAlgo == e_auth_hmacSha1_64/*e_hmac_sha1_64*/){
			return 4;
		}
		else if(p_integrityAlgo == e_null) {
		else if(p_integrityAlgo == e_auth_null/*e_null*/) {
			//ICV is omit, but padding is needed
			return 4;	
		}
@@ -327,19 +327,19 @@ group ipSecFns {
	function f_checkIntegrityKeyLen(IntegrityAlgo p_integrityAlgo, UInt8 p_keyLen)
	runs on LibIpv6Node
	return boolean {
		if((p_integrityAlgo == e_sha1) and (p_keyLen != 20)) {
		if((p_integrityAlgo == e_auth_sha1/*e_sha1*/) and (p_keyLen != 20)) {
			return false;
		}
		else if ((p_integrityAlgo == e_sha1_96) and (p_keyLen != 20)){
		else if ((p_integrityAlgo == e_auth_sha1_96/*e_sha1_96*/) and (p_keyLen != 20)){
			return false;
		}
		else if ((p_integrityAlgo == e_hmac_sha1_64) and (p_keyLen != 20)){
		else if ((p_integrityAlgo == e_auth_hmacSha1_64/*e_hmac_sha1_64*/) and (p_keyLen != 20)){
			return false;
		}
		else if ((p_integrityAlgo == e_hmac_sha1_96) and (p_keyLen != 20)){
		else if ((p_integrityAlgo == e_auth_hmacSha1_96/*e_hmac_sha1_96*/) and (p_keyLen != 20)){
			return false;
		}
		else if((p_integrityAlgo == e_hmac_md5_96) and (p_keyLen != 16)) {
		else if((p_integrityAlgo == e_auth_hmacMd5_96/*e_hmac_md5_96*/) and (p_keyLen != 16)) {
			return false;	
		}
	
@@ -350,16 +350,16 @@ group ipSecFns {
	function f_getEncryptionIvLen(EncryptionAlgo p_encryptionAlgo)
	runs on LibIpv6Node
	return UInt8 {
		if(p_encryptionAlgo == e_tripleDes_cbc) {
		if(p_encryptionAlgo == e_encr_3Des/*e_tripleDes_cbc*/) {
			return 8;
		}
		else if (p_encryptionAlgo == e_aes_cbc){
		else if (p_encryptionAlgo == e_encr_aesCbc/*e_aes_cbc*/){
			return 16;
		}
		else if(p_encryptionAlgo == e_aes_ctr) {
		else if(p_encryptionAlgo == e_encr_aesCtr/*e_aes_ctr*/) {
			return 8;	
		}
		else if(p_encryptionAlgo == e_des_cbc) {
		else if(p_encryptionAlgo == e_encr_des/*e_des_cbc*/) {
			return 8;	
		}
		return 0;
@@ -369,17 +369,17 @@ group ipSecFns {
	function f_checkEncryptionKeyLen( EncryptionAlgo p_encryptionAlgo, UInt8 p_keyLen)
	runs on LibIpv6Node
	return boolean {
		if((p_encryptionAlgo == e_tripleDes_cbc) and (p_keyLen != 24)){
		if((p_encryptionAlgo == e_encr_3Des/*e_tripleDes_cbc*/) and (p_keyLen != 24)){
			return false;
		}
		else if ((p_encryptionAlgo == e_aes_cbc) and ((p_keyLen < 0) or (p_keyLen > 32))){
		else if ((p_encryptionAlgo == e_encr_aesCbc/*e_aes_cbc*/) and ((p_keyLen < 0) or (p_keyLen > 32))){
			return false;
		}
		else if((p_encryptionAlgo == e_aes_ctr) 
		else if((p_encryptionAlgo == e_encr_aesCtr/*e_aes_ctr*/) 
				and (p_keyLen != 20) and (p_keyLen != 28) and (p_keyLen != 36)){
			return false;	
		}
		else if((p_encryptionAlgo == e_des_cbc) and (p_keyLen != 8)){
		else if((p_encryptionAlgo == e_encr_des/*e_des_cbc*/) and (p_keyLen != 8)){
			return false;	
		}
		return true;
+37 −33
Original line number Diff line number Diff line
@@ -76,6 +76,15 @@
	external function fx_mipHeaderLength( in  MobileHeader p_mobileHeader) 
	return UInt8;

	/* @desc 	This external function runs the MobileHeader through Codec and returns 
	 *			the octetstring representing the MobileHeader
	 *			
	 * @param 	p_mobileHeader Mip Header to be encoded to octetstring
	 * @return 	octetstring
	*/
	external function fx_mipHdrToOct(MobileHeader p_mobileHeader)
	return octetstring;

	/* @desc    Apply indicated Integrity algorithm to the message. Message is an octetstring.
	 *			If e_sha1_96 is chosen, then the key input shall be ignored.
	 *			
@@ -87,14 +96,6 @@
	external function fx_mac( IntegrityAlgo p_integrityAlgo, in octetstring p_key, in octetstring p_message) 
	return octetstring;

	/* @desc 	This external function runs the MobileHeader through Codec and returns 
	 *			the octetstring representing the MobileHeader
	 *			
	 * @param 	p_mobileHeader Mip Header to be encoded to octetstring
	 * @return 	octetstring
	*/
	external function fx_mipHdrToOct(MobileHeader p_mobileHeader)
	return octetstring;

	/* @desc 	This external function sets the test adapter with the relevant security parameters
	*			
@@ -120,15 +121,6 @@
	*/
	external function fx_authHeaderPayloadLength(in template AuthHeader p_authHeader) return UInt8;
	
	/* @desc    This external function calculates the length of an IKE message
	 *			based on the length of the payload(s), length of message is 
	 *          length of payload(s) plus length of IKE header which is 28
	 * @param   p_ikepayload payload portion of IKE message
	 * @return  length of IKE message in bytes
	*/
	external function fx_ikePayloadListLength( in template IkePayloadList p_ikepayload ) 
	return UInt32;
	
	/* @desc	This external function calculates the checksum for any
	 *         	UDP packet which contains an IKE message.
	 * @param  p_ikemessage IKE message 
@@ -149,7 +141,7 @@
	 * @param   p_first, p_second input values to pseudo random function
	 * @return  pseudo random value 
	*/
	external function fx_pseudoRandom( in IkePseudoRandomFunction p_prf,
	external function fx_pseudoRandom( in PseudoRandomFunction p_prf,
									   in octetstring p_first,
									   in octetstring p_second ) 
	return octetstring;
@@ -173,7 +165,7 @@
	 * @param   p_first, p_second input values to pseudo random function
	 * @return  pseudo random value 
	*/
	external function fx_pseudoRandomPlus( in IkePseudoRandomFunction p_prf,
	external function fx_pseudoRandomPlus( in PseudoRandomFunction p_prf,
									  	   in octetstring p_first,
									   	   in octetstring p_second ) 
	return SevenSecrets;
@@ -207,9 +199,6 @@
									     in octetstring p_receivedKey) 
	return octetstring;

	external function fx_calcAuth()
	return octetstring;

	/* @desc 	This external function runs the IkePayload through Codec and returns 
	 *			the octetstring representing the IkePayload
	 *			
@@ -240,16 +229,6 @@
	external function fx_saTransformToOct(SaTransform p_saTransform)
	return octetstring;

	/* @desc 	This external function runs the Ikev2Header through Codec and returns 
	 *			the octetstring representing the Ikev2Header
	 *			
	 * @param 	p_ikev2Header Ikev2Header to be encoded to octetstring
	 * @return 	octetstring
	*/
	//SMU 2007 if PS does not use, then delete
	external function fx_ikev2HeaderToOct(Ikev2Header p_ikev2Header)
	return octetstring;

	/* @desc 	This external function runs the Ipv6Payload through Codec and returns 
	 *			the octetstring representing the Ipv6Payload
	 *			
@@ -268,7 +247,32 @@
	external function fx_ikeEncPayloadLength( in template EncryptedPayload p_msg ) 
	return UInt16;

	/* @desc    This external function calculates the length of an IKE message
	 *			based on the length of the payload(s), length of message is 
	 *          length of payload(s) plus length of IKE header which is 28
	 * @param   p_ikepayload payload portion of IKE message
	 * @return  length of IKE message in bytes
	*/
//	external function fx_ikePayloadListLength( in template IkePayloadList p_ikepayload ) 
//	return UInt32;

	/* @desc 	This external function runs the IkePayloadList through Codec and returns 
	 *			the octetstring representing the IkePayloadList. If encrypted payload is part of the payload list,
	 *			then the ecncrypted octet string is returned.
	 *			
	 * @param 	p_ikev2Header Ikev2Header to be encoded to octetstring
	 * @return 	octetstring
	*/
	external function fx_ikePayloadListToOct(in IkePayloadList p_ikePayloadList)
	return octetstring;

	/* @desc 	This external function runs the Ikev2Header through Codec and returns 
	 *			the octetstring representing the Ikev2Header
	 *			
	 * @param 	p_ikev2Header Ikev2Header to be encoded to octetstring
	 * @return 	octetstring
	*/
	external function fx_ikev2HeaderToOct(Ikev2Header p_ikev2Header)
	return octetstring;

}// end module LibIpv6_ExternalFunctions
+10 −10
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ group rfc2460Root_Functions {
				else if (ischosen(v_activeIpv6Packet.extHdrList[i].espHeader)) {

					//set IV
					if (vc_sad[c_saOut].espEncryptionAlgo == e_null) {
					if (vc_sad[c_saOut].espEncryptionAlgo == e_encr_null) {
						v_activeIpv6Packet.extHdrList[i].espHeader.espPayload.iv := omit; 
					}
					else {
@@ -504,12 +504,12 @@ group rfc3775Mipv6_ExtHdrFunctions {

						// kbm is different if BU is sent for de-registration				
						if (p_mobileHeader.mobileMessage.bindingUpdateMsg.lifeTime != 0) {
							vc_mobileSec.mnSimuParams.kbm := fx_mac(		e_sha1, c_1ZeroByte,
							vc_mobileSec.mnSimuParams.kbm := fx_mac(		e_auth_sha1/*e_sha1*/, c_1ZeroByte,
																			bit2oct(vc_mobileSec.mnSimuParams.receivedHomeKeygenToken)
																			& bit2oct(vc_mobileSec.mnSimuParams.receivedCareOfKeygenToken));
						}
						else {
							vc_mobileSec.mnSimuParams.kbm := fx_mac(		e_sha1, c_1ZeroByte,
							vc_mobileSec.mnSimuParams.kbm := fx_mac(		e_auth_sha1/*e_sha1*/, c_1ZeroByte,
																			bit2oct(vc_mobileSec.mnSimuParams.receivedHomeKeygenToken));	
						}
											
@@ -531,7 +531,7 @@ group rfc3775Mipv6_ExtHdrFunctions {
				
						// compute authenticator
						p_mobileHeader.mobileMessage.bindingUpdateMsg.mobileOptions[v_position].mobileBindingAuthorizationData.authenticator 
								 := fx_mac(	e_hmac_sha1_96, vc_mobileSec.mnSimuParams.kbm,
								 := fx_mac(	e_auth_sha1_96/*e_hmac_sha1_96*/, vc_mobileSec.mnSimuParams.kbm,
																		p_srcAddr //careOfaddr 
																		& p_dstAddr //cnAddr
																		& fx_mipHdrToOct(p_mobileHeader) );
@@ -583,12 +583,12 @@ group rfc3775Mipv6_ExtHdrFunctions {

						// kbm is different if BA is sent for de-registration				
						if (p_mobileHeader.mobileMessage.bindingAckMsg.lifeTime != 0) {
							vc_mobileSec.cnSimuParams.kbm := fx_mac(		e_sha1, c_1ZeroByte,
							vc_mobileSec.cnSimuParams.kbm := fx_mac(		e_auth_sha1/*e_sha1*/, c_1ZeroByte,
																			bit2oct(vc_mobileSec.cnSimuParams.homeKeygenToken)
																			& bit2oct(vc_mobileSec.cnSimuParams.careOfKeygenToken));
						}
						else {
							vc_mobileSec.cnSimuParams.kbm := fx_mac(		e_sha1, c_1ZeroByte,
							vc_mobileSec.cnSimuParams.kbm := fx_mac(		e_auth_sha1/*e_sha1*/, c_1ZeroByte,
																			bit2oct(vc_mobileSec.cnSimuParams.homeKeygenToken));	
						}
											
@@ -610,7 +610,7 @@ group rfc3775Mipv6_ExtHdrFunctions {
				
						// compute authenticator
						p_mobileHeader.mobileMessage.bindingAckMsg.mobileOptions[v_position].mobileBindingAuthorizationData.authenticator 
								 := fx_mac(	e_hmac_sha1_96, vc_mobileSec.cnSimuParams.kbm,
								 := fx_mac(	e_auth_hmacSha1_96/*e_hmac_sha1_96*/, vc_mobileSec.cnSimuParams.kbm,
																		p_dstAddr //cnAddr			/!\ inverted /!\
																		& p_srcAddr //careOfaddr    /!\ for BA   /!\
																		& fx_mipHdrToOct(p_mobileHeader) );
@@ -653,12 +653,12 @@ group rfc3775Mipv6_ExtHdrFunctions {
			p_mobileHeader.checksum := c_2ZeroBytes;			
				
			if (p_mobileHeader.mobileMessage.bindingUpdateMsg.lifeTime != 0) {
				vc_mobileSec.cnSimuParams.kbm := fx_mac(		e_sha1, c_1ZeroByte,
				vc_mobileSec.cnSimuParams.kbm := fx_mac(		e_auth_sha1/*e_sha1*/, c_1ZeroByte,
																bit2oct(vc_mobileSec.cnSimuParams.homeKeygenToken)
																& bit2oct(vc_mobileSec.cnSimuParams.careOfKeygenToken));
			}
			else {
				vc_mobileSec.cnSimuParams.kbm := fx_mac(		e_sha1, c_1ZeroByte,
				vc_mobileSec.cnSimuParams.kbm := fx_mac(		e_auth_sha1/*e_sha1*/, c_1ZeroByte,
																bit2oct(vc_mobileSec.cnSimuParams.homeKeygenToken));	
			}
									
@@ -674,7 +674,7 @@ group rfc3775Mipv6_ExtHdrFunctions {
			//set Authenticator to omit in order to calc the authenticator
			p_mobileHeader.mobileMessage.bindingUpdateMsg.mobileOptions[v_position].mobileBindingAuthorizationData.authenticator := omit;
		
			v_computedAuthenticator := fx_mac(	e_hmac_sha1_96, vc_mobileSec.cnSimuParams.kbm,
			v_computedAuthenticator := fx_mac(	e_auth_hmacSha1_96/*e_hmac_sha1_96*/, vc_mobileSec.cnSimuParams.kbm,
												p_srcAddr //careOfaddr 
												& p_dstAddr //cnAddr
												& fx_mipHdrToOct(p_mobileHeader) );
+5 −5
Original line number Diff line number Diff line
@@ -44,12 +44,12 @@ module LibIpv6_ModuleParameters {
	/*
	 * @desc Which Algo mode shall be used for Encryption in vc_sad[c_saOut]?
	*/
	modulepar { EncryptionAlgo PX_ENCRYPTION_ALGO := e_tripleDes_cbc }
	modulepar { EncryptionAlgo PX_ENCRYPTION_ALGO := e_encr_3Des }

	/*
	 * @desc Which Algo mode shall be used for Integrity in vc_sad[c_saOut]?
	*/
	modulepar { IntegrityAlgo PX_INTEGRITY_ALGO := e_hmac_sha1_96 }
	modulepar { IntegrityAlgo PX_INTEGRITY_ALGO := e_auth_hmacSha1_96 }

	/*
	 * @desc Which Algo mode shall be used for Integrity in vc_sad[c_saOut]?
@@ -91,19 +91,19 @@ module LibIpv6_ModuleParameters {
	/*
	 * @desc Which encryption algorithm shall be used for testing IKE?
	*/
	modulepar {IkeEncryptionAlgo PX_IKE_ENCALGO := e_encrAlgoDesIv64}
	modulepar {EncryptionAlgo PX_IKE_ENCALGO := e_encr_desIv64}

	modulepar {octetstring PX_IKE_ENC_KEY := '010203040506'O}

	/*
	 * @desc Which pseudo random function shall be used for testing IKE?
	*/
	modulepar {IkePseudoRandomFunction PX_IKE_PSEUDORANDOM_FCT := e_prfHmacMd5} 
	modulepar {PseudoRandomFunction PX_IKE_PSEUDORANDOM_FCT := e_prfHmacMd5} 

	/*
	 * @desc Which integrity algorithm shall be used for testing IKE?
	*/
	modulepar {IkeIntegrityAlgo PX_IKE_INTALGO := e_integAlgoHmacMd596}
	modulepar {IntegrityAlgo PX_IKE_INTALGO := e_auth_hmacMd5_96}

	modulepar {octetstring PX_IKE_INT_KEY := '010203040506'O}

+4 −4
Original line number Diff line number Diff line
@@ -1197,7 +1197,7 @@ group mobileSecurityFns {
		}

		p_kbm := fx_mac(
					e_sha1_96,
					e_auth_sha1_96/*e_sha1_96*/,
					c_1ZeroByte,
					bit2oct(vc_mobileSec.mnSimuParams.receivedHomeKeygenToken)
					& bit2oct(vc_mobileSec.mnSimuParams.receivedCareOfKeygenToken) ) ;
@@ -1296,7 +1296,7 @@ group mobileSecurityFns {
		var Oct8 v_token := c_8ZeroBytes;
		var UInt8 i;

		v_mac := fx_mac(e_hmac_sha1_64, p_kcn, p_homeAddr & p_nonce & int2oct(0,1));
		v_mac := fx_mac(e_auth_hmacSha1_64/*e_hmac_sha1_64*/, p_kcn, p_homeAddr & p_nonce & int2oct(0,1));

		for ( i := 0; i < 8; i := i + 1 ) {
			v_token[i] := v_mac[i];
@@ -1323,7 +1323,7 @@ group mobileSecurityFns {

//		v_mac := fx_mac(e_sha1_96, p_kcn, p_careOfAddr & p_nonce & int2oct(1,1));
//Modified by PK
		v_mac := fx_mac(e_hmac_sha1_64, p_kcn, p_careOfAddr & p_nonce & int2oct(1,1));
		v_mac := fx_mac(e_auth_hmacSha1_64/*e_hmac_sha1_64*/, p_kcn, p_careOfAddr & p_nonce & int2oct(1,1));

		for ( i := 0; i < 8; i := i + 1 ) {
			v_token[i] := v_mac[i];
@@ -1346,7 +1346,7 @@ group mobileSecurityFns {
	return Oct8 {
		var octetstring v_key := c_8ZeroBytes;

		v_key := fx_mac(e_sha1_96, c_1ZeroByte, p_homeKeygenToken & p_careOfKeygenToken);
		v_key := fx_mac(e_auth_sha1_96/*e_sha1_96*/, c_1ZeroByte, p_homeKeygenToken & p_careOfKeygenToken);

		return v_key;
	}//end f_createBindingManagementKey
Loading