Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
main_impl.h File Reference
Include dependency graph for main_impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static void secp256k1_ecdsa_recoverable_signature_load (const secp256k1_context *ctx, secp256k1_scalar *r, secp256k1_scalar *s, int *recid, const secp256k1_ecdsa_recoverable_signature *sig)
static void secp256k1_ecdsa_recoverable_signature_save (secp256k1_ecdsa_recoverable_signature *sig, const secp256k1_scalar *r, const secp256k1_scalar *s, int recid)
int secp256k1_ecdsa_recoverable_signature_parse_compact (const secp256k1_context *ctx, secp256k1_ecdsa_recoverable_signature *sig, const unsigned char *input64, int recid)
 Parse a compact ECDSA signature (64 bytes + recovery id).
int secp256k1_ecdsa_recoverable_signature_serialize_compact (const secp256k1_context *ctx, unsigned char *output64, int *recid, const secp256k1_ecdsa_recoverable_signature *sig)
 Serialize an ECDSA signature in compact format (64 bytes + recovery id).
int secp256k1_ecdsa_recoverable_signature_convert (const secp256k1_context *ctx, secp256k1_ecdsa_signature *sig, const secp256k1_ecdsa_recoverable_signature *sigin)
 Convert a recoverable signature into a normal signature.
static int secp256k1_ecdsa_sig_recover (const secp256k1_scalar *sigr, const secp256k1_scalar *sigs, secp256k1_ge *pubkey, const secp256k1_scalar *message, int recid)
int secp256k1_ecdsa_sign_recoverable (const secp256k1_context *ctx, secp256k1_ecdsa_recoverable_signature *signature, const unsigned char *msghash32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void *noncedata)
 Create a recoverable ECDSA signature.
int secp256k1_ecdsa_recover (const secp256k1_context *ctx, secp256k1_pubkey *pubkey, const secp256k1_ecdsa_recoverable_signature *signature, const unsigned char *msghash32)
 Recover an ECDSA public key from a signature.

Function Documentation

◆ secp256k1_ecdsa_recover()

int secp256k1_ecdsa_recover ( const secp256k1_context * ctx,
secp256k1_pubkey * pubkey,
const secp256k1_ecdsa_recoverable_signature * sig,
const unsigned char * msghash32 )

Recover an ECDSA public key from a signature.

Successful public key recovery guarantees that the signature, after normalization, passes secp256k1_ecdsa_verify. Thus, explicit verification is not necessary.

However, a recoverable signature that successfully passes secp256k1_ecdsa_recover, when converted to a non-recoverable signature (using secp256k1_ecdsa_recoverable_signature_convert), is not guaranteed to be normalized and thus not guaranteed to pass secp256k1_ecdsa_verify. If a normalized signature is required, call secp256k1_ecdsa_signature_normalize after secp256k1_ecdsa_recoverable_signature_convert.

Returns: 1: public key successfully recovered 0: otherwise. Args: ctx: pointer to a context object. Out: pubkey: pointer to the recovered public key. In: sig: pointer to initialized signature that supports pubkey recovery. msghash32: the 32-byte message hash assumed to be signed.

Definition at line 137 of file main_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ secp256k1_ecdsa_recoverable_signature_convert()

int secp256k1_ecdsa_recoverable_signature_convert ( const secp256k1_context * ctx,
secp256k1_ecdsa_signature * sig,
const secp256k1_ecdsa_recoverable_signature * sigin )

Convert a recoverable signature into a normal signature.

Returns: 1 Args: ctx: pointer to a context object. Out: sig: pointer to a normal signature. In: sigin: pointer to a recoverable signature.

Definition at line 74 of file main_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ secp256k1_ecdsa_recoverable_signature_load()

void secp256k1_ecdsa_recoverable_signature_load ( const secp256k1_context * ctx,
secp256k1_scalar * r,
secp256k1_scalar * s,
int * recid,
const secp256k1_ecdsa_recoverable_signature * sig )
static

Definition at line 12 of file main_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ secp256k1_ecdsa_recoverable_signature_parse_compact()

int secp256k1_ecdsa_recoverable_signature_parse_compact ( const secp256k1_context * ctx,
secp256k1_ecdsa_recoverable_signature * sig,
const unsigned char * input64,
int recid )

Parse a compact ECDSA signature (64 bytes + recovery id).

Returns: 1 when the signature could be parsed, 0 otherwise Args: ctx: pointer to a context object Out: sig: pointer to a signature object In: input64: pointer to a 64-byte compact signature recid: the recovery id (0, 1, 2 or 3)

Definition at line 38 of file main_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ secp256k1_ecdsa_recoverable_signature_save()

void secp256k1_ecdsa_recoverable_signature_save ( secp256k1_ecdsa_recoverable_signature * sig,
const secp256k1_scalar * r,
const secp256k1_scalar * s,
int recid )
static

Definition at line 27 of file main_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ secp256k1_ecdsa_recoverable_signature_serialize_compact()

int secp256k1_ecdsa_recoverable_signature_serialize_compact ( const secp256k1_context * ctx,
unsigned char * output64,
int * recid,
const secp256k1_ecdsa_recoverable_signature * sig )

Serialize an ECDSA signature in compact format (64 bytes + recovery id).

Returns: 1 Args: ctx: pointer to a context object. Out: output64: pointer to a 64-byte array of the compact signature. recid: pointer to an integer to hold the recovery id. In: sig: pointer to an initialized signature object.

Definition at line 60 of file main_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ secp256k1_ecdsa_sig_recover()

int secp256k1_ecdsa_sig_recover ( const secp256k1_scalar * sigr,
const secp256k1_scalar * sigs,
secp256k1_ge * pubkey,
const secp256k1_scalar * message,
int recid )
static

Definition at line 87 of file main_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ secp256k1_ecdsa_sign_recoverable()

int secp256k1_ecdsa_sign_recoverable ( const secp256k1_context * ctx,
secp256k1_ecdsa_recoverable_signature * sig,
const unsigned char * msghash32,
const unsigned char * seckey,
secp256k1_nonce_function noncefp,
const void * ndata )

Create a recoverable ECDSA signature.

Returns: 1: signature created 0: the nonce generation function failed, or the secret key was invalid. Args: ctx: pointer to a context object (not secp256k1_context_static). Out: sig: pointer to an array where the signature will be placed. In: msghash32: the 32-byte message hash being signed. seckey: pointer to a 32-byte secret key. noncefp: pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used. ndata: pointer to arbitrary data used by the nonce generation function (can be NULL for secp256k1_nonce_function_default).

Definition at line 123 of file main_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function: