libbtc
bitcoinclibrary
|
#include "secp256k1/include/secp256k1.h"
#include <assert.h>
#include <stdint.h>
#include <string.h>
#include "btc/btc.h"
#include "random.h"
Go to the source code of this file.
Functions | |
void | ecc_start (void) |
init static ecc context More... | |
void | ecc_stop (void) |
destroys the static ecc context More... | |
void | ecc_get_pubkey (const uint8_t *private_key, uint8_t *public_key, size_t *in_outlen, btc_bool compressed) |
get public key from given private key More... | |
btc_bool | ecc_private_key_tweak_add (uint8_t *private_key, const uint8_t *tweak) |
ec mul tweak on given private key More... | |
btc_bool | ecc_public_key_tweak_add (uint8_t *public_key_inout, const uint8_t *tweak) |
ec mul tweak on given public key More... | |
btc_bool | ecc_verify_privatekey (const uint8_t *private_key) |
verifies a given 32byte key More... | |
btc_bool | ecc_verify_pubkey (const uint8_t *public_key, btc_bool compressed) |
verifies a given public key (compressed[33] or uncompressed[65] bytes) More... | |
btc_bool | ecc_sign (const uint8_t *private_key, const uint8_t *hash, unsigned char *sigder, size_t *outlen) |
btc_bool | ecc_verify_sig (const uint8_t *public_key, btc_bool compressed, const uint8_t *hash, unsigned char *sigder, size_t siglen) |
Variables | |
static secp256k1_context * | secp256k1_ctx = NULL |
void ecc_get_pubkey | ( | const uint8_t * | private_key, |
uint8_t * | public_key, | ||
size_t * | in_outlen, | ||
btc_bool | compressed | ||
) |
get public key from given private key
Definition at line 36 of file ecc_libsecp256k1.c.
References secp256k1_ctx.
Referenced by btc_hdnode_fill_public_key(), and btc_pubkey_from_key().
btc_bool ecc_private_key_tweak_add | ( | uint8_t * | private_key, |
const uint8_t * | tweak | ||
) |
ec mul tweak on given private key
Definition at line 54 of file ecc_libsecp256k1.c.
References secp256k1_ctx.
Referenced by btc_hdnode_private_ckd().
btc_bool ecc_public_key_tweak_add | ( | uint8_t * | public_key_inout, |
const uint8_t * | tweak | ||
) |
ec mul tweak on given public key
Definition at line 60 of file ecc_libsecp256k1.c.
References secp256k1_ctx.
Referenced by btc_hdnode_public_ckd().
btc_bool ecc_sign | ( | const uint8_t * | private_key, |
const uint8_t * | hash, | ||
unsigned char * | sigder, | ||
size_t * | outlen | ||
) |
Definition at line 99 of file ecc_libsecp256k1.c.
References secp256k1_ctx.
Referenced by btc_key_sign_hash().
void ecc_start | ( | void | ) |
init static ecc context
Definition at line 13 of file ecc_libsecp256k1.c.
References random_bytes(), and secp256k1_ctx.
void ecc_stop | ( | void | ) |
destroys the static ecc context
Definition at line 25 of file ecc_libsecp256k1.c.
References secp256k1_ctx.
btc_bool ecc_verify_privatekey | ( | const uint8_t * | private_key | ) |
verifies a given 32byte key
Definition at line 79 of file ecc_libsecp256k1.c.
References secp256k1_ctx.
Referenced by btc_hdnode_from_seed(), btc_hdnode_private_ckd(), btc_privkey_gen(), and btc_privkey_is_valid().
verifies a given public key (compressed[33] or uncompressed[65] bytes)
Definition at line 85 of file ecc_libsecp256k1.c.
References secp256k1_ctx.
Referenced by btc_pubkey_is_valid().
btc_bool ecc_verify_sig | ( | const uint8_t * | public_key, |
btc_bool | compressed, | ||
const uint8_t * | hash, | ||
unsigned char * | sigder, | ||
size_t | siglen | ||
) |
Definition at line 113 of file ecc_libsecp256k1.c.
References secp256k1_ctx.
Referenced by btc_pubkey_verify_sig().
|
static |
Definition at line 11 of file ecc_libsecp256k1.c.
Referenced by ecc_get_pubkey(), ecc_private_key_tweak_add(), ecc_public_key_tweak_add(), ecc_sign(), ecc_start(), ecc_stop(), ecc_verify_privatekey(), ecc_verify_pubkey(), and ecc_verify_sig().