Re: [IPsec] IKE fragmentation

Yoav Nir <ynir@checkpoint.com> Thu, 14 March 2013 14:49 UTC

Return-Path: <ynir@checkpoint.com>
X-Original-To: ipsec@ietfa.amsl.com
Delivered-To: ipsec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C294B11E8150 for <ipsec@ietfa.amsl.com>; Thu, 14 Mar 2013 07:49:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.141
X-Spam-Level:
X-Spam-Status: No, score=-10.141 tagged_above=-999 required=5 tests=[AWL=0.458, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2VzI-6BD5asS for <ipsec@ietfa.amsl.com>; Thu, 14 Mar 2013 07:49:58 -0700 (PDT)
Received: from smtp.checkpoint.com (smtp.checkpoint.com [194.29.34.68]) by ietfa.amsl.com (Postfix) with ESMTP id 3516B11E8146 for <ipsec@ietf.org>; Thu, 14 Mar 2013 07:49:56 -0700 (PDT)
Received: from DAG-EX10.ad.checkpoint.com ([194.29.34.150]) by smtp.checkpoint.com (8.13.8/8.13.8) with ESMTP id r2EEns6j009086; Thu, 14 Mar 2013 16:49:54 +0200
X-CheckPoint: {5141E2B5-0-1B221DC2-2FFFF}
Received: from IL-EX10.ad.checkpoint.com ([169.254.2.54]) by DAG-EX10.ad.checkpoint.com ([169.254.3.48]) with mapi id 14.02.0342.003; Thu, 14 Mar 2013 16:49:54 +0200
From: Yoav Nir <ynir@checkpoint.com>
To: Tero Kivinen <kivinen@iki.fi>
Thread-Topic: [IPsec] IKE fragmentation
Thread-Index: AQHOH/P+dHmEPMd7P0SMbddmnpEj3pikJ5oAgAEK/gb//+digIAABVOAgAAFoQA=
Date: Thu, 14 Mar 2013 14:49:53 +0000
Message-ID: <EDE18D36-816E-4B4A-8D98-CCC9FC45A1F3@checkpoint.com>
References: <20799.34490.611737.922474@fireball.kivinen.iki.fi> <294A12724CB849D2A33F7F80CC82426A@buildpc> <51408287.7080207@gmail.com> <3028CF35E60A40068CE70EB7BB0BDEF1@buildpc> <A5B456F7-DE58-4755-95B0-97D5D15D066C@checkpoint.com> <FCC464E01434424EB7EB4365E86F9130@buildpc> <FCFD00C2-2A6F-4D13-A98C-37BE16DD8A35@checkpoint.com> <20801.57047.617753.249763@fireball.kivinen.iki.fi>
In-Reply-To: <20801.57047.617753.249763@fireball.kivinen.iki.fi>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [172.31.20.209]
x-kse-antivirus-interceptor-info: scan successful
x-kse-antivirus-info: Clean
Content-Type: text/plain; charset="us-ascii"
Content-ID: <CC21749A1F12A942BECB5328E7B70B2D@ad.checkpoint.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: "<ipsec@ietf.org>" <ipsec@ietf.org>, Valery Smyslov <svanru@gmail.com>
Subject: Re: [IPsec] IKE fragmentation
X-BeenThere: ipsec@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Discussion of IPsec protocols <ipsec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipsec>, <mailto:ipsec-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/ipsec>
List-Post: <mailto:ipsec@ietf.org>
List-Help: <mailto:ipsec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipsec>, <mailto:ipsec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 14 Mar 2013 14:49:58 -0000

On Mar 14, 2013, at 10:29 AM, Tero Kivinen <kivinen@iki.fi>
 wrote:

> Yoav Nir writes:
>>> There is no DH calculating per fragment. DH is calculated once in
>>> IKE_SA_INIT as in ordinary IKE SA establishment (note, that
>>> unprotected messages, including IKE_SA_INIT and IKE_SA_RESUME
>>> cannot be fragmented).
>> 
>> If we do IKEv2 fragments the way everyone does IKEv1 fragments, the
>> initiator can send multiple fragments that don't assemble to a
>> protected packet, causing the responder to allocate memory to store
>> these fragments (at least for a short while). Doing this does not
>> require completing the D-H calculation, and does not require running
>> either an encryption or MAC function. 
> 
> I would assume all implementations start doing Diffie-Hellman even
> before than they even see the first fragment. I.e. when the responder
> sends it IKE_SA_INIT reply back it will also start the Diffie-Hellman
> calculation on the background so it might be ready when it gets next
> packet from the initiator. The initiator must do the Diffie-Hellman
> before it can send first IKE_AUTH packet anyways.
> 
> When responder gets IKE_AUTH packet from the initiator, then they will
> start Diffie-Hellman calculation if they have not yet done it
> previously. 

My implementation does that. We only calculate the shared key when we need it - when the IKE_AUTH request arrives.

>> What your draft does, is force the initiator to protect each
>> fragment. To protect a fragment in a way that will cause the
>> responder to store it, requires running the MAC function, and that
>> in turn requires generating the keys (running the PRF), which in
>> turn requires completing the D-H calculation. If the initiator fails
>> to do any of these things, the fragment will be immediately rejected
>> at the responder. Of course, the D-H calculation is not
>> per-fragment, and I did not claim that this was the case.
> 
> Initiator must do Diffie-Hellman anyways before it can send IKE_AUTH.

True for a legitimate Initiator. At attacker can send fake fragments, and the responder has the option of expanding CPU resources for verifying the ICV, or expanding the memory resources for storing them for a while.

>> Measurably more, because MAC functions have an initialization part,
>> so running it on a single packet by parts incurs the per-run
>> overhead multiple times. See the differences in the throughput of
>> HMAC based on buffer size (obtained by running "opnessl speed":
> 
> We are talking about IKE_AUTH here, and we will do the Diffie-Hellman,
> and most likely also public key signature verification and generation
> here (fragmentation is most likely only needed if we do have
> certificates inside the packet, shared secret authentication should
> work without fragmentation). 
> 
>> type         16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
>> hmac(md5)    17801.04k    53527.61k   132966.20k   210528.97k   253873.49k
>> 
>> So if the packet is 8000 bytes, and you divided it into 1024
>> fragments, you would incur a slightly more than 20% penalty.
> 
> It's actually more useful to compare the speeds from the 1024 bytes
> down to 512 bytes and then add Diffie-Hellman over group 14 and RSA
> signature verification + generation over 2048 bit key and check the
> time difference there. I would expect it to be almost unnoticeable. 

I agree it's in the noise.