Re: [TLS] Diffie-Hellman: value of Z - the shared secret - without leading zero octets

Bill Cox <waywardgeek@google.com> Mon, 28 March 2016 16:07 UTC

Return-Path: <waywardgeek@google.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A5EF812DB5F for <tls@ietfa.amsl.com>; Mon, 28 Mar 2016 09:07:18 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.71
X-Spam-Level:
X-Spam-Status: No, score=-2.71 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.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 RM03UlDAoZQN for <tls@ietfa.amsl.com>; Mon, 28 Mar 2016 09:07:16 -0700 (PDT)
Received: from mail-vk0-x235.google.com (mail-vk0-x235.google.com [IPv6:2607:f8b0:400c:c05::235]) (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 0AC1912DA42 for <tls@ietf.org>; Mon, 28 Mar 2016 09:07:11 -0700 (PDT)
Received: by mail-vk0-x235.google.com with SMTP id e185so161078511vkb.1 for <tls@ietf.org>; Mon, 28 Mar 2016 09:07:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=ljBKqMDvGxtaS8FIkaN20Vtl5x4wynXrZh5WvZRw9to=; b=DzCfWnvshxL6n+Q0JfVj2etCAGy/S47Y4SkLUdVFK+LiCUN2wcQTxUZoOYPNvJvMMw CHrs0IgILEpHu0n6iqjC+SXl+bG61MWHX8cSKPkvtR/8ufGolxmxFgVcbe+81O24o6GS NbYqQEnLinbyyLEruzXogMGPmDPcdyCSW0MlXzO0/eTsI7yvqQ3lFeujvm0djf1z6ted VEDpcYcsuavkLcXceRw7mvvXL2CMatavRycO1Bv2E60R0EgR2UxNAT4OqqsSci31kJ95 VjwX52w5TlMAE8RV9mBTtRdmBGihbZ9wD4qt1qekV6kBmsGRav8nDbXWo0eUTXArOsRt ZHkw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=ljBKqMDvGxtaS8FIkaN20Vtl5x4wynXrZh5WvZRw9to=; b=gvnw0Vidw0GWffK+2xQH7TVHgP9omphpAivXm6TsclSdJtREpe46d3uLflMnaVvwoF /zpqesSwflt5YWeGJnRvlAomiz829wcEEnxINdQDcOFrql0ruuqDKwH0v1OBrwE/oFfT huhspi6XEUEc5HNL2Pq9QWxGpPGyGR7NFqoph3rXEDh8Zy/ZTrHzTJvUqb0Q6yHcihVy VeB8STM6VcFYlXh/jtEFQjeH56LxGn3vlGuIM+qToJh5Z5IW/2onxmkqX48CORquUdhw 8enOwfkEFt5LWYIoy4bHJk96zBBDLByFY6N08VMbH6UWzWcWbqDFo10ACwwp9D5OLg0i ZRlw==
X-Gm-Message-State: AD7BkJK9MQJB9H0GgYxKGTfDsdnGS+VekRlW0hJUfuxFQ7IUCTkx0egrlFfmdTBiX2+QN8c3U3iK16mQj+mQnGqP
MIME-Version: 1.0
X-Received: by 10.159.37.242 with SMTP id 105mr15264138uaf.27.1459181229826; Mon, 28 Mar 2016 09:07:09 -0700 (PDT)
Received: by 10.31.179.1 with HTTP; Mon, 28 Mar 2016 09:07:09 -0700 (PDT)
In-Reply-To: <CADwHJ+9XCpEDtX6vE+TQXKwz1MEhXHkj5Xbua6vAY_03Q=6LDA@mail.gmail.com>
References: <CADwHJ+9XCpEDtX6vE+TQXKwz1MEhXHkj5Xbua6vAY_03Q=6LDA@mail.gmail.com>
Date: Mon, 28 Mar 2016 09:07:09 -0700
Message-ID: <CAH9QtQHAYPUpm7GAj9_NPNmg0ca9NXy2vNoq0wJMBYW_1S-S0g@mail.gmail.com>
From: Bill Cox <waywardgeek@google.com>
To: Maarten Bodewes <maarten.bodewes@gmail.com>
Content-Type: multipart/alternative; boundary="001a113ac86adeeaa7052f1e1a0c"
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/zBxcNLrxniFn2YPg9zx390iMl3c>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] Diffie-Hellman: value of Z - the shared secret - without leading zero octets
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 28 Mar 2016 16:07:18 -0000

I spent 2 weeks last year tracking down a flaky bug that only occurs once
in every 256 connection: the leading 0 byte was no longer being stripped in
a code change I ported from OpenSSL master, and only Maria DB ran random
tests enough to trigger this condition.

I guess I would prefer that this particular weird goober in TLS would go
away, but it would be incompatible.

Bill

On Mon, Mar 28, 2016 at 8:56 AM, Maarten Bodewes <maarten.bodewes@gmail.com>
wrote:

> Hi all,
>
> I see that the leading zero is stripped off of the value of Z (the shared
> secret) before it is used as input to HKDF. This seems to be compatible
> with TLS 1.2. Then again, it is not compatible with e.g. NISP800-56A which
> uses the value of Z with the same size of the prime in octets. Furthermore,
> it is also different with regards to handling the coordinate X as used in
> ECDH.
>
> Was this a conscious decision to keep compatibility with TLS? Has the use
> of the value of Z including zero octets been considered?
>
> Regards,
> Maarten
>
> _______________________________________________
> TLS mailing list
> TLS@ietf.org
> https://www.ietf.org/mailman/listinfo/tls
>
>