Bitcoin Core  27.99.0
P2P Digital Currency
Functions
lax_der_parsing.h File Reference
#include <secp256k1.h>
Include dependency graph for lax_der_parsing.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int ecdsa_signature_parse_der_lax (const secp256k1_context *ctx, secp256k1_ecdsa_signature *sig, const unsigned char *input, size_t inputlen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
 Parse a signature in "lax DER" format. More...
 

Function Documentation

◆ ecdsa_signature_parse_der_lax()

int ecdsa_signature_parse_der_lax ( const secp256k1_context ctx,
secp256k1_ecdsa_signature sig,
const unsigned char *  input,
size_t  inputlen 
)

Parse a signature in "lax DER" format.

Returns: 1 when the signature could be parsed, 0 otherwise. Args: ctx: a secp256k1 context object Out: sig: a pointer to a signature object In: input: a pointer to the signature to be parsed inputlen: the length of the array pointed to be input

This function will accept any valid DER encoded signature, even if the encoded numbers are out of range. In addition, it will accept signatures which violate the DER spec in various ways. Its purpose is to allow validation of the Bitcoin blockchain, which includes non-DER signatures from before the network rules were updated to enforce DER. Note that the set of supported violations is a strict subset of what OpenSSL will accept.

After the call, sig will always be initialized. If parsing failed or the encoded numbers are out of range, signature validation with it is guaranteed to fail for every message and public key.

Definition at line 11 of file lax_der_parsing.c.

Here is the call graph for this function: