Commit c2ea1a2b authored by schmitting's avatar schmitting
Browse files

Store and check of attribute length added

parent bb06ac7c
Loading
Loading
Loading
Loading
+67 −13
Original line number Diff line number Diff line
@@ -489,7 +489,11 @@ module LibIpv6_Rfc4306Ikev2_Functions {
						v_ret := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList,
													  c_transformTypeEncr,v_saTransform);
						if (v_ret_local == e_success)
						{vc_ikeSad[0].ikeEncryptionAlgo := v_saTransform.transformId.encryptionAlgo; }
						{vc_ikeSad[0].ikeEncryptionAlgo := v_saTransform.transformId.encryptionAlgo;
							// store attribute key length, if present
						 	if (ispresent(v_saTransform.saTransformAttributeList))
							{vc_ikeSad[0].ikeEncrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;}
						}
						else
						{ log("**** f_waitForIkeSaInitReq: ERROR: No encryption algorithm transform in 1st proposal of Security Association payload **** ");
						  v_ret := e_error;}
@@ -498,7 +502,11 @@ module LibIpv6_Rfc4306Ikev2_Functions {
					 	v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList,
													  c_transformTypePrf,v_saTransform);
						if (v_ret_local == e_success)
						{vc_ikeSad[0].ikePseudoRandomFunction := v_saTransform.transformId.pseudoRandomFunction; }
						{vc_ikeSad[0].ikePseudoRandomFunction := v_saTransform.transformId.pseudoRandomFunction;
							// store attribute key length, if present
						 	if (ispresent(v_saTransform.saTransformAttributeList))
							{vc_ikeSad[0].prfKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;}
						}
						else
						{ log("**** f_waitForIkeSaInitReq: ERROR: No pseudo random function transform in 1st proposal of Security Association payload **** ");
						  v_ret := e_error;}
@@ -507,7 +515,11 @@ module LibIpv6_Rfc4306Ikev2_Functions {
					 	v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList,
													  c_transformTypeInteg,v_saTransform);
						if (v_ret_local == e_success)
						{vc_ikeSad[0].ikeIntegrityAlgo := v_saTransform.transformId.integAlgorithms; }
						{vc_ikeSad[0].ikeIntegrityAlgo := v_saTransform.transformId.integAlgorithms;
							// store attribute key length, if present
						 	if (ispresent(v_saTransform.saTransformAttributeList))
							{vc_ikeSad[0].ikeIntegrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;}
						}
						else
						{ log("**** f_waitForIkeSaInitReq: ERROR: No integrity algorithm transform in 1st proposal of Security Association payload **** ");
						  v_ret := e_error;}
@@ -620,7 +632,11 @@ module LibIpv6_Rfc4306Ikev2_Functions {
							v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList,
														  c_transformTypeEncr,v_saTransform);
							if (v_ret_local == e_success)
							{vc_sad[c_saIn].espEncryptionAlgo := v_saTransform.transformId.encryptionAlgo; }
							{vc_sad[c_saIn].espEncryptionAlgo := v_saTransform.transformId.encryptionAlgo;
								// store attribute key length, if present
							 	if (ispresent(v_saTransform.saTransformAttributeList))
								{vc_sad[c_saIn].espEncrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;}
							}
							else
							{ log("**** f_waitForIkeAuthReq: ERROR: No encryption algorithm transform in 1st proposal of Security Association payload **** ");
							  v_ret := e_error;}
@@ -629,7 +645,11 @@ module LibIpv6_Rfc4306Ikev2_Functions {
						 	v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList,
														  c_transformTypeInteg,v_saTransform);
							if (v_ret_local == e_success)
							{vc_sad[c_saIn].espIntegrityAlgo := v_saTransform.transformId.integAlgorithms; }
							{vc_sad[c_saIn].espIntegrityAlgo := v_saTransform.transformId.integAlgorithms;
								// store attribute key length, if present
							 	if (ispresent(v_saTransform.saTransformAttributeList))
								{vc_sad[c_saIn].espIntegrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;}
							}
							else
							{ log("**** f_waitForIkeAuthReq: WARNING: No ESP integrity algorithm transform in 1st proposal of Security Association payload **** ") }
						}
@@ -640,7 +660,11 @@ module LibIpv6_Rfc4306Ikev2_Functions {
						 	v_ret_local := f_getTransformOfType(v_ikePayload.securityAssociation.saProposalList,
														  c_transformTypeInteg,v_saTransform);
							if (v_ret_local == e_success)
							{vc_sad[c_saIn].ahIntegrityAlgo := v_saTransform.transformId.integAlgorithms; }
							{vc_sad[c_saIn].ahIntegrityAlgo := v_saTransform.transformId.integAlgorithms;
								// store attribute key length, if present
							 	if (ispresent(v_saTransform.saTransformAttributeList))
								{vc_sad[c_saIn].ahIntegrKeyLen := v_saTransform.saTransformAttributeList[0].keyLength.attributeValue;}
							}
							else
							{ log("**** f_waitForIkeAuthReq: ERROR: No AH integrity algorithm transform in 1st proposal of Security Association payload **** ");
							  v_ret := e_error;}
@@ -746,6 +770,11 @@ 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))
						  { 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: No encryption algorithm transform in 1st proposal of Security Association payload **** ");
@@ -758,6 +787,11 @@ 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))
						  { 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: No pseudo random function transform in 1st proposal of Security Association payload **** ");
@@ -770,6 +804,11 @@ 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))
						  { 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: No integrity algorithm transform in 1st proposal of Security Association payload **** ");
@@ -886,6 +925,11 @@ 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))
							  { 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 **** ");
								  v_ret := e_error;}}
							}
							else
							{ log("**** f_waitForIkeAuthRsp: ERROR: No encryption algorithm transform in 1st proposal of Security Association payload **** ");
@@ -899,6 +943,11 @@ 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))
								  { 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 **** ");
									  v_ret := e_error;}}
								}
								else
								{ log("**** f_waitForIkeAuthRsp: ERROR: No ESP integrity algorithm transform in 1st proposal of Security Association payload **** ");
@@ -914,6 +963,11 @@ 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))
							  { 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 **** ");
								  v_ret := e_error;}}
							}
						else
							{ log("**** f_waitForIkeAuthRsp: ERROR: No AH integrity algorithm transform in 1st proposal of Security Association payload **** ");