HomePhabricator

Merge #12460: Assert CPubKey::ValidLength to the pubkey's header-relevant size

Description

Merge #12460: Assert CPubKey::ValidLength to the pubkey's header-relevant size

Summary:
PR12460 backport https://github.com/bitcoin/bitcoin/pull/12460/files
f8c249ab91 Assert CPubKey::ValidLength to the pubkey's header-relevent size (Ben Woosley)

Pull request description:

A pubkey's length is specific to its type which is indicated by its header value. GetLen returns the header-indicated length, so this change ensures that a key matches its header-indicated length.

And replace some magic values with their constant equivalents.

Backporter note: the changes to IsCompressedOrUncompressedPubKey and
IsCompressedPubKey needed to be massaged somewhat (due to D1569)

Test Plan: make check

Reviewers: jasonbcox, Fabien, #bitcoin_abc, deadalnix, nakihito

Reviewed By: jasonbcox, #bitcoin_abc, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D3808

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Apr 4 2018, 21:50
Mark Lundeberg <36528214+markblundeberg@users.noreply.github.com>Committed on Aug 6 2019, 22:29
markblundebergPushed on Aug 6 2019, 22:29
Reviewer
Restricted Project
Differential Revision
D3808: Merge #12460: Assert CPubKey::ValidLength to the pubkey's header-relevant size
Parents
rABC5d6c493547fe: [CMAKE] Refactor the AddCompilerFlags facilities
Branches
Unknown
Tags
Unknown