Skip to content
This repository was archived by the owner on Nov 16, 2021. It is now read-only.

Replace hasher_Double with HASHER_*D #145

Merged
merged 2 commits into from
Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CFLAGS += -I.
CFLAGS += -DUSE_ETHEREUM=1
CFLAGS += -DUSE_GRAPHENE=1
CFLAGS += -DUSE_NEM=1
CFLAGS += $(shell pkg-config --cflags openssl)

# disable certain optimizations and features when small footprint is required
ifdef SMALL
Expand Down Expand Up @@ -55,7 +56,7 @@ SRCS += memzero.c
OBJS = $(SRCS:.c=.o)

TESTLIBS = $(shell pkg-config --libs check) -lpthread -lm
TESTSSLLIBS = -lcrypto
TESTSSLLIBS = $(shell pkg-config --libs openssl)

all: test_check test_openssl test_speed aes/aestst tools libtrezor-crypto.so

Expand Down
2 changes: 0 additions & 2 deletions base58.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ int b58check(const void *bin, size_t binsz, HasherType hasher_type, const char *
if (binsz < 4)
return -4;
hasher_Raw(hasher_type, bin, binsz - 4, buf);
hasher_Raw(hasher_type, buf, 32, buf);
if (memcmp(&binc[binsz - 4], buf, 4))
return -1;

Expand Down Expand Up @@ -202,7 +201,6 @@ int base58_encode_check(const uint8_t *data, int datalen, HasherType hasher_type
uint8_t *hash = buf + datalen;
memcpy(buf, data, datalen);
hasher_Raw(hasher_type, data, datalen, hash);
hasher_Raw(hasher_type, hash, 32, hash);
size_t res = strsize;
bool success = b58enc(str, &res, buf, datalen + 4);
memzero(buf, sizeof(buf));
Expand Down
42 changes: 27 additions & 15 deletions bip32.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,39 @@
const curve_info ed25519_info = {
.bip32_name = "ed25519 seed",
.params = NULL,
.hasher_type = HASHER_SHA2,
.hasher_bip32 = HASHER_SHA2,
.hasher_base58 = HASHER_SHA2D,
.hasher_sign = HASHER_SHA2D,
.hasher_pubkey = HASHER_SHA2,
};

const curve_info ed25519_sha3_info = {
.bip32_name = "ed25519-sha3 seed",
.params = NULL,
.hasher_type = HASHER_SHA2,
.hasher_bip32 = HASHER_SHA2,
.hasher_base58 = HASHER_SHA2D,
.hasher_sign = HASHER_SHA2D,
.hasher_pubkey = HASHER_SHA2,
};

#if USE_KECCAK
const curve_info ed25519_keccak_info = {
.bip32_name = "ed25519-keccak seed",
.params = NULL,
.hasher_type = HASHER_SHA2,
.hasher_bip32 = HASHER_SHA2,
.hasher_base58 = HASHER_SHA2D,
.hasher_sign = HASHER_SHA2D,
.hasher_pubkey = HASHER_SHA2,
};
#endif

const curve_info curve25519_info = {
.bip32_name = "curve25519 seed",
.params = NULL,
.hasher_type = HASHER_SHA2,
.hasher_bip32 = HASHER_SHA2,
.hasher_base58 = HASHER_SHA2D,
.hasher_sign = HASHER_SHA2D,
.hasher_pubkey = HASHER_SHA2,
};

int hdnode_from_xpub(uint32_t depth, uint32_t child_num, const uint8_t *chain_code, const uint8_t *public_key, const char* curve, HDNode *out)
Expand Down Expand Up @@ -166,7 +178,7 @@ uint32_t hdnode_fingerprint(HDNode *node)
uint32_t fingerprint;

hdnode_fill_public_key(node);
hasher_Raw(node->curve->hasher_type, node->public_key, 33, digest);
hasher_Raw(node->curve->hasher_bip32, node->public_key, 33, digest);
ripemd160(digest, 32, digest);
fingerprint = ((uint32_t) digest[0] << 24) + (digest[1] << 16) + (digest[2] << 8) + digest[3];
memzero(digest, sizeof(digest));
Expand Down Expand Up @@ -300,7 +312,7 @@ int hdnode_public_ckd(HDNode *inout, uint32_t i)
return 1;
}

void hdnode_public_ckd_address_optimized(const curve_point *pub, const uint8_t *chain_code, uint32_t i, uint32_t version, HasherType hasher_type, char *addr, int addrsize, int addrformat)
void hdnode_public_ckd_address_optimized(const curve_point *pub, const uint8_t *chain_code, uint32_t i, uint32_t version, HasherType hasher_pubkey, HasherType hasher_base58, char *addr, int addrsize, int addrformat)
{
uint8_t child_pubkey[33];
curve_point b;
Expand All @@ -311,10 +323,10 @@ void hdnode_public_ckd_address_optimized(const curve_point *pub, const uint8_t *

switch (addrformat) {
case 1: // Segwit-in-P2SH
ecdsa_get_address_segwit_p2sh(child_pubkey, version, hasher_type, addr, addrsize);
ecdsa_get_address_segwit_p2sh(child_pubkey, version, hasher_pubkey, hasher_base58, addr, addrsize);
break;
default: // normal address
ecdsa_get_address(child_pubkey, version, hasher_type, addr, addrsize);
ecdsa_get_address(child_pubkey, version, hasher_pubkey, hasher_base58, addr, addrsize);
break;
}
}
Expand Down Expand Up @@ -396,13 +408,13 @@ int hdnode_private_ckd_cached(HDNode *inout, const uint32_t *i, size_t i_count,
void hdnode_get_address_raw(HDNode *node, uint32_t version, uint8_t *addr_raw)
{
hdnode_fill_public_key(node);
ecdsa_get_address_raw(node->public_key, version, node->curve->hasher_type, addr_raw);
ecdsa_get_address_raw(node->public_key, version, node->curve->hasher_pubkey, addr_raw);
}

void hdnode_get_address(HDNode *node, uint32_t version, char *addr, int addrsize)
{
hdnode_fill_public_key(node);
ecdsa_get_address(node->public_key, version, node->curve->hasher_type, addr, addrsize);
ecdsa_get_address(node->public_key, version, node->curve->hasher_pubkey, node->curve->hasher_base58, addr, addrsize);
}

void hdnode_fill_public_key(HDNode *node)
Expand Down Expand Up @@ -540,10 +552,10 @@ int hdnode_nem_decrypt(const HDNode *node, const ed25519_public_key public_key,

// msg is a data to be signed
// msg_len is the message length
int hdnode_sign(HDNode *node, const uint8_t *msg, uint32_t msg_len, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]))
int hdnode_sign(HDNode *node, const uint8_t *msg, uint32_t msg_len, HasherType hasher_sign, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]))
{
if (node->curve->params) {
return ecdsa_sign(node->curve->params, node->curve->hasher_type, node->private_key, msg, msg_len, sig, pby, is_canonical);
return ecdsa_sign(node->curve->params, hasher_sign, node->private_key, msg, msg_len, sig, pby, is_canonical);
} else if (node->curve == &curve25519_info) {
return 1; // signatures are not supported
} else {
Expand All @@ -568,7 +580,7 @@ int hdnode_sign_digest(HDNode *node, const uint8_t *digest, uint8_t *sig, uint8_
} else if (node->curve == &curve25519_info) {
return 1; // signatures are not supported
} else {
return hdnode_sign(node, digest, 32, sig, pby, is_canonical);
return hdnode_sign(node, digest, 32, 0, sig, pby, is_canonical);
}
}

Expand Down Expand Up @@ -609,7 +621,7 @@ static int hdnode_serialize(const HDNode *node, uint32_t fingerprint, uint32_t v
node_data[45] = 0;
memcpy(node_data + 46, node->private_key, 32);
}
int ret = base58_encode_check(node_data, sizeof(node_data), node->curve->hasher_type, str, strsize);
int ret = base58_encode_check(node_data, sizeof(node_data), node->curve->hasher_base58, str, strsize);
memzero(node_data, sizeof(node_data));
return ret;
}
Expand All @@ -630,7 +642,7 @@ int hdnode_deserialize(const char *str, uint32_t version_public, uint32_t versio
uint8_t node_data[78];
memset(node, 0, sizeof(HDNode));
node->curve = get_curve_by_name(curve);
if (base58_decode_check(str, node->curve->hasher_type, node_data, sizeof(node_data)) != sizeof(node_data)) {
if (base58_decode_check(str, node->curve->hasher_base58, node_data, sizeof(node_data)) != sizeof(node_data)) {
return -1;
}
uint32_t version = read_be(node_data);
Expand Down
10 changes: 7 additions & 3 deletions bip32.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
typedef struct {
const char *bip32_name; // string for generating BIP32 xprv from seed
const ecdsa_curve *params; // ecdsa curve parameters, null for ed25519
HasherType hasher_type; // hasher type for BIP32 and ECDSA

HasherType hasher_bip32;
HasherType hasher_base58;
HasherType hasher_sign;
HasherType hasher_pubkey;
} curve_info;

typedef struct {
Expand All @@ -60,7 +64,7 @@ int hdnode_public_ckd_cp(const ecdsa_curve *curve, const curve_point *parent, co

int hdnode_public_ckd(HDNode *inout, uint32_t i);

void hdnode_public_ckd_address_optimized(const curve_point *pub, const uint8_t *chain_code, uint32_t i, uint32_t version, HasherType hasher_type, char *addr, int addrsize, int addrformat);
void hdnode_public_ckd_address_optimized(const curve_point *pub, const uint8_t *chain_code, uint32_t i, uint32_t version, HasherType hasher_pubkey, HasherType hasher_base58, char *addr, int addrsize, int addrformat);

#if USE_BIP32_CACHE
int hdnode_private_ckd_cached(HDNode *inout, const uint32_t *i, size_t i_count, uint32_t *fingerprint);
Expand All @@ -81,7 +85,7 @@ int hdnode_nem_encrypt(const HDNode *node, const ed25519_public_key public_key,
int hdnode_nem_decrypt(const HDNode *node, const ed25519_public_key public_key, uint8_t *iv, const uint8_t *salt, const uint8_t *payload, size_t size, uint8_t *buffer);
#endif

int hdnode_sign(HDNode *node, const uint8_t *msg, uint32_t msg_len, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));
int hdnode_sign(HDNode *node, const uint8_t *msg, uint32_t msg_len, HasherType hasher_sign, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));
int hdnode_sign_digest(HDNode *node, const uint8_t *digest, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));

int hdnode_get_shared_key(const HDNode *node, const uint8_t *peer_public_key, uint8_t *session_key, int *result_size);
Expand Down
68 changes: 23 additions & 45 deletions ecdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,28 +715,16 @@ void generate_k_rfc6979(bignum256 *k, rfc6979_state *state)

// msg is a data to be signed
// msg_len is the message length
int ecdsa_sign(const ecdsa_curve *curve, HasherType hasher_type, const uint8_t *priv_key, const uint8_t *msg, uint32_t msg_len, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]))
int ecdsa_sign(const ecdsa_curve *curve, HasherType hasher_sign, const uint8_t *priv_key, const uint8_t *msg, uint32_t msg_len, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]))
{
uint8_t hash[32];
hasher_Raw(hasher_type, msg, msg_len, hash);
hasher_Raw(hasher_sign, msg, msg_len, hash);
int res = ecdsa_sign_digest(curve, priv_key, hash, sig, pby, is_canonical);
memzero(hash, sizeof(hash));
return res;

}

