Re: [lamps] Fwd: AD Review draft-ietf-lamps-pkix-shake-06

"Panos Kampanakis (pkampana)" <pkampana@cisco.com> Mon, 07 January 2019 16:45 UTC

Return-Path: <pkampana@cisco.com>
X-Original-To: spasm@ietfa.amsl.com
Delivered-To: spasm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 200DA130F33 for <spasm@ietfa.amsl.com>; Mon, 7 Jan 2019 08:45:58 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.501
X-Spam-Level:
X-Spam-Status: No, score=-14.501 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com
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 VYo4jFh3yTGb for <spasm@ietfa.amsl.com>; Mon, 7 Jan 2019 08:45:54 -0800 (PST)
Received: from rcdn-iport-3.cisco.com (rcdn-iport-3.cisco.com [173.37.86.74]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 34126130F29 for <spasm@ietf.org>; Mon, 7 Jan 2019 08:45:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=49898; q=dns/txt; s=iport; t=1546879554; x=1548089154; h=from:to:subject:date:message-id:references:in-reply-to: mime-version; bh=jCYePQ37HrVJxRawP7e+totS7LS81mK4GSi6EIhJTis=; b=PRRTtmjBm812G3VmHwjE/4B3IyF7QFmk0AzX3XFVjaBRG3+HrVbxlH3g jLXyWqJiDdNVnjuBC0ZMxsBR0qdIIm8WCasegbCOLGJJHaHdaP6B5juTo QB1XaKFSUqsDKG45J+Rt0+SFXQewRycOqCGqaNK2J8roIwhDdXaOfj3fo 8=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0ADAAA3gTNc/5ldJa1ZChkBAQEBAQEBAQEBAQEHAQEBAQEBgVEEAQEBAQELAYENSC5mgQInCoN1iBqLaIINl24UgWcLAQElhEcCF4FtIjQJDQEDAQECAQECbRwMhUoBAQEEGgkKXAIBCA4DAwEBASEBBgMCAgIwFAkIAgQBEgiDG4EdZA+mO4EvhC0BhXIFjD8XgUA/gRGDEoMeAoEuAQcFBgEDBDgWglKCVwKJLhIShX6GYYpRWgkChxKDR4cOIIFgkA+JYoEHg36IHoMRAhEUgScfOGVxcBWDJ4IkAgEXg0uEWYV6QTEBiDUOF4EIgR8BAQ
X-IronPort-AV: E=Sophos;i="5.56,451,1539648000"; d="scan'208,217";a="492482197"
Received: from rcdn-core-2.cisco.com ([173.37.93.153]) by rcdn-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2019 16:45:52 +0000
Received: from XCH-ALN-008.cisco.com (xch-aln-008.cisco.com [173.36.7.18]) by rcdn-core-2.cisco.com (8.15.2/8.15.2) with ESMTPS id x07Gjqqf017598 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 7 Jan 2019 16:45:52 GMT
Received: from xch-aln-010.cisco.com (173.36.7.20) by XCH-ALN-008.cisco.com (173.36.7.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 7 Jan 2019 10:45:51 -0600
Received: from xch-aln-010.cisco.com ([173.36.7.20]) by XCH-ALN-010.cisco.com ([173.36.7.20]) with mapi id 15.00.1395.000; Mon, 7 Jan 2019 10:45:51 -0600
From: "Panos Kampanakis (pkampana)" <pkampana@cisco.com>
To: Eric Rescorla <ekr@rtfm.com>, SPASM <spasm@ietf.org>
Thread-Topic: [lamps] Fwd: AD Review draft-ietf-lamps-pkix-shake-06
Thread-Index: AQHUmgTKsLAvzBG4c0a2PWEHEqiUIqWhCj1Q
Date: Mon, 07 Jan 2019 16:45:51 +0000
Message-ID: <673fc2acc8394b83961f5d8639a2bfc9@XCH-ALN-010.cisco.com>
References: <CABcZeBOFSzThHtOeDc_oYDbNd-zL4G2T7Z7dNZKicNgetGoz0A@mail.gmail.com> <CABcZeBNDFHghOt8k3GUfPN8i63vUA1-2H2KfCK3nB8ykJCjxSw@mail.gmail.com>
In-Reply-To: <CABcZeBNDFHghOt8k3GUfPN8i63vUA1-2H2KfCK3nB8ykJCjxSw@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.82.250.174]
Content-Type: multipart/alternative; boundary="_000_673fc2acc8394b83961f5d8639a2bfc9XCHALN010ciscocom_"
MIME-Version: 1.0
X-Outbound-SMTP-Client: 173.36.7.18, xch-aln-008.cisco.com
X-Outbound-Node: rcdn-core-2.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/CaYLYe8z-be7zIE_MYXpkgTzLys>
Subject: Re: [lamps] Fwd: AD Review draft-ietf-lamps-pkix-shake-06
X-BeenThere: spasm@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "This is a venue for discussion of doing Some Pkix And SMime \(spasm\) work." <spasm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/spasm>, <mailto:spasm-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/spasm/>
List-Post: <mailto:spasm@ietf.org>
List-Help: <mailto:spasm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/spasm>, <mailto:spasm-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 07 Jan 2019 16:45:58 -0000

Hi Eric,

Thank you for the thorough review. It is appreciated.
All addressed. More details are below in this email inline. Search for pk>

I also added you in the acknowledgements. The updated draft is here https://github.com/csosto-pk/adding-shake-to-pkix/blob/master/draft-ietf-lamps-pkix-shake-current.txt

Let me know if there is further feedback.

Rgs,
Panos


From: Spasm <spasm-bounces@ietf.org<mailto:spasm-bounces@ietf.org>> On Behalf Of Eric Rescorla
Sent: Saturday, December 22, 2018 9:43 AM
To: SPASM <spasm@ietf.org<mailto:spasm@ietf.org>>
Subject: [lamps] Fwd: AD Review draft-ietf-lamps-pkix-shake-06

CCing the WG because I was wrong about the aliases.
---------- Forwarded message ---------
From: Eric Rescorla <ekr@rtfm.com<mailto:ekr@rtfm.com>>
Date: Fri, Dec 21, 2018 at 4:11 PM
Subject: AD Review draft-ietf-lamps-pkix-shake-06
To: <draft-ietf-lamps-pkix-shake@ietf.org<mailto:draft-ietf-lamps-pkix-shake@ietf.org>>

Rich version of this review at:
https://mozphab-ietf.devsvcdev.mozaws.net/D4946


IMPORTANT
S 5.1.2.
>      [SEC1] if they have a stated policy that requires conformance to
>      these standards.  These standards may have not specified SHAKE128 and
>      SHAKE256 as hash algorithm options.  However, SHAKE128 and SHAKE256
>      with output length being 32 and 64 octets respectively are
>      subtitutions for 256 and 512-bit output hash algorithms such as
>      SHA256 and SHA512 used in the standards.

I'm not sure why you are requiring deterministic ECDSA with SHAKE. Is
there any specific reason why it's more important there than with
other hashes.

pk> It is not specific to SHAKE. We just wanted to recommend deterministic ECDSA just in case k is not “random enough”. To avoid confusion I renamed the subsection “ECDSA signatures” and rephrased the paragraph to say
“It is RECOMMENDED that conforming CA implementations that generate ECDSA
                          with SHAKE signatures in certificates or CRLs generate such signatures
                          with a deterministically generated, non-random k in accordance
                          with all the requirements specified in”


S 5.2.
>      and CRLs.  Conforming client implementations that process RSASSA-PSS
>      or ECDSA with SHAKE public key when processing certificates and CRLs
>      MUST recognize the corresponding OIDs.  The conventions and encoding
>      for RSASSA-PSS and ECDSA public keys algorithm identifiers are as
>      specified in Section 2.3 of [RFC3279], Section 3.1 of [RFC4055] and
>      Section 2.1 of [RFC5480].

This is going to be a major disincentive to use SHAKE. If you don't
know what the verifier will support, you're going to want to use
RSAEncryption, but then this says you can't use SHAKE.

pk> You are right, but this is allowed. I updated section 5.2 to reflect that. More on the text I added is below in response your ther rsaEncryption comment.


COMMENTS
S 2.
>      In the SHA-3 family, two extendable-output functions (SHAKEs),
>      SHAKE128 and SHAKE256, are defined.  Four other hash function
>      instances, SHA3-224, SHA3-256, SHA3-384, and SHA3-512 are also
>      defined but are out of scope for this document.  A SHAKE is a
>      variable length hash function.  The output length, in bits, of a
>      SHAKE is defined by the d parameter.  The corresponding collision and

This is the first mention of d. I think you mean something like "A
SHAKE is defined as a function SHAKE(M, d) where the output is a
digest of message M that is d bits long)"

