Refactor key.cpp/.h #2600

pull sipa wants to merge 3 commits into bitcoin:master from sipa:keyrefactor changing 28 files +641 −595
  1. sipa commented at 5:36 am on May 1, 2013: member

    This pull request changes a few things in key.h/key.cpp

    • CKey is no longer a kitchen-sink for “anything ECDSA related”, but just an object representing a private key.
    • Operations that don’t use a private key are moved to CPubKey (which is now a fully-featured object representing a public key).
    • All actual OpenSSL-interaction code is moved to an internal class in key.cpp.
    • Representation-wise, CKey now funcions as CSecret (which is gone) with an fCompressed built-in (so no keeping separate booleans necessary anymore).
    • CKey and CPubKey simply encapsulate static byte arrays, and can be created/moved/copied cheaply.
    • Practical upshot: no need to move key/pubkey data from/to CKey anymore before doing something useful with it.

    The reason for writing this is preparing the code to more easily change ECDSA implementation (such as maybe my secp256k1 library at some point), but it seemed useful enough to try to get reviewed and perhaps merged independently of that.

  2. jgarzik commented at 5:44 am on May 1, 2013: contributor
    Seems correct at first glance. Would prefer init-to-zero over init-to-0xFF but that’s nit picking.
  3. BitcoinPullTester commented at 11:54 pm on May 2, 2013: none
    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/b6d07ce7ea07b1b79e96c25d7964f628fc3dbd4e for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
  4. sipa commented at 10:20 pm on May 3, 2013: member
    @jgarzik 0x00 is a valid serialized EC point (though not a valid ECDSA public key), so I prefer using a certainly-invalid data there, to trigger more errors in case of some out-of-bounds access.
  5. jgarzik commented at 10:22 pm on May 3, 2013: contributor
    Fair enough. ACK.
  6. BitcoinPullTester commented at 2:54 pm on May 4, 2013: none
    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/b7b49b89d1f5b510c6269bb3d516a5300a53087f for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
  7. BitcoinPullTester commented at 0:32 am on May 8, 2013: none
    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/fd6e0a58f1b1b4b2ada60ba197ee541f5f0885d4 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
  8. Make CPubKey statically allocated 5d891489ab
  9. CSecret/CKey -> CKey/CPubKey split/refactor dfa23b94c2
  10. Make signature cache store CPubKeys 896185d7ed
  11. sipa commented at 3:28 am on May 30, 2013: member
    Rebased.
  12. jgarzik referenced this in commit e2f42142a0 on May 30, 2013
  13. jgarzik merged this on May 30, 2013
  14. jgarzik closed this on May 30, 2013

  15. jgarzik commented at 2:56 pm on May 30, 2013: contributor
    Wanted to get this one in sooner rather than later, so that other work may be based on top of it (it stirs a lot of code)
  16. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me