// msg is a data to be signed
// msg_len is the message length
int ecdsa_sign_double(const ecdsa_curve *curve, HasherType hasher_type, const uint8_t *priv_key, const uint8_t *msg, uint32_t msg_len, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]))
{
uint8_t hash[32];
hasher_Raw(hasher_type, msg, msg_len, hash);
hasher_Raw(hasher_type, hash, 32, hash);
int res = ecdsa_sign_digest(curve, priv_key, hash, sig, pby, is_canonical);
memzero(hash, sizeof(hash));
return res;
}

// uses secp256k1 curve
// priv_key is a 32 byte big endian stored number
// sig is 64 bytes long array for the signature
Expand Down Expand Up @@ -880,75 +868,75 @@ int ecdsa_uncompress_pubkey(const ecdsa_curve *curve, const uint8_t *pub_key, ui
return 1;
}

void ecdsa_get_pubkeyhash(const uint8_t *pub_key, HasherType hasher_type, uint8_t *pubkeyhash)
void ecdsa_get_pubkeyhash(const uint8_t *pub_key, HasherType hasher_pubkey, uint8_t *pubkeyhash)
{
uint8_t h[HASHER_DIGEST_LENGTH];
if (pub_key[0] == 0x04) { // uncompressed format
hasher_Raw(hasher_type, pub_key, 65, h);
hasher_Raw(hasher_pubkey, pub_key, 65, h);
} else if (pub_key[0] == 0x00) { // point at infinity
hasher_Raw(hasher_type, pub_key, 1, h);
hasher_Raw(hasher_pubkey, pub_key, 1, h);
} else { // expecting compressed format
hasher_Raw(hasher_type, pub_key, 33, h);
hasher_Raw(hasher_pubkey, pub_key, 33, h);
}
ripemd160(h, HASHER_DIGEST_LENGTH, pubkeyhash);
memzero(h, sizeof(h));
}

