Re: [TLS] Twist security for brainpoolp256r1

Johannes Merkle <johannes.merkle@secunet.com> Wed, 12 November 2014 14:57 UTC

Return-Path: <Johannes.Merkle@secunet.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D3E3C1A019B for <tls@ietfa.amsl.com>; Wed, 12 Nov 2014 06:57:05 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.194
X-Spam-Level:
X-Spam-Status: No, score=-3.194 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-0.594] 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 NjUcK7nUqu7Q for <tls@ietfa.amsl.com>; Wed, 12 Nov 2014 06:57:03 -0800 (PST)
Received: from a.mx.secunet.com (a.mx.secunet.com [195.81.216.161]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E15601A024C for <tls@ietf.org>; Wed, 12 Nov 2014 06:57:02 -0800 (PST)
Received: from localhost (alg1 [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id B9FA61A007F; Wed, 12 Nov 2014 15:56:54 +0100 (CET)
X-Virus-Scanned: by secunet
Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bWUzEHVH7ZOv; Wed, 12 Nov 2014 15:56:49 +0100 (CET)
Received: from mail-essen-01.secunet.de (unknown [10.53.40.204]) by a.mx.secunet.com (Postfix) with ESMTP id C3A191A007E; Wed, 12 Nov 2014 15:56:49 +0100 (CET)
Received: from [10.208.1.76] (10.208.1.76) by mail-essen-01.secunet.de (10.53.40.204) with Microsoft SMTP Server (TLS) id 14.3.210.2; Wed, 12 Nov 2014 15:56:56 +0100
Message-ID: <54637537.2010408@secunet.com>
Date: Wed, 12 Nov 2014 15:56:55 +0100
From: Johannes Merkle <johannes.merkle@secunet.com>
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
MIME-Version: 1.0
To: Oleg Gryb <oleg@gryb.info>, "tls@ietf.org" <tls@ietf.org>
References: <54625A39.70700@secunet.com> <1437313076.601391.1415736676771.JavaMail.yahoo@jws106117.mail.bf1.yahoo.com>
In-Reply-To: <1437313076.601391.1415736676771.JavaMail.yahoo@jws106117.mail.bf1.yahoo.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
X-Originating-IP: [10.208.1.76]
X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10
Archived-At: http://mailarchive.ietf.org/arch/msg/tls/fP3tDQcj5TBLoyQFRb8-8T4SUkw
Subject: Re: [TLS] Twist security for brainpoolp256r1
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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: Wed, 12 Nov 2014 14:57:06 -0000

>>>  I was going through SafeCurves pages recently and wanted to ask a question 
>> about brainpoolP256r1's twist security.
>>>  According to this research http://safecurves.cr.yp.to/twist.html,, 
>> <http://safecurves.cr.yp.to/twist.html>  a combined
>>>  cost of attacks on brainpoolP256t1, which is a P256r1's 
>> "twist" is rather low. At the same time it's obvious that
>>>  small-group-attack is not applicable, because "h=1" is a 
>> requirement for all brainpool curves including the one under
>>>  consideration.
>>
>> This is a misunderstanding. The term "twist security" refers to 
>> non-quadratic twists (B/u)y^2=x^3+Ax^2+x, where u is a
>> non-square in F_p. RFC 5639 considers "quadratic twist", where u is a 
>> square in F_p. Quadratic twists are isomorphic to
>> the original curve and provide equivalent security. Therefore, brainpoolP256t1 
>> is as secure as brainpoolP256r1. In
>> contrast, the non-quadratic twists of brainpoolP256r1 are not secure, because 
>> their group order does not have a large
> 
>> enough prime factor, i.e., the cofactor is huge.
> 
> Thanks for explaining all that, but I just want to clarify it a bit further.
> 
> What 2^44 means for the brainpoolP256t1 in DJB table?
> 
> brainpoolP256t1 False 2^44.5
> 
> Is it related to non-quadratic twists only, derived either from brainpoolP256r1 or brainpoolP256t1?

As Manuel has explained its the security level of the non-quadratic twist. It is NOT the security of the quadratic
twists, which is the same as of the original brainpoolP256r1.

Background: All quadratic twists are isomorphic (equivalent) to each other. And each quadratic twist (i.e.
brainpoolP256t1 and brainpoolP256r1) has the same set of non-quadratic twists, which are also all equivalent to each
other (they are quadratic twists of each other). So we have two sets of curves: The quadratic twists of brainpoolP256r1
(which contains brainpoolP256t1) and the set of non-quadratic twists of brainpoolP256r1. Any curve from the former set
(including brainpoolP256t1) is as secure as brainpoolP256r1. And any curve from the second set (the non-quadratic
twists) have a group order that factors to moderately sized primes and are, thus, insecure.  But nobody would use the
non-quadratic twists, except potentially in an invalid-curve attack.


> In other words, I don't need to be concerned about "invalid-curve" attacks in any of openssl's ECC implementations, right?

If openssl uses a proper ECC implementation, yes. If not, you're in trouble anyway.


> The last question that I have is related to brainpool curves implementations in openssl. It looks like they are available only in version 1.0.2, which is a beta now and I would be hesitant to use beta in any production deployments, so what I tried was backporting the brainpoolP256r1 only from 1.0.2 to the latest stable 1.0.1j and it worked perfectly well. I was even able to statically compile my backported version with some open source web application servers, configured brainpoolP256r1 as a defualt and didn't see any problems with that.
> 
> My qs is - can you envision any other problems with this "backporting" approach? One thing that I was thinking about was a possible performance impact if there is any barinpool's specific optimization in 1.0.2. I've seen some signs of EC arithmentic's optimization for NIST P-256 in the latest stable version, but I didn't find anything like that for brainpool curves.    

My guess (and its nothing more than a guess) is that they just added the parameters and did not change the
implementation. If this holds true, your approach should work, provided that you properly transferred all relevant
parameters and identifiers.

But this is something, you need to confirm with the openssl developers.


-- 
Viele Grüße,
Johannes