From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1VAIGt-0001Fm-0q for bitcoin-development@lists.sourceforge.net; Fri, 16 Aug 2013 11:32:47 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.219.46 as permitted sender) client-ip=209.85.219.46; envelope-from=mh.in.england@gmail.com; helo=mail-oa0-f46.google.com; Received: from mail-oa0-f46.google.com ([209.85.219.46]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1VAIGr-0003sb-DQ for bitcoin-development@lists.sourceforge.net; Fri, 16 Aug 2013 11:32:46 +0000 Received: by mail-oa0-f46.google.com with SMTP id l10so2108390oag.33 for ; Fri, 16 Aug 2013 04:32:40 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.93.67 with SMTP id cs3mr942778oeb.12.1376652759949; Fri, 16 Aug 2013 04:32:39 -0700 (PDT) Sender: mh.in.england@gmail.com Received: by 10.76.80.165 with HTTP; Fri, 16 Aug 2013 04:32:39 -0700 (PDT) In-Reply-To: References: Date: Fri, 16 Aug 2013 13:32:39 +0200 X-Google-Sender-Auth: bUFl4npicudybEVTvxpHn03ksbM Message-ID: From: Mike Hearn To: Gregory Maxwell Content-Type: multipart/alternative; boundary=047d7b33d176bc668b04e40ef291 X-Spam-Score: -0.5 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (mh.in.england[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 1.0 HTML_MESSAGE BODY: HTML included in message 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1VAIGr-0003sb-DQ Cc: Bitcoin Development Subject: Re: [Bitcoin-development] BIP 32.5 X-BeenThere: bitcoin-development@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Aug 2013 11:32:47 -0000 --047d7b33d176bc668b04e40ef291 Content-Type: text/plain; charset=UTF-8 I filed a bug in the bitcoinj tracker for this a few days ago referencing rfc 6967, but that RFC is very complicated and I'm not sure it's really necessary to go that far. H(sighash||key) is easy to implement and I feel I understand it better. In our case it wouldn't have helped anyway - if anything it would just delayed discovery of the underlying weakness. The same RNG is typically used to generate both keys and signatures today. However in future it may be the case that people put more effort into generating a really random key because they only have to do it once, and then the signing RNG would be different. Your concern about hardware devices leaking private key bits via a side channel is also well made, although I think you have to find some way to establish trust in these devices anyway as sniffing all their IO traffic and analysing it is really hard (plus it inverts the threat model - if you trust your computer and not your hardware wallet, why do you have a hardware wallet?) The other advantage is that deterministic keys and signatures together mean two instances of the same wallet generate identical transactions given an identical sequence of commands. This could help keep wallets in sync. For example we had a few users who got confused because they had cloned their Android wallets across devices (NOT SUPPORTED!) and then one device updated first, did key rotation, and then the other device showed a transaction that sent all their money to a new address it knew nothing about. If they didn't realise the other device had updated this looked identical to theft! I don't think fractional BIP numbers are the way to go :) but a new BIP that standardised a way to select K would, if reviewed, be something I'd implement. On Fri, Aug 16, 2013 at 4:26 AM, Gregory Maxwell wrote: > I am wondering if we shouldn't have a BIP32 addendum which makes the > following signing related recommendations: > > (1) Recommend a specific deterministic DSA derandomization procedure > (a deterministic way to generate the DSA nonce), presumably one based > on HMAC-SHA512 (since BIP32 uses that construct) or SHA256 in the > style of RFC 6979. > > DSA systems being compromised due to poor randomness at runtime is not > new. It effected other systems before it effected Bitcoin systems, > it's not a new problem and it's not going away. It's difficult to > tell if an implementation is correct or not. > > Use of a fully deterministic signature would allow for complete test > vectors in signing and complete confidence that there is no random > number related weakness in a signing implementation. > > In particular, with relevance to our ecosystem a maliciously modified > difficult to audit hardware wallet could be leaking its keys material > via its signatures. Even without producing insecure K values it could > use the choice of K to leak a couple bits of an encrypted root key > with every signature, and allow the malicious party to recover the > keys by simply observing the network. Making the signatures > deterministic would make this kind of misbehavior practically > discoverable. > > We wouldn't be alone in making this change, in general industry is > moving in this direction because it has become clear that DSA is a > hazard otherwise. > > The primary arguments in most spaces against derandomizing DSA are > FIPS conformance (irrelevant for us) and reasonable concerns about the > risks of using a (less) reviewed cryptographic construct. With > widespread motion towards derandomized DSA this latter concern is less > of an issue. > > Libcrypt has also implemented derandomized DSA in git. The ed25519 > signature system of DJB, et. al. also uses a similar derandomization. > > An alternative is implementing a still random construct where K is > some H(message||key||random) which should remain secure even where the > randomness is poor, but this loses the advantage of being able to > externally verify that an implementation is not leaking information. > OpenSSL development has implemented a form of this recently. > > See also: http://tools.ietf.org/rfc/rfc6979.txt > > (2) Recommends a procedure for using only even S values in signatures, > eliminating this source of mutability in transactions. > > This can be accomplished via post-processing of existing signatures, > but since it requires bignum math it is usually preferable to > implement it along with signing. I believe someday this will become a > network requirement for Bitcoin, but regardless it makes sense to > implement it as a best practice sooner rather than later. > > Thoughts? > > > ------------------------------------------------------------------------------ > Get 100% visibility into Java/.NET code with AppDynamics Lite! > It's a free troubleshooting tool designed for production. > Get down to code-level detail for bottlenecks, with <2% overhead. > Download for free and get started troubleshooting in minutes. > http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk > _______________________________________________ > Bitcoin-development mailing list > Bitcoin-development@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bitcoin-development > --047d7b33d176bc668b04e40ef291 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I filed a bug in the bitcoinj tracker for this a few days = ago referencing rfc 6967, but that RFC is very complicated and I'm not = sure it's really necessary to go that far. H(sighash||key) is easy to i= mplement and I feel I understand it better.

In our case it wouldn't have helped anyway - if anything= it would just delayed discovery of the underlying weakness. The same RNG i= s typically used to generate both keys and signatures today. However in fut= ure it may be the case that people put more effort into generating a really= random key because they only have to do it once, and then the signing RNG = would be different.

Your concern about hardware devices leaking private key= bits via a side channel is also well made, although I think you have to fi= nd some way to establish trust in these devices anyway as sniffing all thei= r IO traffic and analysing it is really hard (plus it inverts the threat mo= del - if you trust your computer and not your hardware wallet, why do you h= ave a hardware wallet?)

The other advantage is that deterministic keys and sign= atures together mean two instances of the same wallet generate identical tr= ansactions given an identical sequence of commands. This could help keep wa= llets in sync. For example we had a few users who got confused because they= had cloned their Android wallets across devices (NOT SUPPORTED!) and then = one device updated first, did key rotation, and then the other device showe= d a transaction that sent all their money to a new address it knew nothing = about. If they didn't realise the other device had updated this looked = identical to theft!

I don't think fractional BIP numbers are the way to= go :) but a new BIP that standardised a way to select K would, if reviewed= , be something I'd implement.

On Fri, Aug 16, 2013 at 4:26 AM, Gregory Max= well <gmaxwell@gmail.com> wrote:
I am wondering if we shouldn't have a BIP32 addendum which makes the following signing related recommendations:

(1) Recommend a specific deterministic DSA derandomization procedure
(a deterministic way to generate the DSA nonce), presumably one based
on HMAC-SHA512 (since BIP32 uses that construct) or SHA256 in the
style of RFC 6979.

DSA systems being compromised due to poor randomness at runtime is not
new. It effected other systems before it effected Bitcoin systems,
it's not a new problem and it's not going away. =C2=A0It's diff= icult to
tell if an implementation is correct or not.

Use of a fully deterministic signature =C2=A0would allow for complete test<= br> vectors in signing and complete confidence that there is no random
number related weakness in a signing implementation.

In particular, with relevance to our ecosystem a maliciously modified
difficult to audit hardware wallet could be leaking its keys material
via its signatures. Even without producing insecure K values it could
use the choice of K to leak a couple bits of an encrypted root key
with every signature, and allow the malicious party to recover the
keys by simply observing the network. Making the signatures
deterministic would make this kind of misbehavior practically
discoverable.

We wouldn't be alone in making this change, in general industry is
moving in this direction because it has become clear that DSA is a
hazard otherwise.

The primary arguments in most spaces against derandomizing DSA are
FIPS conformance (irrelevant for us) and reasonable concerns about the
risks of using a (less) reviewed cryptographic construct. With
widespread motion towards derandomized DSA this latter concern is less
of an issue.

Libcrypt has also implemented derandomized DSA in git. The ed25519
signature system of DJB, et. al. also uses a similar derandomization.

An alternative is implementing a still random construct where K is
some H(message||key||random) which should remain secure even where the
randomness is poor, but this loses the advantage of being able to
externally verify that an implementation is not leaking information.
OpenSSL development has implemented a form of this recently.

See also: http://tools.ietf.org/rfc/rfc6979.txt

(2) Recommends a procedure for using only even S values in signatures,
eliminating this source of mutability in transactions.

This can be accomplished via post-processing of existing signatures,
but since it requires bignum math it is usually preferable to
implement it along with signing. =C2=A0I believe someday this will become a=
network requirement for Bitcoin, but regardless it makes sense to
implement it as a best practice sooner rather than later.

Thoughts?

---------------------------------------------------------------------------= ---
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gam= pad/clk?id=3D48897031&iu=3D/4140/ostg.clktrk
_______________________________________________
Bitcoin-development mailing list
Bitcoin-develo= pment@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bitcoin-de= velopment

--047d7b33d176bc668b04e40ef291--