void ecdsa_get_address_raw(const uint8_t *pub_key, uint32_t version, HasherType hasher_type, uint8_t *addr_raw)
void ecdsa_get_address_raw(const uint8_t *pub_key, uint32_t version, HasherType hasher_pubkey, uint8_t *addr_raw)
{
size_t prefix_len = address_prefix_bytes_len(version);
address_write_prefix_bytes(version, addr_raw);
ecdsa_get_pubkeyhash(pub_key, hasher_type, addr_raw + prefix_len);
ecdsa_get_pubkeyhash(pub_key, hasher_pubkey, addr_raw + prefix_len);
}

void ecdsa_get_address(const uint8_t *pub_key, uint32_t version, HasherType hasher_type, char *addr, int addrsize)
void ecdsa_get_address(const uint8_t *pub_key, uint32_t version, HasherType hasher_pubkey, HasherType hasher_base58, char *addr, int addrsize)
{
uint8_t raw[MAX_ADDR_RAW_SIZE];
size_t prefix_len = address_prefix_bytes_len(version);
ecdsa_get_address_raw(pub_key, version, hasher_type, raw);
base58_encode_check(raw, 20 + prefix_len, hasher_type, addr, addrsize);
ecdsa_get_address_raw(pub_key, version, hasher_pubkey, raw);
base58_encode_check(raw, 20 + prefix_len, hasher_base58, addr, addrsize);
// not as important to clear this one, but we might as well
memzero(raw, sizeof(raw));
}

