Skip to content

OP_CHECKSIGVERIFY incorrectly checks for a hash type suffix of signatures #103

Closed
@roconnor-blockstream

Description

@roconnor-blockstream

CHECKSIGFROMSTACKVERIFY calls CheckSignatureEncoding:

if (!CheckSignatureEncoding(vchSig, flags, serror) || !CheckPubKeyEncoding(vchPubKey, flags, serror)) {

CheckSignatureEncoding in turns calls IsDefinedHashtypeSignature

if ((flags & SCRIPT_VERIFY_STRICTENC) != 0 && !IsDefinedHashtypeSignature(vchSig)) {

which is incorrect because signatures for CHECKSIGFROMSTACKVERIFY do not have hashtypes.

One way of fixing this could be to mask out SCRIPT_VERIFY_STRICTENC when calling CheckSignatureEncoding.

A better way would be to give signatures from CHECKSIG and CHECKSIGFROMSTACK different types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions