Re: [IPsec] Puzzle algorithm negotiation

"Valery Smyslov" <svanru@gmail.com> Mon, 19 January 2015 08:01 UTC

Return-Path: <svanru@gmail.com>
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 DB8BF1AD1BF for <ipsec@ietfa.amsl.com>; Mon, 19 Jan 2015 00:01:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0.771
X-Spam-Level:
X-Spam-Status: No, score=0.771 tagged_above=-999 required=5 tests=[BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, J_CHICKENPOX_64=0.6, RCVD_IN_SORBS_WEB=0.77, SPF_PASS=-0.001] 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 A-bvG8pv_wWc for <ipsec@ietfa.amsl.com>; Mon, 19 Jan 2015 00:01:56 -0800 (PST)
Received: from mail-la0-x22f.google.com (mail-la0-x22f.google.com [IPv6:2a00:1450:4010:c03::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7FB941ACEBD for <ipsec@ietf.org>; Mon, 19 Jan 2015 00:01:55 -0800 (PST)
Received: by mail-la0-f47.google.com with SMTP id hz20so27262186lab.6 for <ipsec@ietf.org>; Mon, 19 Jan 2015 00:01:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:references:subject:date:mime-version :content-type; bh=L9Uumwi/DgBoUDgQoTFZFFf9WHgjIH75jn43ytdAzKA=; b=TWhnZ+Gmu7BuiAOcEyYLkyXvEespXiRFVVKPyEKQRZTwsi6VteUrIvVY10A9WbKSpU Xy8V2YU1wZSykHdrxohfWbx4l3QBbei3U9sJcB9vS3OJ1No3xpewnJxpsHydGrTYwoFa A815MR729j5eDf/moa8VNLj2ys94ThyxNKPRopcc/S64rlTtVQSeWaM/WLqDmolxKVwK PaIRK288U7yyg0B12VXnOPo+lpWBQbnErad34LFmdi1x3O1X/mVU+wkUaMfGe0Nx0LYh hYbKdSinsuFz8s+jiCXtdpYBC4K4QjjEyZGDVKJrl0vfDaAlYF9AsEBBPTsqsOfynKlc n0JQ==
X-Received: by 10.112.78.39 with SMTP id y7mr29253179lbw.42.1421654513965; Mon, 19 Jan 2015 00:01:53 -0800 (PST)
Received: from buildpc ([82.138.51.4]) by mx.google.com with ESMTPSA id pn7sm2888375lbb.6.2015.01.19.00.01.52 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 19 Jan 2015 00:01:53 -0800 (PST)
Message-ID: <0305AC94D9084D07B34DB45847595AD6@buildpc>
From: Valery Smyslov <svanru@gmail.com>
To: Yoav Nir <ynir.ietf@gmail.com>, ipsec <ipsec@ietf.org>
References: <BB49D854-245F-468E-9BBC-78D51B62ADCA@gmail.com>
Date: Mon, 19 Jan 2015 11:02:31 +0300
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_000_06C2_01D033D7.6BF1AC50"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157
Archived-At: <http://mailarchive.ietf.org/arch/msg/ipsec/pNij4YppH_KDZAFGKYq6Mb8k9Xg>
Subject: Re: [IPsec] Puzzle algorithm negotiation
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: Mon, 19 Jan 2015 08:01:58 -0000

Hi Yoav,
  Pull Request: https://github.com/ietf-ipsecme/drafts/pull/2


  Hi,


  Valery has created this pull request. During the meeting in Honolulu and subsequent discussion on the list, several people requested that there be a negotiation of the algorithm used in the puzzle rather than fixing it to SHA-256.


  The pull request suggests figuring out which algorithms the Initiator supports by examining the SA payload in the IKE_SA_INIT request, and using the PRF algorithms.


  I’m posting this to the list, even thought we’re not sure about this. Specifically, PRF_AES128_XCBC and (I think) PRF_AES128_CMAC won’t work with the bitcoin-like puzzle that is currently in the draft.


  Why?


  For convenience assume a 16-byte cookie, a fixed zero IV (as always in AES-XCBC) and fixed zero key.


  So let Y = AESENC(key, IV XOR COOKIE) = AESENC(zero, COOKIE)
  Let Z = AESDEC(key, zero) = AESDEC(zero, zero)
  Extend the cookie by Y XOR Z.

  The result will give you a 128-bit tag of all zeros. Way too easy.
You forgot about the mandatory 10* padding in AES-XCBC.
So, the result of AESDEC(zero, zero) should not be a random
string, but should look like properly padded one.

But anyway, I think that if we use PRF for puzzles, then the puzzle definition should be changed.

Let R=PRF(K,S). Then the puzzle should be: using supplied cookie as message S,
find a key K so, that result R contains the requested number of trailing zero bits.

I'm not a cryptographer, but I think this variant of puzzle should be secure
for all PRFs, defined in IPsec. Why? First, every secure PRF is a secure MAC 
(not visa versa). This is pointed out by several sources. Then, secure MAC
should not allow attacker to recover a key given the message and
the authentication tag. In our case the authentication tag is not fully given,
but it must have some properties (desired number of trailing zero bits),
so it is not arbitrary.
  Another way to do this is to add a notification in the Initiator’s request listing the hash algorithms that it supports. We could reuse the RFC 7427 registry of hash algorithms. 
I don't think this is a good idea. First, it will require initiator to include 
a list of supported hash algorithms into request message. This will 
unnecessary increase its size in all cases: at this point initiator
has no idea whether responder will ever use puzzles or even
whether it supports them. I think this is a waste of resources,
especially taking into consideration that we may reuse 
information, that is always present in the request message.
  Personally, I really don’t like this algorithm agility, because we don’t want to give the Initiator the options of a hard vs easy puzzle. So suppose the Responder supports two algorithms, SHA-256 and SHA-512, and that the latter is half as fast as the former, then a SHA-512 puzzle would have to have 1 bit less than the SHA-256 puzzle. But in fact, we know that SHA-512 is faster on 64-bit platforms, while SHA-256 is faster on 32-bit platforms. Add some GOST-certified hash to the mix, and the administrator’s task becomes that much harder. 
If the difference in algorithms speeds is significant, then some weights could be
added to algorithm definitions to make the required time to solve puzzle roughly the same
on the same platform.
  OTOH often when a protocol is published without algorithm agility, we end up extending it later.
Exactly.
  Yoav
Regards,
Valery.