void ecdsa_get_address_segwit_p2sh_raw(const uint8_t *pub_key, uint32_t version, HasherType hasher_type, uint8_t *addr_raw)
void ecdsa_get_address_segwit_p2sh_raw(const uint8_t *pub_key, uint32_t version, HasherType hasher_pubkey, uint8_t *addr_raw)
{
size_t prefix_len = address_prefix_bytes_len(version);
uint8_t digest[32];
addr_raw[0] = 0; // version byte
addr_raw[1] = 20; // push 20 bytes
ecdsa_get_pubkeyhash(pub_key, hasher_type, addr_raw + 2);
hasher_Raw(hasher_type, addr_raw, 22, digest);
ecdsa_get_pubkeyhash(pub_key, hasher_pubkey, addr_raw + 2);
hasher_Raw(hasher_pubkey, addr_raw, 22, digest);
address_write_prefix_bytes(version, addr_raw);
ripemd160(digest, 32, addr_raw + prefix_len);
}

void ecdsa_get_address_segwit_p2sh(const uint8_t *pub_key, uint32_t version, HasherType hasher_type, char *addr, int addrsize)
void ecdsa_get_address_segwit_p2sh(const uint8_t *pub_key, uint32_t version, HasherType hasher_pubkey, HasherType hasher_base58, char *addr, int addrsize)
{
uint8_t raw[MAX_ADDR_RAW_SIZE];
size_t prefix_len = address_prefix_bytes_len(version);
ecdsa_get_address_segwit_p2sh_raw(pub_key, version, hasher_type, raw);
base58_encode_check(raw, prefix_len + 20, hasher_type, addr, addrsize);
ecdsa_get_address_segwit_p2sh_raw(pub_key, version, hasher_pubkey, raw);
base58_encode_check(raw, prefix_len + 20, hasher_base58, addr, addrsize);
memzero(raw, sizeof(raw));
}

