[IPsec] Two questions about draft-ietf-ipsecme-chacha20-poly1305-00

Tero Kivinen <kivinen@iki.fi> Tue, 31 March 2015 10:50 UTC

Return-Path: <kivinen@iki.fi>
X-Original-To: ipsec@ietfa.amsl.com
Delivered-To: ipsec@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id EA12E1A90A1 for <ipsec@ietfa.amsl.com>; Tue, 31 Mar 2015 03:50:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.131
X-Spam-Level:
X-Spam-Status: No, score=-1.131 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_NEUTRAL=0.779, T_RP_MATCHES_RCVD=-0.01] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k9Jf8IAXwvfa for <ipsec@ietfa.amsl.com>; Tue, 31 Mar 2015 03:50:00 -0700 (PDT)
Received: from mail.kivinen.iki.fi (fireball.kivinen.iki.fi [IPv6:2001:1bc8:100d::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 31F3A1A907C for <ipsec@ietf.org>; Tue, 31 Mar 2015 03:50:00 -0700 (PDT)
Received: from fireball.kivinen.iki.fi (localhost [127.0.0.1]) by mail.kivinen.iki.fi (8.14.8/8.14.8) with ESMTP id t2VAnvMp008593 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 31 Mar 2015 13:49:57 +0300 (EEST)
Received: (from kivinen@localhost) by fireball.kivinen.iki.fi (8.14.8/8.14.8/Submit) id t2VAnuGk016426; Tue, 31 Mar 2015 13:49:56 +0300 (EEST)
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Message-ID: <21786.31700.388695.942729@fireball.kivinen.iki.fi>
Date: Tue, 31 Mar 2015 13:49:56 +0300
From: Tero Kivinen <kivinen@iki.fi>
To: Yoav Nir <ynir.ietf@gmail.com>
In-Reply-To: <6E938E70-324A-424E-9D20-7067BD278165@gmail.com>
References: <20150330133237.21486.80504.idtracker@ietfa.amsl.com> <6E938E70-324A-424E-9D20-7067BD278165@gmail.com>
X-Mailer: VM 8.2.0b under 24.3.1 (x86_64--netbsd)
X-Edit-Time: 24 min
X-Total-Time: 38 min
Archived-At: <http://mailarchive.ietf.org/arch/msg/ipsec/iJvcELf0ACRhq-3nTRtqfanUok8>
Cc: ipsec@ietf.org
Subject: [IPsec] Two questions about draft-ietf-ipsecme-chacha20-poly1305-00
X-BeenThere: ipsec@ietf.org
X-Mailman-Version: 2.1.15
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: Tue, 31 Mar 2015 10:50:02 -0000

Yoav Nir writes:
> First is the nonce/IV question: In the current draft, there is a
> 64-bit IV with guidance not to repeat them (so use a counter or
> LFSR). The function itself accepts a 96-bit input nonce, so the
> nonce is constructed from the 64-bit IV and 32 zero bits. The reason
> for doing this is so the algorithm could be used in a multi-sender
> case such as GDOI, where the 32-bit zero can be replaced by a sender
> ID. Alternatively, we could generate a 32-bit salt value from the
> key material, but I don’t see a reason why we’d want that.

Reserving that 32-bits as sender-ID is fine...

> Another thing we could do is what some people are advocating for
> TLS: Since a counter is a fine IV (no need for secrecy), we don’t
> need a 64-bit IV that has the exact same value as the replay
> counter. We might as well save 8 bytes per packet and just feed the
> replay counter to the function. The argument against this is that
> some crypto modules may have the API set up in such a way that the
> IVs are generated within the module and could be something other
> than a counter (like an LFSR). The proposal will break such APIs.

As Kent explained in the meeting, if you move the IV generation out
from the crypto operation, then that also moves the FIPS boundary,
i.e. if the uniqueness of the IV generation (counter) is inside the
IPsec module, not in the ChaCha20 module, then you need to FIPS
certify whole thing.

On the other hand with IPsec I think you mostly need to FIPS certify
quite a lot of stuff anyways...

On the other hand, I think it would be possible to do things other way
around, i.e. make cipher to internally generate IV, but define that IV
MUST be running counter starting from 0, and use that counter as
sequence number in the ESP and compress sequence number out from the
packet. I.e. we would still have IV (coming form inside the crypto
boundary), but we compress the sequence number away, as it would
always be the same as IV...

Currently we cannot do that, as we do not define how the IVs are
generated, thus the IPsec part cannot know for sure that IVs are
generated in such way.

On the other hand if we define this cipher in such way that IV MUST be
generated such way, then we could make sequence number compression
option in the future, which would compress sequence number away from
the actual packet... I.e. gain the same effect, but not compressing
the IV, but compressing the sequence number...

This would save 32-bits from the packet, as only 32-bits of the
sequence number is transmitted, not the full 64-bits, but that would
still be something, and if even more IV compression is needed, there
would be ways to only transmit smaller part of the IV and then
reconstruct it before decryption and verification.

These compression extensions could happen after ESP encryption and
before ESP decryption, so the actual ESP packets seen by the engine
would be exactly same, only difference would be that they would need
to maintain strict requirement that SEQ matches IV...

> Second issue is about UI advice. Some implementations (yes, mine is
> included) allow the user to configure encryption algorithm, MAC
> algorithm, and D-H group. There is no setting for PRF since such UIs
> date back to IKEv1. The PRF is usually just taken from the setting
> for MAC algorithm. This works fine as long as all supported MAC
> algorithms are HMAC, XCBC, and CMAC. AES-GCM would have the same
> issue, but RFC 5282 makes no mention of this issue. I’m wondering if
> we should recommend to pair this algorithm in IKE with
> PRF_HMAC_SHA2_256. 

There is no need in IKEv2 to tie the PRF to other algorithms, so I see
no reason to do so in this draft.

On the other hand the other draft making the UI suite for this will of
course need to select suitable PRF, but that draft might want to wait
for new EC curves, so we could have complete DJB suite...

Btw, in the draft introduction you have text which says:

   weakness in AES, VPN users will be in an unenviable position.  With
   the only other widely supported cipher being the much slower 3DES, it
   is not feasible to re-configure IPsec installations to use 3DES.
   [standby-cipher] describes this issue and the need for a standby
   cipher in greater detail.

I do not think the problem with 3DES is the speed, I think the bigger
problem is the way too short block length of it. As RFC7321 says:

   The Triple Data Encryption Standard (TDES) is obsolete because of its
   small block size; as with all 64-bit block ciphers, it SHOULD NOT be
   used to encrypt more than one gigabyte of data with a single key
   [M13].  Its key size is smaller than that of the Advanced Encryption
   Standard (AES), while at the same time its performance and efficiency
   are worse.  Thus, its use in new implementations is discouraged.

With gigabit links that would mean rekeying every ten seconds or so... 
-- 
kivinen@iki.fi