pk> Fixed. “A SHAKE is a variable length hash function defined as SHAKE(M, d) where the
              output is a d-bits long digest of message M. The corresponding collision”

S 4.
>      capitals, as shown here.
>
>   4.  Identifiers
>
>      This section defines four new OIDs for RSASSA-PSS and ECDSA when
>      SHAKE128 and SHAKE256 are used.  The same algorithm identifiers are

This is a little unclear. I think you mean "four new OIDs, for RSASSA-
PSS and ECDSA with each of SHAKE-128 and SHAKE-256"

pk> Fixed.

S 4.
>      for each use of SHAKE128 or SHAKE256 in RSASSA-PSS and ECDSA.  In
>      summary, when hashing messages to be signed, output lengths of
>      SHAKE128 and SHAKE256 are 256 and 512 bits respectively.  When the
>      SHAKEs are used as mask generation functions RSASSA-PSS, their output
>      length is (n - 264) or (n - 520) bits respectively, where n is a RSA
>      modulus size in bits.

"n is the RSA modulus size in bits"

pk> Fixed.

S 5.1.
>   5.1.  Signatures
>
>      Signatures can be placed in a number of different ASN.1 structures.
>      The top level structure for an X.509 certificate, to illustrate how
>      signatures are frequently encoded with an algorithm identifier and a
>      location for the signature, is