void ecdsa_get_wif(const uint8_t *priv_key, uint32_t version, HasherType hasher_type, char *wif, int wifsize)
void ecdsa_get_wif(const uint8_t *priv_key, uint32_t version, HasherType hasher_base58, char *wif, int wifsize)
{
uint8_t wif_raw[MAX_WIF_RAW_SIZE];
size_t prefix_len = address_prefix_bytes_len(version);
address_write_prefix_bytes(version, wif_raw);
memcpy(wif_raw + prefix_len, priv_key, 32);
wif_raw[prefix_len + 32] = 0x01;
base58_encode_check(wif_raw, prefix_len + 32 + 1, hasher_type, wif, wifsize);
base58_encode_check(wif_raw, prefix_len + 32 + 1, hasher_base58, wif, wifsize);
// private keys running around our stack can cause trouble
memzero(wif_raw, sizeof(wif_raw));
}

int ecdsa_address_decode(const char *addr, uint32_t version, HasherType hasher_type, uint8_t *out)
int ecdsa_address_decode(const char *addr, uint32_t version, HasherType hasher_base58, uint8_t *out)
{
if (!addr) return 0;
int prefix_len = address_prefix_bytes_len(version);
return base58_decode_check(addr, hasher_type, out, 20 + prefix_len) == 20 + prefix_len
return base58_decode_check(addr, hasher_base58, out, 20 + prefix_len) == 20 + prefix_len
&& address_check_prefix(out, version);
}

Expand Down Expand Up @@ -1029,20 +1017,10 @@ int ecdsa_validate_pubkey(const ecdsa_curve *curve, const curve_point *pub)
// msg is a data that was signed
// msg_len is the message length

int ecdsa_verify(const ecdsa_curve *curve, HasherType hasher_type, const uint8_t *pub_key, const uint8_t *sig, const uint8_t *msg, uint32_t msg_len)
{
uint8_t hash[32];
hasher_Raw(hasher_type, msg, msg_len, hash);
int res = ecdsa_verify_digest(curve, pub_key, sig, hash);
memzero(hash, sizeof(hash));
return res;
}

