Commit 17b8b781 authored by berge's avatar berge
Browse files

some more keyLen corrections

parent f95e02cc
Loading
Loading
Loading
Loading
+22 −13
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ group rfc2460Root_Functions {
						v_activeIpv6Packet.extHdrList[i].espHeader.espPayload.iv := omit; 
					}
					else {
						v_activeIpv6Packet.extHdrList[i].espHeader.espPayload.iv := PX_IV; 	
						v_activeIpv6Packet.extHdrList[i].espHeader.espPayload.iv := int2oct(128, f_getEncryptionIvLen(PX_ENCRYPTION_ALGO)); 	
					}
					//Update the original packet						
					v_activeIpv6Packet.ipv6Hdr.payloadLength := fx_payloadLength (v_activeIpv6Packet);	
@@ -1069,23 +1069,24 @@ group rfc3775Mipv6_ExtHdrFunctions {
group rfc4303Esp_ExtHdrFunctions {
	
	function f_init_ipSecParams()
	runs on LibIpv6Node {
	runs on LibIpv6Node
	return FncRetCode {
		
		var FncRetCode v_ret := e_error;

		if( (f_getEncryptionIvLen(PX_ENCRYPTION_ALGO) != 0) and (f_getEncryptionIvLen(PX_ENCRYPTION_ALGO) != lengthof(PX_IV))) {
			v_ret := e_error;
			log("**** fx_setSecurityParameters: ERROR: Incorrect IV length for the selected encryption algorithm ****");
		}
//		if( (f_getEncryptionIvLen(PX_ENCRYPTION_ALGO) != 0) and (f_getEncryptionIvLen(PX_ENCRYPTION_ALGO) != lengthof(PX_IV))) {
//			v_ret := e_error;
//			log("**** fx_setSecurityParameters: ERROR: Incorrect IV length for the selected encryption algorithm ****");
//		}

		if( f_checkEncryptionKeyLen(PX_ENCRYPTION_ALGO,lengthof(PX_ESP_ENCR_KEY)) != true) {
			v_ret := e_error;
			log("**** fx_setSecurityParameters: ERROR: Incorrect key length for the selected encryption algorithm ****");
			log("**** f_init_ipSecParams: ERROR: Incorrect key length for the selected encryption algorithm ****");
			return e_error;
		}

		if( f_checkIntegrityKeyLen(PX_INTEGRITY_ALGO, lengthof(PX_INTEGRITY_KEY)) != true) {
			v_ret := e_error;
			log("**** fx_setSecurityParameters: 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;
		}

		// SAD-OUT
@@ -1134,7 +1135,9 @@ group rfc4303Esp_ExtHdrFunctions {

		//TODO chose in function of PX_SPI the SAD to be used for testing
		v_ret := fx_setSecurityParameters(Sad:{vc_sad[c_saOut]});
		if (v_ret != e_success) {log("fx_setSecurityParameters: Error when settign security parameters");}
		if (v_ret != e_success) {log("f_init_ipSecParams: Error when setting security parameters");}
		
		return v_ret;
		
	}//end f_init_ipSecParams
	
@@ -1180,9 +1183,15 @@ group rfc4303Esp_ExtHdrFunctions {
		if((p_integrityAlgo == e_sha1) and (p_keyLen != 20)) {
			return false;
		}
		else if ((p_integrityAlgo == e_sha1_96) and (p_keyLen != 20)){
			return false;
		}
		else if ((p_integrityAlgo == e_hmac_sha1_64) and (p_keyLen != 20)){
			return false;
		}
		else if ((p_integrityAlgo == e_hmac_sha1_96) and (p_keyLen != 20)){
			return false;
		}
		else if((p_integrityAlgo == e_hmac_md5_96) and (p_keyLen != 16)) {
			return false;	
		}
@@ -1216,7 +1225,7 @@ group rfc4303Esp_ExtHdrFunctions {
		if((p_encryptionAlgo == e_tripleDes_cbc) and (p_keyLen != 24)){
			return false;
		}
		else if ((p_encryptionAlgo == e_aes_cbc) and ((p_keyLen < 0) or (p_keyLen > 8))){
		else if ((p_encryptionAlgo == e_aes_cbc) and ((p_keyLen < 0) or (p_keyLen > 32))){
			return false;
		}
		else if((p_encryptionAlgo == e_aes_ctr) 
+1 −1
Original line number Diff line number Diff line
@@ -1069,7 +1069,7 @@ module LibIpv6_Interface_TypesAndValues {
			}
			
			type record EspPayload {
				octetstring			iv optional,// depends on enc-algo
/*plaintext*/	octetstring			iv optional,// depends on enc-algo
				EspIpDatagram		espIpDatagram optional,// depends on enc-algo
				Oct1to255			tfcPadding optional// depends on enc-algo + send-mode
			}
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ module LibIpv6_ModuleParameters {
	/*
	 * @desc Initialization vector for encryption algos
	*/
	modulepar {octetstring PX_IV := '000102030405'O }
	//modulepar {octetstring PX_IV := '000102030405'O }
	
	/*
	 * @desc Key for integrity vc_sad[c_saOut]