This sentence is ungrammatical

pk> Fixed. Rephrased to “In an X.509 certificate a signature is encoded with an
                        algorithm identifier in the signatureAlgorithm attribute and
                        a signatureValue that contains the actual signature.”


S 5.1.
>            signatureValue       BIT STRING  }
>
>      The identifiers defined in Section 4 can be used as the
>      AlgorithmIdentifier in the signatureAlgorithm field in the sequence
>      Certificate and the signature field in the sequence tbsCertificate in
>      X.509 [RFC5280].

What goes in "parameters"?

pk> Fixed. Added text “The parameters of these signature algorithms are absent as explained
                        in Section 4.”


S 5.1.
>      ECDSA with SHAKE signatures in certificates and CRLs.  Conforming
>      client implementations that process RSASSA-PSS or ECDSA with SHAKE
>      signatures when processing certificates and CRLs MUST recognize the
>      corresponding OIDs.  Encoding rules for RSASSA-PSS and ECDSA
>      signature values are specified in [RFC4055] and [RFC5480]
>      respectively.

Is it forbidden to verify RSAPSSA/SHAKE signatures with RSAEncryption
in the cert? I expect not.

pk> It is allowed to use rsaEncryption public key with an RSASSA-PSS signature. I updated section 5.2 to reflect that. It now says “Traditionally, the rsaEncryption object identifier is used to
   identify RSA public keys.  The rsaEncryption object identifier
   continues to identify the subject public key when the RSA private key
   owner does not wish to limit the use of the public key exclusively to
   RSASSA-PSS with SHAKEs.  When the RSA private key owner wishes to
   limit the use of the public key exclusively to RSASSA-PSS with
   SHAKEs, the AlgorithmIdentifiers for RSASSA-PSS defined in Section 4
   SHOULD be used as the algorithm field in the SubjectPublicKeyInfo
   sequence [RFC5280].  Conforming client implementations that process
   RSASSA-PSS ECDSA with SHAKE public keys when processing certificates
   and CRLs MUST recognize the corresponding OIDs.”


S 5.1.1.
>      seed from which mask is generated, an octet string [RFC8017].  The
>      output length is (n - 264)/8 or (n - 520)/8 bytes respectively, where
>      n is the RSA modulus in bits.  For example, when RSA modulus n is
>      2048, the output length of SHAKE128 or SHAKE256 as the MGF will be
>      223 or 191-bits when id-RSASSA-PSS-SHAKE128 or id-RSASSA-PSS-SHAKE256
>      is used respectively.

I think you are mixing bits and bytes here, because 2048 - 264 != 223.

It would also be helpful to explain what's going on here, by
explaining how these values are computed.