int ecdsa_verify_double(const ecdsa_curve *curve, HasherType hasher_type, const uint8_t *pub_key, const uint8_t *sig, const uint8_t *msg, uint32_t msg_len)
int ecdsa_verify(const ecdsa_curve *curve, HasherType hasher_sign, const uint8_t *pub_key, const uint8_t *sig, const uint8_t *msg, uint32_t msg_len)
{
uint8_t hash[32];
hasher_Raw(hasher_type, msg, msg_len, hash);
hasher_Raw(hasher_type, hash, 32, hash);
hasher_Raw(hasher_sign, msg, msg_len, hash);
int res = ecdsa_verify_digest(curve, pub_key, sig, hash);
memzero(hash, sizeof(hash));
return res;
Expand Down
20 changes: 9 additions & 11 deletions ecdsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,21 @@ int ecdh_multiply(const ecdsa_curve *curve, const uint8_t *priv_key, const uint8
void uncompress_coords(const ecdsa_curve *curve, uint8_t odd, const bignum256 *x, bignum256 *y);
int ecdsa_uncompress_pubkey(const ecdsa_curve *curve, const uint8_t *pub_key, uint8_t *uncompressed);

int ecdsa_sign(const ecdsa_curve *curve, HasherType hasher_type, const uint8_t *priv_key, const uint8_t *msg, uint32_t msg_len, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));
int ecdsa_sign_double(const ecdsa_curve *curve, HasherType hasher_type, const uint8_t *priv_key, const uint8_t *msg, uint32_t msg_len, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));
int ecdsa_sign(const ecdsa_curve *curve, HasherType hasher_sign, const uint8_t *priv_key, const uint8_t *msg, uint32_t msg_len, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));
int ecdsa_sign_digest(const ecdsa_curve *curve, const uint8_t *priv_key, const uint8_t *digest, uint8_t *sig, uint8_t *pby, int (*is_canonical)(uint8_t by, uint8_t sig[64]));
void ecdsa_get_public_key33(const ecdsa_curve *curve, const uint8_t *priv_key, uint8_t *pub_key);
void ecdsa_get_public_key65(const ecdsa_curve *curve, const uint8_t *priv_key, uint8_t *pub_key);
void ecdsa_get_pubkeyhash(const uint8_t *pub_key, HasherType hasher_type, uint8_t *pubkeyhash);
void ecdsa_get_address_raw(const uint8_t *pub_key, uint32_t version, HasherType hasher_type, uint8_t *addr_raw);
void ecdsa_get_address(const uint8_t *pub_key, uint32_t version, HasherType hasher_type, char *addr, int addrsize);
void ecdsa_get_address_segwit_p2sh_raw(const uint8_t *pub_key, uint32_t version, HasherType hasher_type, uint8_t *addr_raw);
void ecdsa_get_address_segwit_p2sh(const uint8_t *pub_key, uint32_t version, HasherType hasher_type, char *addr, int addrsize);
void ecdsa_get_wif(const uint8_t *priv_key, uint32_t version, HasherType hasher_type, char *wif, int wifsize);
void ecdsa_get_pubkeyhash(const uint8_t *pub_key, HasherType hasher_pubkey, uint8_t *pubkeyhash);
void ecdsa_get_address_raw(const uint8_t *pub_key, uint32_t version, HasherType hasher_pubkey, uint8_t *addr_raw);
void ecdsa_get_address(const uint8_t *pub_key, uint32_t version, HasherType hasher_pubkey, HasherType hasher_base58, char *addr, int addrsize);
void ecdsa_get_address_segwit_p2sh_raw(const uint8_t *pub_key, uint32_t version, HasherType hasher_pubkey, uint8_t *addr_raw);
void ecdsa_get_address_segwit_p2sh(const uint8_t *pub_key, uint32_t version, HasherType hasher_pubkey, HasherType hasher_base58, char *addr, int addrsize);
void ecdsa_get_wif(const uint8_t *priv_key, uint32_t version, HasherType hasher_base58, char *wif, int wifsize);

int ecdsa_address_decode(const char *addr, uint32_t version, HasherType hasher_type, uint8_t *out);
int ecdsa_address_decode(const char *addr, uint32_t version, HasherType hasher_base58, uint8_t *out);
int ecdsa_read_pubkey(const ecdsa_curve *curve, const uint8_t *pub_key, curve_point *pub);
int ecdsa_validate_pubkey(const ecdsa_curve *curve, const curve_point *pub);
int ecdsa_verify(const ecdsa_curve *curve, HasherType hasher_type, const uint8_t *pub_key, const uint8_t *sig, const uint8_t *msg, uint32_t msg_len);
int ecdsa_verify_double(const ecdsa_curve *curve, HasherType hasher_type, const uint8_t *pub_key, const uint8_t *sig, const uint8_t *msg, uint32_t msg_len);
int ecdsa_verify(const ecdsa_curve *curve, HasherType hasher_sign, const uint8_t *pub_key, const uint8_t *sig, const uint8_t *msg, uint32_t msg_len);
int ecdsa_verify_digest(const ecdsa_curve *curve, const uint8_t *pub_key, const uint8_t *sig, const uint8_t *digest);
int ecdsa_verify_digest_recover(const ecdsa_curve *curve, uint8_t *pub_key, const uint8_t *sig, const uint8_t *digest, int recid);
int ecdsa_sig_to_der(const uint8_t *sig, uint8_t *der);
Expand Down
Loading