Re: [Curdle] Confirming a change to draft-ietf-curdle-rsa-sha2-12

denis bider <denisbider.ietf@gmail.com> Tue, 13 March 2018 07:19 UTC

Return-Path: <denisbider.ietf@gmail.com>
X-Original-To: curdle@ietfa.amsl.com
Delivered-To: curdle@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 72F4212D775 for <curdle@ietfa.amsl.com>; Tue, 13 Mar 2018 00:19:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 VcntXe5mq6XI for <curdle@ietfa.amsl.com>; Tue, 13 Mar 2018 00:19:13 -0700 (PDT)
Received: from mail-qt0-x233.google.com (mail-qt0-x233.google.com [IPv6:2607:f8b0:400d:c0d::233]) (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 B55F412D777 for <curdle@ietf.org>; Tue, 13 Mar 2018 00:19:12 -0700 (PDT)
Received: by mail-qt0-x233.google.com with SMTP id m13so21624184qtg.13 for <curdle@ietf.org>; Tue, 13 Mar 2018 00:19:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=m/cQO7uXusJHCUDGmumF0b9qS0PsvASMREgN4hofVak=; b=PLEPDhXY47sqsK70neN1PusIGSQBO6/83SSqRQgw9kGM1iXrcB4hQ6IedN+btMxWD0 nG6qeOojLgOWPgO947/zIDSSKWb6GcAd+2L3EF1cFhiT+blmVISi51MEUZ6fIr9ARnDy /gNx+3PeWIQdr42jWrQ1EedZIIyT6rq2yOTiIABEIt/+5l9VjGd4C5mfO2h/g36Ttqzd x6AeOFo1336DeRGE0mneg0Uqu9MrCpDy+77yyPw3UYagkqISkGImaPh3aBxMI6h+7yT8 inkhOy5wRz/JOY0kCQjvQB+X2fA2pJgBlRhlMD+Bchy4kdIr5ztunRAGn/nYfwBq7NNz xVFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=m/cQO7uXusJHCUDGmumF0b9qS0PsvASMREgN4hofVak=; b=T88dVAQEEelOvqxjopyg3s1+O1VX+tJCmfHitaGRCrg58Fur8pI9YnE8EU/K934V9Z F60ak9akh/IwftaE5XYTFwFqgHjzdR/fm32gf4quRqKgK9/+2QY6CFxFQj/lFIRFYif3 r3VDSYF+jrSAWt9psalFmUUCDMfmlpXW9kq/DjHON4taXHzf/JYCIJZKIryI3P3TmhHd u98DWwFYulgNH4yWKe5ySaBPJkXtkeMfAqw4QKfWR0znA+BGJLZjnLq2eryUhZgr11w0 vMOT60ZgCn2qBSAX71ePT/E+NgP6m3qF44h8S/fgCCIT4AtvT0whLE1RSKsEbtoOek/Y 8beA==
X-Gm-Message-State: AElRT7HE7hEtY2rjKj4jX5BIeQZi4tvFzBJEsHEtnZvITugKp9TdOH+A aA/PjMLdhP14TIRVG6j/qEMJE70Oe/0tJ8LiYvM=
X-Google-Smtp-Source: AG47ELtdK+58tCUWiBuM99p1XB4O10i1gU4zzbwhVnf5403F2Wa8RNl+C9FuEHKu/vnuM4Ue6MdzvWmKOygt7VWtkWU=
X-Received: by 10.237.49.167 with SMTP id 36mr8671769qth.224.1520925551906; Tue, 13 Mar 2018 00:19:11 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.12.225.71 with HTTP; Tue, 13 Mar 2018 00:19:11 -0700 (PDT)
In-Reply-To: <1520924499970.11406@cs.auckland.ac.nz>
References: <4C40F019-21FB-46AC-95D3-CC94BB976AAB@akamai.com> <12087.1520816187@eng-mail01.juniper.net> <CADPMZDCwRN-GHXhAe=-xPFHMnUBN39UWmENGNUeLbFkneEAgcA@mail.gmail.com> <17856.1520829824@eng-mail01.juniper.net> <CADPMZDBnG1hv5D74vLv2bXqxZjceJgHQ9oYrufKHskLdV7nRSQ@mail.gmail.com> <28093.1520848786@eng-mail01.juniper.net> <40465B0B-FED4-4C16-A5C3-7E2C04E1B666@timeheart.net> <CADPMZDDXi_h1uXzWJy37HXMrogQxJ5+Sd-G7ZZzfZJX_s390TA@mail.gmail.com> <1520924499970.11406@cs.auckland.ac.nz>
From: denis bider <denisbider.ietf@gmail.com>
Date: Tue, 13 Mar 2018 02:19:11 -0500
Message-ID: <CADPMZDBF1bZez7aV=rUoUFyW2t_e7jRuKfz1F8P06ajaawpnDQ@mail.gmail.com>
To: Peter Gutmann <pgut001@cs.auckland.ac.nz>
Cc: Ron Frederick <ronf@timeheart.net>, "Salz, Rich" <rsalz@akamai.com>, "curdle@ietf.org" <curdle@ietf.org>, "Mark D. Baushke" <mdb@juniper.net>
Content-Type: multipart/alternative; boundary="94eb2c0d047c4055e40567461364"
Archived-At: <https://mailarchive.ietf.org/arch/msg/curdle/wFCfD72_DzOe8ggkjE-5WhTsaHM>
Subject: Re: [Curdle] Confirming a change to draft-ietf-curdle-rsa-sha2-12
X-BeenThere: curdle@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "List for discussion of potential new security area wg." <curdle.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/curdle>, <mailto:curdle-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/curdle/>
List-Post: <mailto:curdle@ietf.org>
List-Help: <mailto:curdle-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/curdle>, <mailto:curdle-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Mar 2018 07:19:14 -0000

> My read-integer code accepts leading zeroes and strips them,
> based on implementations that assume e.g. a 1024-bit RSA key
> always produces 128 bytes of output

It does. :)


> and memcpy() the result into a zero-filled 128-byte field.

That's actually the correct encoding according to RFC 8017.


>  I also reject anything that's supposed to be signed where
> the sign bit is set:

That's OK, it relates to mpint fields that aren't the RSA signature though.
The RSA signature is a string, not an mpint, and is unsigned.



On Tue, Mar 13, 2018 at 2:01 AM, Peter Gutmann <pgut001@cs.auckland.ac.nz>
wrote:

> denis bider <denisbider.ietf@gmail.com> writes:
>
> >What I cannot say is how many implementations might ACCEPT a signed
> encoding
> >if it is sent. If they do, I have no idea how many extra zeros such
> >implementations might accept. It might be that there exist implementations
> >(perhaps including ours!) that will accept an arbitrary number of leading
> >zeros.
>
> My read-integer code accepts leading zeroes and strips them, based on
> implementations that assume e.g. a 1024-bit RSA key always produces 128
> bytes
> of output and memcpy() the result into a zero-filled 128-byte field.  I've
> seen stuff like this in the past, in PGP code I think (the read-integer
> code
> is shared across a range of different crypto protocols).
>
> I also reject anything that's supposed to be signed where the sign bit is
> set:
>
>         /* If we're reading a signed integer then the sign bit can't be set
>            since this would produce a negative value.  This differs from
> the
>            ASN.1 code, where the incorrect setting of the sign bit is so
> common
>            that we always treat integers as unsigned */
>
> Peter.
>