Commit 480c6430 authored by mullers's avatar mullers
Browse files

new parameters for f_PR_defaultRt_hut_ipSec

AH and ESP modules removed and TCs integrated to AtsSec modules
parent 21609aa1
Loading
Loading
Loading
Loading
+2 −234
Original line number Diff line number Diff line
@@ -678,239 +678,7 @@ group ipSecFns {
		return v_key;
	}//end f_createSecretKey

	function f_init_ipSecParams()
	runs on LibIpv6Node
	return FncRetCode {
		
		var FncRetCode v_ret := e_success;
		var octetstring v_espIv := '00'O;
		var UInt8 v_espEncrBlockSize := 0;
		var UInt8 v_espIntegrBlockSize := 0;

		if (PX_IPSEC_CONTROL == e_manualSecParamsSetup ) {	
	
			//ESP - AH
	
			if( f_checkEncryptionKeyLen(PX_ENCRYPTION_ALGO,lengthof(PX_ESP_ENCR_KEY)) != true) {
				log("**** f_init_ipSecParams: ERROR: Incorrect key length for the selected encryption algorithm " & int2str(lengthof(PX_ESP_ENCR_KEY)) & " ****");
				return e_error;
			}
	
			if( f_checkIntegrityKeyLen(PX_INTEGRITY_ALGO, lengthof(PX_INTEGRITY_KEY)) != true) {
				log("**** f_init_ipSecParams: ERROR: Incorrect key length for the selected integrity algorithm ****");
				return e_error;
			}
		}
		else {
			vc_ikeSad[0] := {
				spiInitiator := PX_IKE_SPI,
				spiResponder := PX_IKE_SPI,
				messageID := 0,
				ikeEncryptionAlgo := PX_IKE_ENCALGO,
				ikeEncrKeyLen := omit,
				ikeIv := omit,
				ikeEncrBlockSize := 0,
				ikePseudoRandomFunction := PX_IKE_PSEUDORANDOM_FCT,
				prfKeyLen := omit,
				ikeIntegrityAlgo := PX_IKE_INTALGO,
				ikeIntegrKeyLen := omit,
				ikeIntegrBlockSize := 0,
				ikeIcvLen :=  f_getIcvLen(PX_IKE_INTALGO),
				diffieHellmanGroup := PX_IKE_DIFFIEHELLMAN_GROUP,
				diffieHellmanPrivKey := PX_IKE_DIFFIEHELLMAN_PRIVKEY,
				diffieHellmanSharedSecret := '00'O,
				sevenSecrets := omit,
				nI := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 16),
				nR := int2oct(float2int(int2float(20000-5000)*rnd())+5000, 16),
				proposalNr := 1,//smu not needed anymore delete
				udpTnPort := PX_UDP_PORT_IUT_1,
				udpIutPort := PX_UDP_PORT_HS02,
				iDi := PX_IDENTIFICATION_DATA,
				iDr := PX_IDENTIFICATION_DATA,
				ikev2Header := omit,
				ikePayloadList := omit	
			}
		}

		v_espIv := f_getIv(PX_ENCRYPTION_ALGO);
		v_espEncrBlockSize := f_getEncrBlockSize(PX_ENCRYPTION_ALGO);
		v_espIntegrBlockSize := f_getIntegrBlockSize(PX_INTEGRITY_ALGO);

		//TODO v_ahIntegrBlockSize
		
		// SAD for ESP and AH Tests
		vc_sad[c_saIni] := {
			spi := PX_SPI/*f_createSpi()*/,
			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 := PX_IP_SEC_PROTOCOL_MODE,
			extentedSequenceNumbers := e_extentedSequenceNumbersNo,
			trafficSelector:= omit
		}

		vc_sad[c_saRes] := {
			spi := PX_SPI/*f_createSpi()*/,
			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 := PX_IP_SEC_PROTOCOL_MODE,
			extentedSequenceNumbers := e_extentedSequenceNumbersNo,
			trafficSelector:= omit
		}

		// SAD-OUT
		vc_sad[c_saRrpOut] := {
			spi := c_saRrpOut/*f_createSpi()*/,
			seqNr := c_uInt32Zero,
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			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/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			espIv := v_espIv,
			espEncrBlockSize := v_espEncrBlockSize,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			// Protocol mode
			ipSecProtocolMode := PX_IP_SEC_PROTOCOL_MODE,
			extentedSequenceNumbers := e_extentedSequenceNumbersNo,
			trafficSelector:= omit
		}

		// SAD-IN
		vc_sad[c_saRrpIn] := {
			spi := c_saRrpIn/*f_createSpi()*/,
			seqNr := c_uInt32Zero,
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			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/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			espIv := v_espIv,
			espEncrBlockSize := v_espEncrBlockSize,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			// Protocol mode
			ipSecProtocolMode := PX_IP_SEC_PROTOCOL_MODE,
			extentedSequenceNumbers := e_extentedSequenceNumbersNo,
			trafficSelector:= omit
		}
	
		// SAD-OUT
		vc_sad[c_saCnOut] := {
			spi := c_saCnOut/*f_createSpi()*/,
			seqNr := c_uInt32Zero,
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			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/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			espIv := v_espIv,
			espEncrBlockSize := v_espEncrBlockSize,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			// Protocol mode
			ipSecProtocolMode := PX_IP_SEC_PROTOCOL_MODE,
			extentedSequenceNumbers := e_extentedSequenceNumbersNo,
			trafficSelector:= omit
		}

		// SAD-IN
		vc_sad[c_saCnIn] := {
			spi := c_saCnIn/*f_createSpi()*/,
			seqNr := c_uInt32Zero,
			// AH Integrity
			ahIntegrityAlgo := PX_INTEGRITY_ALGO,
			ahIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			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/*f_createSecretKey()*/,
			espEncrKeyLen := omit,
			espIv := v_espIv,
			espEncrBlockSize := v_espEncrBlockSize,
			// ESP integrity
			espIntegrityAlgo := PX_INTEGRITY_ALGO,
			espIntegrityKey := PX_INTEGRITY_KEY/*f_createSecretKey()*/,
			espIntegrKeyLen := omit,
			espIntegrBlockSize := v_espIntegrBlockSize,
			espIcvLen := f_getIcvLen(PX_INTEGRITY_ALGO),
			// Protocol mode
			ipSecProtocolMode := PX_IP_SEC_PROTOCOL_MODE,
			extentedSequenceNumbers := e_extentedSequenceNumbersNo,
			trafficSelector:= omit
		}

		return v_ret;
		
	}//end f_init_ipSecParams

	//same as f_init_ipSecParams bu twith more paramsters that allow control of IKE process
	function f_init_ipSecParams_params(
	function f_init_ipSecParams (
		IpSecControl p_ipSecControl,
		IpSecProtocolMode p_ipSecProtocolMode
	)
@@ -1142,7 +910,7 @@ group ipSecFns {

		return v_ret;
		
	}//end f_init_ipSecParams_params
	}//end f_init_ipSecParams

	function f_getLenSaProposalList(in template SaProposalList p_saProposalList)
	return UInt8 {