Changeset View
Changeset View
Standalone View
Standalone View
src/script/sigencoding.cpp
Show All 24 Lines | |||||
* This function is consensus-critical since BIP66. | * This function is consensus-critical since BIP66. | ||||
*/ | */ | ||||
static bool IsValidDERSignatureEncoding(const slicedvaltype &sig) { | static bool IsValidDERSignatureEncoding(const slicedvaltype &sig) { | ||||
// Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] | // Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] | ||||
// * total-length: 1-byte length descriptor of everything that follows, | // * total-length: 1-byte length descriptor of everything that follows, | ||||
// excluding the sighash byte. | // excluding the sighash byte. | ||||
// * R-length: 1-byte length descriptor of the R value that follows. | // * R-length: 1-byte length descriptor of the R value that follows. | ||||
// * R: arbitrary-length big-endian encoded R value. It must use the | // * R: arbitrary-length big-endian encoded R value. It must use the | ||||
// shortest possible encoding for a positive integers (which means no null | // shortest possible encoding for a positive integer (which means no null | ||||
// bytes at the start, except a single one when the next byte has its | // bytes at the start, except a single one when the next byte has its | ||||
// highest bit set). | // highest bit set). | ||||
// * S-length: 1-byte length descriptor of the S value that follows. | // * S-length: 1-byte length descriptor of the S value that follows. | ||||
// * S: arbitrary-length big-endian encoded S value. The same rules apply. | // * S: arbitrary-length big-endian encoded S value. The same rules apply. | ||||
// Minimum and maximum size constraints. | // Minimum and maximum size constraints. | ||||
if (sig.size() < 8 || sig.size() > 72) { | if (sig.size() < 8 || sig.size() > 72) { | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 289 Lines • Show Last 20 Lines |