[NOD-373] Schnorr signature scheme (#451)

* [NOD-373] Implement Schnorr digital signatures and remove ECDSA (based on code from gcash/bchd)

* [NOD-374] Add new error to list; Update comments.

* [NOD-373] Remove leftovers of verifyMessage RPC command (which was deleted)

* [NOD-373] Remove redundant test, add Schnorr tests, and fix tests where needed

* [NOD-373] Fix tests and remove redundant ones

* [NOD-373] Refactor functions names

* [NOD-373] Remove empty line

* [NOD-373] Fix comments, rename functions to more meaningful names

* [NOD-373] Additional data in nonceRFC6979 should not be nil

* [NOD-373] Refactor function name

* [NOD-373] Add permalinks for links to bchd code
This commit is contained in:
Dan Aharoni
2019-11-12 10:09:38 +02:00
committed by stasatdaglabs
parent 9dd025d4da
commit 39eab7a6d5
18 changed files with 399 additions and 1482 deletions

View File

@@ -5430,85 +5430,12 @@
"signatures and pubkeys."
],
[
"0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501 0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501",
"0x41 0x833682d4f60cc916a22a2c263e658fa662c49badb1e2a8c6208987bf99b1abd740498371480069e7a7a6e7471bf78c27bd9a1fd04fb212a92017346250ac187b01 0x41 0xea4a8d20562a950f4695dc24804565482e9fa111704886179d0c348f2b8a15fe691a305cd599c59c131677146661d5b98cb935330989a85f33afc70d0a21add101",
"2 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 0 2 CHECKMULTISIG NOT",
"",
"PUBKEYFORMAT",
"2-of-2 CHECKMULTISIG NOT with the first pubkey invalid, and both signatures validly encoded."
],
[
"0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501 1",
"2 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 2 CHECKMULTISIG NOT",
"",
"SIG_DER",
"2-of-2 CHECKMULTISIG NOT with both pubkeys valid, but first signature invalid."
],
[
"0x47 0x304402205451ce65ad844dbb978b8bdedf5082e33b43cae8279c30f2c74d9e9ee49a94f802203fe95a7ccf74da7a232ee523ef4a53cb4d14bdd16289680cdb97a63819b8f42f01 0x46 0x304402205451ce65ad844dbb978b8bdedf5082e33b43cae8279c30f2c74d9e9ee49a94f802203fe95a7ccf74da7a232ee523ef4a53cb4d14bdd16289680cdb97a63819b8f42f",
"2 0x21 0x02a673638cb9587cb68ea08dbef685c6f2d2a751a8b3c6f2a7e9a4999e6e4bfaf5 0x21 0x02a673638cb9587cb68ea08dbef685c6f2d2a751a8b3c6f2a7e9a4999e6e4bfaf5 0x21 0x02a673638cb9587cb68ea08dbef685c6f2d2a751a8b3c6f2a7e9a4999e6e4bfaf5 3 CHECKMULTISIG",
"",
"SIG_DER",
"2-of-3 with one valid and one invalid signature due to parse error, nSigs > validSigs"
],
[
"Increase DERSIG test coverage"
],
[
"0x4a 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
"0 CHECKSIG NOT",
"",
"SIG_DER",
"Overly long signature is incorrectly encoded for DERSIG"
],
[
"0x25 0x30220220000000000000000000000000000000000000000000000000000000000000000000",
"0 CHECKSIG NOT",
"",
"SIG_DER",
"Missing S is incorrectly encoded for DERSIG"
],
[
"0x27 0x3024021077777777777777777777777777777777020a7777777777777777777777777777777701",
"0 CHECKSIG NOT",
"",
"SIG_DER",
"S with invalid S length is incorrectly encoded for DERSIG"
],
[
"0x27 0x302403107777777777777777777777777777777702107777777777777777777777777777777701",
"0 CHECKSIG NOT",
"",
"SIG_DER",
"Non-integer R is incorrectly encoded for DERSIG"
],
[
"0x27 0x302402107777777777777777777777777777777703107777777777777777777777777777777701",
"0 CHECKSIG NOT",
"",
"SIG_DER",
"Non-integer S is incorrectly encoded for DERSIG"
],
[
"0x17 0x3014020002107777777777777777777777777777777701",
"0 CHECKSIG NOT",
"",
"SIG_DER",
"Zero-length R is incorrectly encoded for DERSIG"
],
[
"0x17 0x3014021077777777777777777777777777777777020001",
"0 CHECKSIG NOT",
"",
"SIG_DER",
"Zero-length S is incorrectly encoded for DERSIG"
],
[
"0x27 0x302402107777777777777777777777777777777702108777777777777777777777777777777701",
"0 CHECKSIG NOT",
"",
"SIG_DER",
"Negative S is incorrectly encoded for DERSIG"
],
[
"CHECKSEQUENCEVERIFY tests"
],
@@ -5557,13 +5484,6 @@
"OK",
"BIP66 and NULLFAIL-compliant"
],
[
"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0x09 0x300602010102010101",
"0x01 0x14 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x21 0x020101010101010101010101010101010101010101010101010101010101010101 0x01 0x14 CHECKMULTISIG NOT",
"",
"NULLFAIL",
"BIP66-compliant but not NULLFAIL-compliant 2"
],
[
"0x09 0x300602010102010101 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
"0x01 0x14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0x01 0x14 CHECKMULTISIG NOT",