Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent privkey modified by ec_seckey_verify method #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 1 addition & 8 deletions c_src/libsecp256k1_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,9 @@ ec_seckey_verify(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
}

if (privkey.size != 32) {
return enif_make_badarg(env);
}

secp256k1_scalar_set_b32(&key, b32, &overflow);
if (overflow || secp256k1_scalar_is_zero(&key)) {
return enif_make_int(env, 0);
return error_result(env, "Private key size != 32 bytes");
}

secp256k1_scalar_get_b32(privkey.data, &key);

result = secp256k1_ec_seckey_verify(ctx, privkey.data);
return atom_from_result(env, result);
}
Expand Down