|
|
@ -92,6 +92,9 @@ static int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *ou |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static int ec_privkey_export_der(const secp256k1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) { |
|
|
|
static int ec_privkey_export_der(const secp256k1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) { |
|
|
|
assert(*privkeylen >= PRIVATE_KEY_SIZE); |
|
|
|
assert(*privkeylen >= PRIVATE_KEY_SIZE); |
|
|
|
|
|
|
|
static_assert( |
|
|
|
|
|
|
|
PRIVATE_KEY_SIZE >= COMPRESSED_PRIVATE_KEY_SIZE, |
|
|
|
|
|
|
|
"COMPRESSED_PRIVATE_KEY_SIZE is larger than PRIVATE_KEY_SIZE"); |
|
|
|
secp256k1_pubkey pubkey; |
|
|
|
secp256k1_pubkey pubkey; |
|
|
|
size_t pubkeylen = 0; |
|
|
|
size_t pubkeylen = 0; |
|
|
|
if (!secp256k1_ec_pubkey_create(ctx, &pubkey, key32)) { |
|
|
|
if (!secp256k1_ec_pubkey_create(ctx, &pubkey, key32)) { |
|
|
|