Subject: [Ipsec] Ipsec ESP Padding related doubt.

From: Syed Ajim Hussain <[email-masked]>
Date: Thu, 08 Mar 2007 17:08:34 +0530

Hi All 
  I have a doubt on ESP Padding length. 
  Suppose one IPsec-Test device send a ESP packet   
  with DES as Encryption and MD5 as authentication algorithm.   
  IPSEC-Test-device also set PL field as Zero , But before PL Field he     
  but two byes of extra padding  0x01 and 0x02.  To make whole 
  encryption block  block-size aligned ( 8 Bytes aligned )

  ESP Encrypted Packer format :  

 60 bytes Encrypt Data--|extra 2 byes padding 0x01 0x02 | PL 0x00 |NH 01
 Total 64 Bytes . 8 byes aligned 

  Now can any IPSec implementation can detect that padding data is not 
  valid, if PL Field is set to Zero , while  Whole encryption block  
  block-size- aligned ,

  Waiting for your reply . 

With Regards
Syed Ajim 

_______________________________________________
Ipsec mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/ipsec

---

From: Paul Koning <[email-masked]>
Date: Thu, 8 Mar 2007 13:28:41 -0500

>>>>> "Syed" == Syed Ajim Hussain <[email-masked]> writes:

 Syed> Hi All I have a doubt on ESP Padding length.  Suppose one
 Syed> IPsec-Test device send a ESP packet with DES as Encryption and
 Syed> MD5 as authentication algorithm.  IPSEC-Test-device also set PL
 Syed> field as Zero , But before PL Field he but two byes of extra
 Syed> padding 0x01 and 0x02.  To make whole encryption block
 Syed> block-size aligned ( 8 Bytes aligned )

 Syed> ESP Encrypted Packer format :

 Syed> 60 bytes Encrypt Data--|extra 2 byes padding 0x01 0x02 | PL
 Syed> 0x00 |NH 01 Total 64 Bytes . 8 byes aligned

 Syed> Now can any IPSec implementation can detect that padding data
 Syed> is not valid, if PL Field is set to Zero , while Whole
 Syed> encryption block block-size- aligned ,

As far as the receiving node is concerned, that packet is valid.  The
data includes those two "pad" bytes. 

So the sending node has corrupted the data by appending stuff to it.
IPsec protects against data corruption (and other things) in the
network, but it does not protect against errors in the IPsec
endpoints.  Those are required to operate correctly.

	    paul

---

From: Stephen Kent <[email-masked]>
Date: Thu, 8 Mar 2007 18:39:17 -0500

>   valid, if PL Field is set to Zero , while  Whole encryption block 

You have not said what mode of DES is being used, which enters into 
the question of whether padding is needed and whether it is checked 
by a receiver. However, your text above suggests that you are using a 
mode of DES that requires 8-byte blocks. Anyway, the pad length field 
is supposed to be set to 2 here, because you have added two bytes of 
padding, before the Pad Length and Next Header fields, that have to 
be right aligned in the last word.

So, if the sender fails to set the PL field to 2, it is in error. 
This will cause a receiver to interpret the two padding bytes as part 
of the plaintext, and not discard them. Whether this causes problems 
or not, the sender is in error, as per RFC 4303.

Steve