Changeset View
Changeset View
Standalone View
Standalone View
src/key.cpp
Show All 10 Lines | |||||
#include "random.h" | #include "random.h" | ||||
#include <secp256k1.h> | #include <secp256k1.h> | ||||
#include <secp256k1_recovery.h> | #include <secp256k1_recovery.h> | ||||
#include <secp256k1_schnorr.h> | #include <secp256k1_schnorr.h> | ||||
static secp256k1_context *secp256k1_context_sign = nullptr; | static secp256k1_context *secp256k1_context_sign = nullptr; | ||||
/** These functions are taken from the libsecp256k1 distribution and are very | /** | ||||
* ugly. */ | * These functions are taken from the libsecp256k1 distribution and are very | ||||
* ugly. | |||||
*/ | |||||
static int ec_privkey_import_der(const secp256k1_context *ctx, uint8_t *out32, | static int ec_privkey_import_der(const secp256k1_context *ctx, uint8_t *out32, | ||||
const uint8_t *privkey, size_t privkeylen) { | const uint8_t *privkey, size_t privkeylen) { | ||||
const uint8_t *end = privkey + privkeylen; | const uint8_t *end = privkey + privkeylen; | ||||
int lenb = 0; | int lenb = 0; | ||||
int len = 0; | int len = 0; | ||||
memset(out32, 0, 32); | memset(out32, 0, 32); | ||||
/* sequence header */ | /* sequence header */ | ||||
if (end < privkey + 1 || *privkey != 0x30) { | if (end < privkey + 1 || *privkey != 0x30) { | ||||
▲ Show 20 Lines • Show All 353 Lines • Show Last 20 Lines |