pk> Fixed. Rephrased as “As
   explained in Step 9 of section 9.1.1 of [RFC8017], the output length
   of the MGF is emLen - hLen - 1 bytes. emLen is the maximum message
   length ceil((n-1)/8), where n is the RSA modulus in bits. hLen is 32
   and 64-bytes for id-RSASSA-PSS-SHAKE128 and id-RSASSA-PSS-SHAKE256
   respectively.  Thus when SHAKE is used as the MGF, the SHAKE output
   length maskLen is (n - 264) or (n - 520) bits respectively.  For
   example, when RSA modulus n is 2048, the output length of SHAKE128 or
   SHAKE256 as the MGF will be 1784 or 1528-bits when id-RSASSA-PSS-
   SHAKE128 or id-RSASSA-PSS-SHAKE256 is used respectively.”


S 5.1.2.
>      [X9.62].  When the id-ecdsa-with-SHAKE128 or id-ecdsa-with-SHAKE256
>      (specified in Section 4) algorithm identifier appears, the respective
>      SHAKE function (SHAKE128 or SHAKE256) is used as the hash.  The
>      encoding MUST omit the parameters field.  That is, the
>      AlgorithmIdentifier SHALL be a SEQUENCE of one component, the OID id-
>      ecdsa-with-SHAKE128 or id-ecdsa-with-SHAKE256.

Shouldn't we be requiring that the hash match the size of the curve.

pk> Hmmm, good point. Since the hash sizes are pre-decided by the OID I would say the curve should be chosen in line with the OID. In order to make recommendations I added a paragraph in the Security Considerations saying
“  When using ECDSA with SHAKEs, the ECDSA curve order SHOULD be
   chosen in line with the SHAKE output length.  NIST has defined
   appropriate use of the hash functions in terms of the algorithm
   strengths and expected time frames for secure use in Special
   Publications (SPs) [SP800-78-4] and [SP800-107].  These documents can
   be used as guides to choose appropriate key sizes for various
   security scenarios.  In the context of this document id-ecdsa-with-
   shake128 is RECOMMENDED for curves with group order of 256-bits. id-
   ecdsa-with-shake256 is RECOMMENDED for curves with group order of
   384-bits or more.”

S 5.2.
>      key exclusively to RSASSA-PSS, the AlgorithmIdentifiers for RSASSA-
>      PSS defined in Section 4 can be used as the algorithm field in the
>      SubjectPublicKeyInfo sequence [RFC5280].  The identifier parameters,
>      as explained in section Section 4, MUST be absent.  The RSASSA-PSS
>      algorithm functions and output lengths are the same as defined in
>      Section 5.1.1.

I must be missing something. what does this text refer to, given the
text above about what's in the certificate.

pk> This paragraph is similar to a paragraph used in RFC4055. It tries to point out that the public key can still be rsaEncryption. But if someone wants to just use this key for RSASSA-PSS he can use the RSASSA-PSS identifiers. As also mentioned in a comment above, I rephrased the paragraph a bit to make it more intuitive
“Traditionally, the rsaEncryption object identifier is used to
   identify RSA public keys.  The rsaEncryption object identifier
   continues to identify the subject public key when the RSA private key
   owner does not wish to limit the use of the public key exclusively to
   RSASSA-PSS with SHAKEs.  When the RSA private key owner wishes to
   limit the use of the public key exclusively to RSASSA-PSS with
   SHAKEs, the AlgorithmIdentifiers for RSASSA-PSS defined in Section 4
   SHOULD be used as the algorithm field in the SubjectPublicKeyInfo
   sequence [RFC5280].  Conforming client implementations that process
   RSASSA-PSS ECDSA with SHAKE public keys when processing certificates
   and CRLs MUST recognize the corresponding OIDs.”

S 7.
>      of the longer one.  It is a similar situation as truncating a 512-bit
>      output of SHA-512 by taking its 256 left-most bits.  These 256 left-
>      most bits are a prefix of the 512-bit output.
>
>      Implementations must protect the signer's private key.  Compromise of
>      the signer's private key permits masquerade attacks.

This seems unnecessary

pk> Fixed, removed.

S 7.
>      computing power increases, the work factor or time required to break
>      a particular cryptographic algorithm may decrease.  Therefore,
>      cryptographic algorithm implementations should be modular allowing
>      new algorithms to be readily inserted.  That is, implementers should
>      be prepared to regularly update the set of algorithms in their
>      implementations.

This also seems unnecessary.

pk> Fixed, removed.