Commit 8c3a724a authored by schmitting's avatar schmitting
Browse files

Notify added

parent 466b5b90
Loading
Loading
Loading
Loading
+111 −33
Original line number Diff line number Diff line
@@ -770,11 +770,16 @@ module LibIpv6_Rfc4306Ikev2_Functions {
						{ if (vc_ikeSad[0].ikeEncryptionAlgo != v_saTransform.transformId.encryptionAlgo)
						  	{ log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong encryption algorithm **** ");
							  v_ret := e_error;}
						  // check attribute key length, if present
					 	  if (ispresent(v_saTransform.saTransformAttributeList) or ispresent(vc_ikeSad[0].ikeEncrKeyLen))
						  // check attribute key length, if present in vc_ikeSad
					 	  if (ispresent(vc_ikeSad[0].ikeEncrKeyLen))
						  { if (ispresent(v_saTransform.saTransformAttributeList))
							{ if(vc_ikeSad[0].ikeEncrKeyLen != v_saTransform.saTransformAttributeList[0].keyLength.attributeValue)
						      { log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong encryption algorithm attribute length **** ");
							    v_ret := e_error;}}
							else
							{ log("**** f_waitForIkeSaInitRsp: ERROR: Expected encryption algorithm attribute length not found **** ");
							  v_ret := e_error;}
						  }
						}
						else
						{ log("**** f_waitForIkeSaInitRsp: ERROR: No encryption algorithm transform in 1st proposal of Security Association payload **** ");
@@ -787,11 +792,16 @@ module LibIpv6_Rfc4306Ikev2_Functions {
						{ if (vc_ikeSad[0].ikePseudoRandomFunction != v_saTransform.transformId.pseudoRandomFunction)
						  	{ log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong pseudo random function **** ");
							  v_ret := e_error;}
						  // check attribute key length, if present
					 	  if (ispresent(v_saTransform.saTransformAttributeList) or ispresent(vc_ikeSad[0].prfKeyLen))
						  // check attribute key length, if present in vc_ikeSad
					 	  if (ispresent(vc_ikeSad[0].prfKeyLen))
						  { if (ispresent(v_saTransform.saTransformAttributeList))
							{ if(vc_ikeSad[0].prfKeyLen != v_saTransform.saTransformAttributeList[0].keyLength.attributeValue)
						      { log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong pseudo random function attribute length **** ");
							    v_ret := e_error;}}
							else
							{ log("**** f_waitForIkeSaInitRsp: ERROR: Expected pseudo random function attribute length not found **** ");
							  v_ret := e_error;}
						  }
						}
						else
						{ log("**** f_waitForIkeSaInitRsp: ERROR: No pseudo random function transform in 1st proposal of Security Association payload **** ");
@@ -804,11 +814,16 @@ module LibIpv6_Rfc4306Ikev2_Functions {
						{ if (vc_ikeSad[0].ikeIntegrityAlgo != v_saTransform.transformId.integAlgorithms)
						  	{ log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong integrity algorithm **** ");
							  v_ret := e_error;}
						  // check attribute key length, if present
					 	  if (ispresent(v_saTransform.saTransformAttributeList) or ispresent(vc_ikeSad[0].ikeIntegrKeyLen))
						  // check attribute key length, if present in vc_ikeSad
					 	  if (ispresent(vc_ikeSad[0].ikeIntegrKeyLen))
						  { if (ispresent(v_saTransform.saTransformAttributeList))
							{ if(vc_ikeSad[0].ikeIntegrKeyLen != v_saTransform.saTransformAttributeList[0].keyLength.attributeValue)
						      { log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong integrity algorithm attribute length **** ");
							    v_ret := e_error;}}
							else
							{ log("**** f_waitForIkeSaInitRsp: ERROR: Expected integrity algorithm attribute length not found **** ");
							  v_ret := e_error;}
						  }
						}
						else
						{ log("**** f_waitForIkeSaInitRsp: ERROR: No integrity algorithm transform in 1st proposal of Security Association payload **** ");
@@ -831,6 +846,30 @@ module LibIpv6_Rfc4306Ikev2_Functions {

				}

			// A unexpected IKE_SA_INIT response with a Notify payload is received
			[]	ipPort.receive(mw_ikeSaInitRsp(	p_src,
												p_dst,
												vc_ikeSad[0].udpIutPort,
												vc_ikeSad[0].udpTnPort,
												vc_ikeSad[0].spiInitiator,
												vc_ikeSad[0].messageID,
												mw_ikeSaInitRsp_Notify)) -> value v_ipv6Packet
				{
					tc_wait.stop;
					v_nextPayload := v_ipv6Packet.ipv6Payload.ikeMsg.ikev2Header.nextPayload;
					v_ikePayloadList := v_ipv6Packet.ipv6Payload.ikeMsg.payloadList;
					
					// get Notify payload data
					v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_notifyPL,v_ikePayload);
					if (v_ret_local == e_success)
					{ log("**** f_waitForIkeSaInitRsp: ERROR: IKE_SA_INIT response with Notify payload received, error/status value = ",v_ikePayload.notify.notifyMessageType," **** ");
					  v_ret := e_error;}
					else
					{ log("**** f_waitForIkeSaInitRsp: ERROR: Unexpected IKE_SA_INIT response received **** ");
					  v_ret := e_error;}

				}

			[]	tc_wait.timeout
				{
					v_ret :=  e_timeout;
@@ -925,11 +964,16 @@ module LibIpv6_Rfc4306Ikev2_Functions {
							{ if (vc_sad[c_saIn].espEncryptionAlgo != v_saTransform.transformId.encryptionAlgo)
							   {log("**** f_waitForIkeAuthRsp: ERROR: Security Association payload indicates wrong encryption algorithm **** ");
							    v_ret := e_error;}
							  // check attribute key length, if present
						 	  if (ispresent(v_saTransform.saTransformAttributeList) or ispresent(vc_sad[c_saIn].espEncrKeyLen))
							    // check attribute key length, if present in vc_sad
						 	    if (ispresent(vc_sad[c_saIn].espEncrKeyLen))
							    { if (ispresent(v_saTransform.saTransformAttributeList))
							  	  { if(vc_sad[c_saIn].espEncrKeyLen != v_saTransform.saTransformAttributeList[0].keyLength.attributeValue)
							     {log("**** f_waitForIkeAuthRsp: ERROR: Security Association payload indicates wrong encryption algorithm attribute length **** ");
							        { log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong encryption algorithm attribute length **** ");
								      v_ret := e_error;}}
								  else
								  { log("**** f_waitForIkeSaInitRsp: ERROR: Expected encryption algorithm attribute length not found **** ");
								    v_ret := e_error;}
							  }
							}
							else
							{ log("**** f_waitForIkeAuthRsp: ERROR: No encryption algorithm transform in 1st proposal of Security Association payload **** ");
@@ -943,11 +987,16 @@ module LibIpv6_Rfc4306Ikev2_Functions {
								{ if(vc_sad[c_saIn].espIntegrityAlgo != v_saTransform.transformId.integAlgorithms)
								   {log("**** f_waitForIkeAuthRsp: ERROR: Security Association payload indicates wrong ESP integrity algorithm **** ");
								    v_ret := e_error;}
								  // check attribute key length, if present
							 	  if (ispresent(v_saTransform.saTransformAttributeList) or ispresent(vc_sad[c_saIn].espIntegrKeyLen))
								    // check attribute key length, if present in vc_sad
							 	    if (ispresent(vc_sad[c_saIn].espIntegrKeyLen))
								    { if (ispresent(v_saTransform.saTransformAttributeList))
								  	  { if(vc_sad[c_saIn].espIntegrKeyLen != v_saTransform.saTransformAttributeList[0].keyLength.attributeValue)
								     {log("**** f_waitForIkeAuthRsp: ERROR: Security Association payload indicates wrong ESP integrity algorithm attribute length **** ");
								        { log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong ESP integrity algorithm attribute length **** ");
									      v_ret := e_error;}}
									  else
									  { log("**** f_waitForIkeSaInitRsp: ERROR: Expected ESP integrity algorithm attribute length not found **** ");
									    v_ret := e_error;}
								  }
								}
								else
								{ log("**** f_waitForIkeAuthRsp: ERROR: No ESP integrity algorithm transform in 1st proposal of Security Association payload **** ");
@@ -963,11 +1012,16 @@ module LibIpv6_Rfc4306Ikev2_Functions {
							{ if(vc_sad[c_saIn].ahIntegrityAlgo != v_saTransform.transformId.integAlgorithms)
							   {log("**** f_waitForIkeAuthRsp: ERROR: Security Association payload indicates wrong AH integrity algorithm **** ");
							    v_ret := e_error;}
							  // check attribute key length, if present
						 	  if (ispresent(v_saTransform.saTransformAttributeList) or ispresent(vc_sad[c_saIn].ahIntegrKeyLen))
							    // check attribute key length, if present in vc_sad
						 	    if (ispresent(vc_sad[c_saIn].ahIntegrKeyLen))
							    { if (ispresent(v_saTransform.saTransformAttributeList))
							  	  { if(vc_sad[c_saIn].ahIntegrKeyLen != v_saTransform.saTransformAttributeList[0].keyLength.attributeValue)
							     {log("**** f_waitForIkeAuthRsp: ERROR: Security Association payload indicates wrong AH integrity algorithm attribute length **** ");
							        { log("**** f_waitForIkeSaInitRsp: ERROR: Security Association payload indicates wrong AH integrity algorithm attribute length **** ");
								      v_ret := e_error;}}
								  else
								  { log("**** f_waitForIkeSaInitRsp: ERROR: Expected AH integrity algorithm attribute length not found **** ");
								    v_ret := e_error;}
							  }
							}
							else
								{ log("**** f_waitForIkeAuthRsp: ERROR: No AH integrity algorithm transform in 1st proposal of Security Association payload **** ");
@@ -992,6 +1046,30 @@ module LibIpv6_Rfc4306Ikev2_Functions {
					  v_ret := e_error;}
				}

			// A unexpected IKE_AUTH response with a Notify payload is received
			[]	ipPort.receive(mw_ikeAuthRsp(	p_src,
												p_dst,
												vc_ikeSad[0].udpIutPort,
												vc_ikeSad[0].udpTnPort,
												vc_ikeSad[0].spiInitiator,
												vc_ikeSad[0].spiResponder,
												vc_ikeSad[0].messageID,
												mw_encryptedPLL(mw_ikeAuthRsp_Notify))) -> value v_ipv6Packet
				{
					tc_wait.stop;
					v_nextPayload := v_ipv6Packet.ipv6Payload.ikeMsg.payloadList[0].encrypted.nextPayload;
					v_ikePayloadList := v_ipv6Packet.ipv6Payload.ikeMsg.payloadList[0].encrypted.payloadList;
					
					// get Notify payload data
					v_ret_local := f_getPayload(v_ikePayloadList,v_nextPayload,c_notifyPL,v_ikePayload);
					if (v_ret_local == e_success)
					{ log("**** f_waitForIkeAuthRsp: ERROR: IKE_AUTH response with Notify payload received, error/status value = ",v_ikePayload.notify.notifyMessageType," **** ");
					  v_ret := e_error;}
					else
					{ log("**** f_waitForIkeAuthRsp: ERROR: Unexpected IKE_AUTH response received **** ");
					  v_ret := e_error;}
				}

			[]	tc_wait.timeout
				{
					v_ret :=  e_timeout;
+24 −0
Original line number Diff line number Diff line
@@ -304,6 +304,9 @@
		template IkePayloadList mw_ikeSaInitRspPLL :=
		superset ( mw_securityAssociationIkePL, mw_noncePL, mw_keyExchangePL);

		template IkePayloadList mw_ikeSaInitRsp_Notify :=
		superset ( mw_notifyPL);

		template IkePayloadList mw_encryptedPLL(template IkePayloadList p_ikepayloads) :=
		{ mw_encryptedPL(p_ikepayloads) };

@@ -313,6 +316,9 @@
		template IkePayloadList mw_ikeAuthRspPLL :=
		superset ( mw_securityAssociationPL, mw_identificationPL, mw_trafficSelectorPL, mw_trafficSelectorPL, mw_authPL);

		template IkePayloadList mw_ikeAuthRsp_Notify :=
		superset ( mw_notifyPL);

		}//end group payLoadListTemplates

	group ikeSecurityAssociationPayloadTemplates {
@@ -557,6 +563,24 @@ group payloadTemplates {

	}//end group ikeNoncePayloadTemplates

	group ikeNotifyPayloadTemplates {

		template IkePayload mw_notifyPL := {
			notify := {
				nextPayload       := ?,
				criticalFlag      := 0,
				reserved          := ?,
				payloadLength     := ?,
				protocolId        := ?,
				spiSize           := ?,
				notifyMessageType := ?,
				spi               := *,
				data              := *
			}
		} 

	}//end group ikeNotifyPayloadTemplates

	group vendorIdPayloadTemplates {
		
		template IkePayload m_vendorIdPL (
+2 −2
Original line number Diff line number Diff line
@@ -656,8 +656,8 @@
				UInt8			protocolId,
				UInt8			spiSize,
				UInt16			notifyMessageType,
				octetstring		spi,
				octetstring		data
				octetstring		spi optional,
				octetstring		data optional
			} 
			with {
				variant (nextPayload) "tag='nextPayload';";