Return-Path: <ndurner@googlemail.com>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1])
 by ietfa.amsl.com (Postfix) with ESMTP id 0ADC51A88F3
 for <openpgp@ietfa.amsl.com>; Sun, 18 Oct 2015 07:20:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.101
X-Spam-Level: 
X-Spam-Status: No, score=-0.101 tagged_above=-999 required=5
 tests=[BAYES_40=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, SPF_PASS=-0.001]
 autolearn=ham
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 3rZYW4rdkZCv for <openpgp@ietfa.amsl.com>;
 Sun, 18 Oct 2015 07:20:08 -0700 (PDT)
Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com
 [IPv6:2a00:1450:400c:c05::22a])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by ietfa.amsl.com (Postfix) with ESMTPS id 88ADA1A88ED
 for <openpgp@ietf.org>; Sun, 18 Oct 2015 07:20:08 -0700 (PDT)
Received: by wijp11 with SMTP id p11so66601203wij.0
 for <openpgp@ietf.org>; Sun, 18 Oct 2015 07:20:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=googlemail.com; s=20120113;
 h=from:to:subject:message-id:date:user-agent:mime-version
 :content-type; bh=LXUPrX3xY08jlNhhY2WKl/5EpZ159n+BLlk89aetzjo=;
 b=Ay5iUmroPE0EXHKX2sdfr2vYU4gT1iELooyJTjhkoc3EbcE4laKHsaZE32WuTs+xEq
 2ktEdI+ZxH+JStOgFlzsjftByJw2WbcCocDiGjHEk16q8tJzvwtPIDr8MGDbY0ApbSgf
 /dPx6Cn/hU/uVS3Ow4jdqnMrbaj3pb45e5OyxTehkGBQS3J14Er29cpyWXJZzvp4+dO1
 8g9G28vDypnDGcsH7Rvit2S3oPI/vQoIcXs1zKx60haz50fkwHOpqn0oefFd8XpR8Dym
 864mT/XrivzQzttoX1WZGLzDs7wf3TqgprdOvAtjSm1mkCVKpDNOQ+YahrHFPzykHI0u
 rTdA==
X-Received: by 10.195.11.40 with SMTP id ef8mr28144512wjd.103.1445178007071;
 Sun, 18 Oct 2015 07:20:07 -0700 (PDT)
Received: from [192.168.188.46] (x4db106c5.dyn.telefonica.de. [77.177.6.197])
 by smtp.googlemail.com with ESMTPSA id
 jj8sm11128569wid.2.2015.10.18.07.20.05 for <openpgp@ietf.org>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 18 Oct 2015 07:20:06 -0700 (PDT)
From: Nils Durner <ndurner@googlemail.com>
X-Enigmail-Draft-Status: N1110
To: "openpgp@ietf.org" <openpgp@ietf.org>
Message-ID: <5623AA95.4060903@googlemail.com>
Date: Sun, 18 Oct 2015 16:20:05 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
 Thunderbird/38.3.0
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------000008040907080307050501"
Archived-At: <http://mailarchive.ietf.org/arch/msg/openpgp/IORjkQR17EURj9HQaKCqoQ2TKkI>
Subject: [openpgp] [PATCH] RFC4880bis: Argon2i
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>,
 <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>,
 <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 18 Oct 2015 14:20:11 -0000

This is a multi-part message in MIME format.
--------------000008040907080307050501
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

attached is a patch against RFC 4880bis in
git://git.gnupg.org/gnupg-doc.git to include Argon2i as an S2K method.

Notes:

  * I have made room for 256-bit nonces. The Argon2 paper[0] recommends
    16 byte nonces for password hashing with a maximum length of 2^32-1.
    My reason for this is to make the nonce size equal to the AES-256
    key size so that we enjoy full key strength without relying on the
    password to contribute any entropy at all.
  * What do others think about the RECOMMENDATION of a parallelism
    degree of 1? Are use-cases known where hosts are unable to do
    multi-threading (well)?
  * Argon2 is not final yet, as far as I understand. The reference to it
    in template.xml should be checked/updated once it is.
      o Is Cryptolux.org considered a stable location to link to?
  * Private keys now MUST be protected using a salted S2K scheme

Looking at http://wiki.gnupg.org/rfc4880bis, HKDF should be removed from
the S2K candidates. From the HKDF paper[1]:

> typical PBKDFs [...] use [...] salt [...] and (ii) the slowing down of
> the KDF operation [...] This makes PBKDFs very different than the
> general-purpose KDFs studied here. In particular, while passwords can
> be modeled as a source of keying material, this source has too little
> entropy to meaningfully apply our extractor approach
So it cannot be used directly and the changes required to make it a
suitable PBKDF would replicate the work done for the Password Hashing
Competition[2] which selected Argon2 as the basis for its winner[3].


Regards,

Nils


[0] https://www.cryptolux.org/images/0/0d/Argon2.pdf
[1] https://password-hashing.net/
[2] https://groups.google.com/forum/#!topic/crypto-competitions/3QNdmwBS9=
8o


--------------000008040907080307050501
Content-Type: text/x-patch;
 name="rfc4880bis-argon2.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="rfc4880bis-argon2.diff"

