Re: [IPsec] IKE fragmentation

Yoav Nir <> Thu, 14 March 2013 14:49 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id C294B11E8150 for <>; Thu, 14 Mar 2013 07:49:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -10.141
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 ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 2VzI-6BD5asS for <>; Thu, 14 Mar 2013 07:49:58 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 3516B11E8146 for <>; Thu, 14 Mar 2013 07:49:56 -0700 (PDT)
Received: from ([]) by (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 ([]) by ([]) with mapi id 14.02.0342.003; Thu, 14 Mar 2013 16:49:54 +0200
From: Yoav Nir <>
To: Tero Kivinen <>
Thread-Topic: [IPsec] IKE fragmentation
Thread-Index: AQHOH/P+dHmEPMd7P0SMbddmnpEj3pikJ5oAgAEK/gb//+digIAABVOAgAAFoQA=
Date: Thu, 14 Mar 2013 14:49:53 +0000
Message-ID: <>
References: <> <294A12724CB849D2A33F7F80CC82426A@buildpc> <> <3028CF35E60A40068CE70EB7BB0BDEF1@buildpc> <> <FCC464E01434424EB7EB4365E86F9130@buildpc> <> <>
In-Reply-To: <>
Accept-Language: en-US
Content-Language: en-US
x-originating-ip: []
x-kse-antivirus-interceptor-info: scan successful
x-kse-antivirus-info: Clean
Content-Type: text/plain; charset="us-ascii"
Content-ID: <>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: "<>" <>, Valery Smyslov <>
Subject: Re: [IPsec] IKE fragmentation
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Discussion of IPsec protocols <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Thu, 14 Mar 2013 14:49:58 -0000

On Mar 14, 2013, at 10:29 AM, Tero Kivinen <>

> 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.