Commit 558ee17f authored by mullers's avatar mullers
Browse files

ICV optionality added

and possibility of e_null added
and correct calculation of ICV added
and TTwb bugs fixed
parent 185ae8ac
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -248,16 +248,20 @@ group rfc2460Root_Functions {
				// Process Authentication Header Header
				else if (ischosen(v_activeIpv6Packet.extHdrList[i].authHeader)) {
					
					if (lengthof(p_ipv6Packet.extHdrList[i].authHeader.icv) != vc_sad[0].icvLen) {
						log("**** f_setAuthHeader: Error: icv length delivered by fx_max does not match icv length defined in vc_sad ****");
						return e_error;
					//Set Dummy ICV of correct length
					if (vc_sad[0].icvLen == 0) {
						p_ipv6Packet.extHdrList[i].authHeader.icv := omit;	
					}
					else {
						p_ipv6Packet.extHdrList[i].authHeader.icv := int2oct(0, vc_sad[0].icvLen);
					}
					
					if (vc_sad[0].icvPadLen != 0) {
						p_ipv6Packet.extHdrList[i].authHeader.icvPadding := int2oct(0,vc_sad[0].icvPadLen);
					// Check ICV padding
					if (vc_sad[0].icvPadLen == 0) {
						p_ipv6Packet.extHdrList[i].authHeader.icvPadding := omit;
					}
					else {
						p_ipv6Packet.extHdrList[i].authHeader.icvPadding := omit;
						p_ipv6Packet.extHdrList[i].authHeader.icvPadding := int2oct(0, vc_sad[0].icvPadLen);
					}

					//	Update AuthHeader payloadLen
@@ -288,7 +292,7 @@ group rfc2460Root_Functions {

	function f_calcIpv6PayloadChecksum( in template Ipv6Address p_srcAddr,	
										in template Ipv6Address p_dstAddr, 
										inout template Ipv6Payload p_ipv6Payload)
										inout Ipv6Payload p_ipv6Payload)
	return FncRetCode {
		
		if(ischosen(p_ipv6Payload.echoReplyMsg)) {
@@ -1084,6 +1088,7 @@ group rfc4303Esp_ExtHdrFunctions {
		
	}//end f_init_ipSecParams
	
	//in units of octets
	function f_getIcvLen(IntegrityAlgo p_integrityAlgo)
	runs on LibIpv6Node
	return UInt8 {
@@ -1093,10 +1098,14 @@ group rfc4303Esp_ExtHdrFunctions {
		else if (p_integrityAlgo == e_hmac_sha1_64){
			return 8;
		}
		else if(p_integrityAlgo == e_null) {
			return 0;	
		}
		
		return 12;
	}
	
	//in units of octets
	function f_getIcvPadLen(IntegrityAlgo p_integrityAlgo)
	runs on LibIpv6Node
	return UInt8 {
@@ -1106,6 +1115,9 @@ group rfc4303Esp_ExtHdrFunctions {
		else if (p_integrityAlgo == e_hmac_sha1_64){
			return 4;
		}
		else if(p_integrityAlgo == e_null) {
			return 0;	
		}
	
		return 0;
	}
+4 −2
Original line number Diff line number Diff line
@@ -410,7 +410,8 @@ module LibIpv6_Interface_Templates {
						reserved := ?,
						securityParametersIndex := ?,
						sequenceNumber := ?,
						icv := ? }
						icv := ?,
						icvPadding := *}
				}
			} //end group authHdrTemplates
		} // end extensionHeader
@@ -1301,7 +1302,8 @@ module LibIpv6_Interface_Templates {
					reserved := reserved_p,
					securityParametersIndex := securityParametersIndex_p,
					sequenceNumber := sequenceNumber_p,
					icv := icv_p
					icv := icv_p,
					icvPadding := omit
				}
			}
			
+1 −1
Original line number Diff line number Diff line
@@ -1052,7 +1052,7 @@ module LibIpv6_Interface_TypesAndValues {
			UInt16		reserved,
			UInt32		securityParametersIndex,
			UInt32		sequenceNumber,
			octetstring	icv length (8, 12, 20),
			octetstring	icv optional,
			octetstring icvPadding optional		
		}
		with {