diff --git a/misc/id/rfc4880bis/middle.mkd b/misc/id/rfc4880bis/middle.mk=
d
index 80c0a61..97c506a 100644
--- a/misc/id/rfc4880bis/middle.mkd
+++ b/misc/id/rfc4880bis/middle.mkd
@@ -256,6 +256,7 @@ reserved values:
            1  Salted S2K
            2  Reserved value
            3  Iterated and Salted S2K
+           4  Argon2i
   100 to 110  Private/Experimental S2K
=20
 These are described in the following Sections.
@@ -340,11 +341,50 @@ even though that is greater than the octet count.  =
After the hashing is
 done, the data is unloaded from the hash context(s) as with the other
 S2K algorithms.
=20
+#### {3.7.1.4} Argon2i
+
+This employs the password derivation scheme Argon2, which is memory-hard=

+and resilient against side-channel and trade-off attacks.
+
+       Octet  0:        0x04
+       Octets 1-33:     32-octet salt
+       Octet 34:        one-octet parallelism value
+       Octets 35-39:    4-octet memory size value
+       Octets 40-44:    4-octet iteration count
+
+The salt value corresponds to the nonce parameter of Argon2. The
+parallelism value determines how many computational chains (threads) can=

+be run. A parallelism degree of 1 is RECOMMENDED. The memory size value
+is the number of kilobytes of memory to be used when deriving the
+password. This value MUST at least be 8 * parallelism degree. The
+iteration account specifies the number of passes over memory. To protect=

+against trade-off attacks, 3 iterations are RECOMMENDED.
+
+Other secondary inputs to Argon2 are not used: secret key K and
+associated data X MUST be passed with 0-octet length to Argon2.
+The tag length parameter to Argon2 that describes the length of the
+derived symmetric key MUST be equal to the key size of the symmetric
+cipher to be used. The version parameter v MUST be set to 0x10, the
+type parameter y to 1, thus specifying that the Argon2i variant is to be=

+used.
+
+##### {3.7.1.4.1} NON-NORMATIVE NOTES
+Implementations can improve memory bandwidth usage by choosing larger
+parallelism degrees than 1. The number of memory blocks to be used in
+Argon2 is internally rounded down to the nearest multiple of
+4 * parallelism degree. The iteration count can be used to tune running
+time independently of the memory size.
+
 ### {3.7.2} String-to-Key Usage
=20
-Implementations SHOULD use salted or iterated-and-salted S2K
-specifiers, as simple S2K specifiers are more vulnerable to dictionary
-attacks.
+Implementations MUST generate S2K specifiers that include salts
+(either type 2, 3 or 4), as simple S2K specifiers are more vulnerable to=

+dictionary attacks. Use of Argon2i is RECOMMENDED as it offers
+protection against massive-parallel and side-channel attacks. When
+reading S2K specifiers that do not include salts, implementations SHOULD=

+issue a warning about potentially insecure methods being used. When
+reading S2K specifiers other than Argon2i, implementations SHOULD issue
+a warning about outdated methods being used.
=20
 #### {3.7.2.1} Secret-Key Encryption
=20
@@ -1646,9 +1686,9 @@ following Symmetrically Encrypted Data packet, foll=
owed by the session
 key octets themselves.
=20
 Note: because an all-zero IV is used for this decryption, the S2K
-specifier MUST use a salt value, either a Salted S2K or an
-Iterated-Salted S2K.  The salt value will ensure that the decryption
-key is not repeated even if the passphrase is reused.
+specifier MUST use a salt value, either S2K types 1, 3 or 4.
+The salt value will ensure that the decryption key is not repeated even
+if the passphrase is reused.
=20
 ## {5.4} One-Pass Signature Packets (Tag 4)
=20
@@ -4120,8 +4160,7 @@ SHOULD be rejected.
     MDC MUST be used when a symmetric encryption key is protected by
     ECDH.  None of the ECC methods described in this document are
     allowed with deprecated V3 keys.  A compliant application MUST only
-    use iterated and salted S2K to protect private keys, as defined in
-    Section 3.7.1.3{FIXME}, "Iterated and Salted S2K".
+    use S2K schemes that make use of salts to protect private keys.
=20
     Side channel attacks are a concern when a compliant application's
     use of the OpenPGP format can be modeled by a decryption or signing
diff --git a/misc/id/rfc4880bis/template.xml b/misc/id/rfc4880bis/templat=
e.xml
index 82cfd27..a2a86a0 100644
--- a/misc/id/rfc4880bis/template.xml
+++ b/misc/id/rfc4880bis/template.xml
@@ -94,6 +94,16 @@
         <date year=3D'2001' month=3D'November'/>
         </front>
       </reference>
+      <reference anchor=3D'Argon2i'
+     target=3D'https://www.cryptolux.org/images/0/0d/Argon2.pdf'>
+        <front>
+        <title>Argon2: the memory-hard function for password hashing and=
 other applications</title>
+        <author surname=3D"Biryukov" initials=3D"A." />
+        <author surname=3D"Dinu" initials=3D"D." />
+        <author surname=3D"Khovratovich" initials=3D"D." />
+        <date year=3D'2015' month=3D'October'/>
+        </front>
+      </reference>     =20
       <reference anchor=3D'BLOWFISH'
                  target=3D'http://www.counterpane.com/bfsverlag.html'>
         <front>

--------------000008040907080307050501--

