Commit b5e9ad7b authored by berge's avatar berge
Browse files

Misc changes from validation

parent b2ae35bb
Loading
Loading
Loading
Loading
+133 −75
Original line number Original line Diff line number Diff line
@@ -781,6 +781,10 @@ group ipSecFns {
		var UInt8 v_espEncrBlockSize := 0;
		var UInt8 v_espEncrBlockSize := 0;
		var UInt8 v_espIntegrBlockSize := 0;
		var UInt8 v_espIntegrBlockSize := 0;


		v_espIv := f_getIv(PX_ENCRYPTION_ALGO);
		v_espEncrBlockSize := f_getEncrBlockSize(PX_ENCRYPTION_ALGO);
		v_espIntegrBlockSize := f_getIntegrBlockSize(PX_INTEGRITY_ALGO);
		
		if (p_ipSecControl == e_manualSecParamsSetup ) {	
		if (p_ipSecControl == e_manualSecParamsSetup ) {	
	
	
			//ESP - AH
			//ESP - AH
@@ -794,6 +798,61 @@ group ipSecFns {
				log("**** f_init_ipSecParams: ERROR: Incorrect key length for the selected integrity algorithm ****");
				log("**** f_init_ipSecParams: ERROR: Incorrect key length for the selected integrity algorithm ****");
				return e_error;
				return e_error;
			}
			}

			//manual settings for c_saIni and c_saRes
			vc_sad[c_saIni] := {
				spi := PX_SA_OUT_SPI, 
				seqNr := c_uInt32Zero,
				// AH Integrity
				ahIntegrityAlgo := PX_INTEGRITY_ALGO,
				ahIntegrityKey := PX_INTEGRITY_KEY,
				ahIntegrKeyLen := omit,
				ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
				// ESP encryption
				espEncryptionAlgo := PX_ENCRYPTION_ALGO,
				espEncryptionKey := PX_ESP_ENCR_KEY,
				espEncrKeyLen := omit,
				espIv := v_espIv,
				espEncrBlockSize := v_espEncrBlockSize,
				// ESP integrity
				espIntegrityAlgo := PX_INTEGRITY_ALGO,
				espIntegrityKey := PX_INTEGRITY_KEY,
				espIntegrKeyLen := omit,
				espIntegrBlockSize := v_espIntegrBlockSize,
				espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				// Protocol mode
				ipSecProtocolMode := p_ipSecProtocolMode,
				extentedSequenceNumbers := e_extentedSequenceNumbersNo,
				trafficSelector:= omit
			}

			vc_sad[c_saRes] := {
				spi := PX_SA_IN_SPI, 
				seqNr := c_uInt32Zero,
				// AH Integrity
				ahIntegrityAlgo := PX_INTEGRITY_ALGO,
				ahIntegrityKey := PX_INTEGRITY_KEY,
				ahIntegrKeyLen := omit,
				ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
				// ESP encryption
				espEncryptionAlgo := PX_ENCRYPTION_ALGO,
				espEncryptionKey := PX_ESP_ENCR_KEY,
				espEncrKeyLen := omit,
				espIv := v_espIv,
				espEncrBlockSize := v_espEncrBlockSize,
				// ESP integrity
				espIntegrityAlgo := PX_INTEGRITY_ALGO,
				espIntegrityKey := PX_INTEGRITY_KEY,
				espIntegrKeyLen := omit,
				espIntegrBlockSize := v_espIntegrBlockSize,
				espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				// Protocol mode
				ipSecProtocolMode := p_ipSecProtocolMode,
				extentedSequenceNumbers := e_extentedSequenceNumbersNo,
				trafficSelector:= omit
			}
		}
		}
		else {
		else {
			vc_ikeSad[0] := {
			vc_ikeSad[0] := {
@@ -824,31 +883,26 @@ group ipSecFns {
				ikev2Header := omit,
				ikev2Header := omit,
				ikePayloadList := omit	
				ikePayloadList := omit	
			}
			}
		}


		v_espIv := f_getIv(PX_ENCRYPTION_ALGO);
			// automatic settings for c_saIni and c_saRes
		v_espEncrBlockSize := f_getEncrBlockSize(PX_ENCRYPTION_ALGO);
		v_espIntegrBlockSize := f_getIntegrBlockSize(PX_INTEGRITY_ALGO);
		
		// SAD for ESP and AH Tests
			vc_sad[c_saIni] := {
			vc_sad[c_saIni] := {
				spi := f_createSpi(),
				spi := f_createSpi(),
				seqNr := c_uInt32Zero,
				seqNr := c_uInt32Zero,
				// AH Integrity
				// AH Integrity
				ahIntegrityAlgo := PX_INTEGRITY_ALGO,
				ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY,
				ahIntegrityKey := PX_INTEGRITY_KEY /*f_createSecretKey()*/,
				ahIntegrKeyLen := omit,
				ahIntegrKeyLen := omit,
				ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
				ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
				// ESP encryption
				// ESP encryption
				espEncryptionAlgo := PX_ENCRYPTION_ALGO,
				espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY,
				espEncryptionKey := PX_ESP_ENCR_KEY /*f_createSecretKey()*/,
				espEncrKeyLen := omit,
				espEncrKeyLen := omit,
				espIv := v_espIv,
				espIv := v_espIv,
				espEncrBlockSize := v_espEncrBlockSize,
				espEncrBlockSize := v_espEncrBlockSize,
				// ESP integrity
				// ESP integrity
				espIntegrityAlgo := PX_INTEGRITY_ALGO,
				espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY,
				espIntegrityKey := PX_INTEGRITY_KEY /*f_createSecretKey()*/, 
				espIntegrKeyLen := omit,
				espIntegrKeyLen := omit,
				espIntegrBlockSize := v_espIntegrBlockSize,
				espIntegrBlockSize := v_espIntegrBlockSize,
				espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
@@ -863,19 +917,19 @@ group ipSecFns {
				seqNr := c_uInt32Zero,
				seqNr := c_uInt32Zero,
				// AH Integrity
				// AH Integrity
				ahIntegrityAlgo := PX_INTEGRITY_ALGO,
				ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY,
				ahIntegrityKey := PX_INTEGRITY_KEY /*f_createSecretKey()*/,
				ahIntegrKeyLen := omit,
				ahIntegrKeyLen := omit,
				ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
				ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
				// ESP encryption
				// ESP encryption
				espEncryptionAlgo := PX_ENCRYPTION_ALGO,
				espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY,
				espEncryptionKey := PX_ESP_ENCR_KEY /*f_createSecretKey()*/,
				espEncrKeyLen := omit,
				espEncrKeyLen := omit,
				espIv := v_espIv,
				espIv := v_espIv,
				espEncrBlockSize := v_espEncrBlockSize,
				espEncrBlockSize := v_espEncrBlockSize,
				// ESP integrity
				// ESP integrity
				espIntegrityAlgo := PX_INTEGRITY_ALGO,
				espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY,
				espIntegrityKey := PX_INTEGRITY_KEY /*f_createSecretKey()*/,
				espIntegrKeyLen := omit,
				espIntegrKeyLen := omit,
				espIntegrBlockSize := v_espIntegrBlockSize,
				espIntegrBlockSize := v_espIntegrBlockSize,
				espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
				espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
@@ -885,25 +939,27 @@ group ipSecFns {
				trafficSelector:= omit
				trafficSelector:= omit
			}
			}


		// SAD-OUT
		}

		// SA used for Return routability procedure in mobility (Manual establishment only)
		vc_sad[c_saRrpOut] := {
		vc_sad[c_saRrpOut] := {
			spi := c_saRrpOut/*f_createSpi()*/,
			spi := PX_SA_RRP_OUT_SPI,
			seqNr := c_uInt32Zero,
			seqNr := c_uInt32Zero,
			// AH Integrity
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrityKey := PX_INTEGRITY_KEY,
			ahIntegrKeyLen := omit,
			ahIntegrKeyLen := omit,
			ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncryptionKey := PX_ESP_ENCR_KEY,
			espEncrKeyLen := omit,
			espEncrKeyLen := omit,
			espIv := v_espIv,
			espIv := v_espIv,
			espEncrBlockSize := v_espEncrBlockSize,
			espEncrBlockSize := v_espEncrBlockSize,
			// ESP integrity
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrityKey := PX_INTEGRITY_KEY,
			espIntegrKeyLen := omit,
			espIntegrKeyLen := omit,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
@@ -913,25 +969,25 @@ group ipSecFns {
			trafficSelector:= omit
			trafficSelector:= omit
		}
		}


		// SAD-IN
		// SA used for Return routability procedure in mobility (Manual establishment only)
		vc_sad[c_saRrpIn] := {
		vc_sad[c_saRrpIn] := {
			spi := c_saRrpIn/*f_createSpi()*/,
			spi := PX_SA_RRP_IN_SPI,
			seqNr := c_uInt32Zero,
			seqNr := c_uInt32Zero,
			// AH Integrity
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrityKey := PX_INTEGRITY_KEY,
			ahIntegrKeyLen := omit,
			ahIntegrKeyLen := omit,
			ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncryptionKey := PX_ESP_ENCR_KEY,
			espEncrKeyLen := omit,
			espEncrKeyLen := omit,
			espIv := v_espIv,
			espIv := v_espIv,
			espEncrBlockSize := v_espEncrBlockSize,
			espEncrBlockSize := v_espEncrBlockSize,
			// ESP integrity
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrityKey := PX_INTEGRITY_KEY,
			espIntegrKeyLen := omit,
			espIntegrKeyLen := omit,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
@@ -941,25 +997,25 @@ group ipSecFns {
			trafficSelector:= omit
			trafficSelector:= omit
		}
		}
	
	
		// SAD-OUT
		// SA used for Cn(=TS)<->Mn(=IUT) communication in mobility (Manual establishment only)
		vc_sad[c_saCnOut] := {
		vc_sad[c_saCnOut] := {
			spi := c_saCnOut/*f_createSpi()*/,
			spi := PX_SA_CNMN_OUT_SPI,
			seqNr := c_uInt32Zero,
			seqNr := c_uInt32Zero,
			// AH Integrity
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrityKey := PX_INTEGRITY_KEY,
			ahIntegrKeyLen := omit,
			ahIntegrKeyLen := omit,
			ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncryptionKey := PX_ESP_ENCR_KEY,
			espEncrKeyLen := omit,
			espEncrKeyLen := omit,
			espIv := v_espIv,
			espIv := v_espIv,
			espEncrBlockSize := v_espEncrBlockSize,
			espEncrBlockSize := v_espEncrBlockSize,
			// ESP integrity
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrityKey := PX_INTEGRITY_KEY,
			espIntegrKeyLen := omit,
			espIntegrKeyLen := omit,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
@@ -969,25 +1025,25 @@ group ipSecFns {
			trafficSelector:= omit
			trafficSelector:= omit
		}
		}


		// SAD-IN
		// SA used for Cn(=TS)<->Mn(=IUT) communication in mobility (Manual establishment only)
		vc_sad[c_saCnIn] := {
		vc_sad[c_saCnIn] := {
			spi := c_saCnIn/*f_createSpi()*/,
			spi := PX_SA_CNMN_IN_SPI,
			seqNr := c_uInt32Zero,
			seqNr := c_uInt32Zero,
			// AH Integrity
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			ahIntegrityKey := PX_INTEGRITY_KEY,
			ahIntegrKeyLen := omit,
			ahIntegrKeyLen := omit,
			ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			ahIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			ahIcvPadLen := f_getIcvPadLen(PX_INTEGRITY_ALGO),
			// ESP encryption
			// ESP encryption
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionAlgo := PX_ENCRYPTION_ALGO,
			espEncryptionKey := PX_ESP_ENCR_KEY/*f_createSecretKey()*/,
			espEncryptionKey := PX_ESP_ENCR_KEY,
			espEncrKeyLen := omit,
			espEncrKeyLen := omit,
			espIv := v_espIv,
			espIv := v_espIv,
			espEncrBlockSize := v_espEncrBlockSize,
			espEncrBlockSize := v_espEncrBlockSize,
			// ESP integrity
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrityKey := PX_INTEGRITY_KEY,
			espIntegrKeyLen := omit,
			espIntegrKeyLen := omit,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
@@ -997,6 +1053,8 @@ group ipSecFns {
			trafficSelector:= omit
			trafficSelector:= omit
		}
		}


		v_ret := fx_setSecurityParameters(vc_sad);

		return v_ret;
		return v_ret;
		
		
	}//end f_init_ipSecParams
	}//end f_init_ipSecParams
+43 −7
Original line number Original line Diff line number Diff line
@@ -26,10 +26,11 @@ module LibIpv6_ModuleParameters language "TTCN-3:2005" {
	modulepar float PX_T_BUILD_GLA := 15.0;
	modulepar float PX_T_BUILD_GLA := 15.0;


group security {
group security {

	/*
	/*
	 * @desc Shall IPSEC be tested?
	 * @desc Are security parameters configured manually or is IKE used to negotiate security parameters?
	*/
	*/
	modulepar IpSecSwitch PX_USE_IPSEC_FOR_MIP  := e_securityOff;
	modulepar IpSecControl PX_IPSEC_CONTROL := e_useIKEforSecParamsSetup;


	/*
	/*
	 * @desc Which protocol mode shall be used in vc_sad[c_saRes]?
	 * @desc Which protocol mode shall be used in vc_sad[c_saRes]?
@@ -56,6 +57,46 @@ group security {
	*/
	*/
	modulepar octetstring PX_ESP_ENCR_KEY := 'A1A2A3A4'O;
	modulepar octetstring PX_ESP_ENCR_KEY := 'A1A2A3A4'O;


	/*
	 * @desc Generic outbound SA SPI number when manually established
	 */ 
	modulepar UInt32 PX_SA_OUT_SPI := 0;

	/*
	 * @desc Generic inbound SA SPI number when manually established
	 */ 
	modulepar UInt32 PX_SA_IN_SPI := 1;
		
	group mipSecurity {

		/*
		 * @desc Shall IPSEC be tested?
		*/
		modulepar IpSecSwitch PX_USE_IPSEC_FOR_MIP  := e_securityOff;
		
		/*
		 * @desc Outbound SA used for Return routability procedure in mobility (Manual establishment only)
		*/ 
		modulepar UInt32 PX_SA_RRP_OUT_SPI := 2;

		/*
		 * @desc Inbound SA used for Return routability procedure in mobility (Manual establishment only)
		*/ 
		modulepar UInt32 PX_SA_RRP_IN_SPI := 3;
		
		/*
		 * @desc Outbound SA used for Cn(=TS)<->Mn(=IUT) communication in mobility (Manual establishment only)
		*/
		modulepar UInt32 PX_SA_CNMN_OUT_SPI := 4;
		
		/*
		 * @desc Inbound SA used for Cn(=TS)<->Mn(=IUT) communication in mobility (Manual establishment only)
		*/ 
		modulepar UInt32 PX_SA_CNMN_IN_SPI := 5;
		
		// PX_SA_MNCN_OUT_SPI PX_SA_RRP_IN_SPI
	}

} // end group security
} // end group security


group ikeSecurity
group ikeSecurity
@@ -90,11 +131,6 @@ group ikeSecurity
	*/
	*/
	modulepar octetstring PX_IKE_DIFFIEHELLMAN_PRIVKEY := '0123456789ABCDEF'O;
	modulepar octetstring PX_IKE_DIFFIEHELLMAN_PRIVKEY := '0123456789ABCDEF'O;


	/*
	 * @desc Are security parameters configured manually or is IKE used to negotiate security parameters?
	*/
	modulepar IpSecControl PX_IPSEC_CONTROL := e_useIKEforSecParamsSetup;

	/*
	/*
	 * @desc Which pre-shared secret shall be used for calculating the AUTH value?
	 * @desc Which pre-shared secret shall be used for calculating the AUTH value?
    */
    */