Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/modules/extrakeys/main_impl.h
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | int secp256k1_keypair_create(const secp256k1_context* ctx, secp256k1_keypair *keypair, const unsigned char *seckey32) { | ||||
ret = secp256k1_ec_pubkey_create_helper(&ctx->ecmult_gen_ctx, &sk, &pk, seckey32); | ret = secp256k1_ec_pubkey_create_helper(&ctx->ecmult_gen_ctx, &sk, &pk, seckey32); | ||||
secp256k1_keypair_save(keypair, &sk, &pk); | secp256k1_keypair_save(keypair, &sk, &pk); | ||||
secp256k1_memczero(keypair, sizeof(*keypair), !ret); | secp256k1_memczero(keypair, sizeof(*keypair), !ret); | ||||
secp256k1_scalar_clear(&sk); | secp256k1_scalar_clear(&sk); | ||||
return ret; | return ret; | ||||
} | } | ||||
int secp256k1_keypair_sec(const secp256k1_context* ctx, unsigned char *seckey, const secp256k1_keypair *keypair) { | |||||
VERIFY_CHECK(ctx != NULL); | |||||
ARG_CHECK(seckey != NULL); | |||||
memset(seckey, 0, 32); | |||||
ARG_CHECK(keypair != NULL); | |||||
memcpy(seckey, &keypair->data[0], 32); | |||||
return 1; | |||||
} | |||||
int secp256k1_keypair_pub(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const secp256k1_keypair *keypair) { | int secp256k1_keypair_pub(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const secp256k1_keypair *keypair) { | ||||
VERIFY_CHECK(ctx != NULL); | VERIFY_CHECK(ctx != NULL); | ||||
ARG_CHECK(pubkey != NULL); | ARG_CHECK(pubkey != NULL); | ||||
memset(pubkey, 0, sizeof(*pubkey)); | memset(pubkey, 0, sizeof(*pubkey)); | ||||
ARG_CHECK(keypair != NULL); | ARG_CHECK(keypair != NULL); | ||||
memcpy(pubkey->data, &keypair->data[32], sizeof(*pubkey)); | memcpy(pubkey->data, &keypair->data[32], sizeof(*pubkey)); | ||||
return 1; | return 1; | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |