Handle non valid input, remove debug
This commit is contained in:
parent
2946ac84f8
commit
55cb5526eb
@ -42,9 +42,8 @@ recover(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
|
||||
if (recid < 0 || recid > 3) {
|
||||
error_result(env, "Recovery id invalid 0-3x");
|
||||
}
|
||||
printf("xx1\r\n");
|
||||
|
||||
result = secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &signature, csignature.data, recid);
|
||||
printf("xx2\r\n");
|
||||
if (!result) {
|
||||
return error_result(env, "ecdsa_signature_parse_compact returned 0");
|
||||
}
|
||||
@ -56,12 +55,9 @@ printf("xx2\r\n");
|
||||
return error_result(env, "ecdsa recovery problem");
|
||||
}
|
||||
|
||||
// Now serialize recpubkey based on the compression flag
|
||||
// Now serialize recpubkey
|
||||
finished_recpubkey_buf = enif_make_new_binary(env, pubkeylen, &r);
|
||||
|
||||
printf("pubker[0] = %d\r\n", recpubkey.data[0]);
|
||||
|
||||
|
||||
result = secp256k1_ec_pubkey_serialize(ctx, finished_recpubkey_buf,
|
||||
&pubkeylen, &recpubkey, compressed);
|
||||
|
||||
|
@ -37,7 +37,9 @@ recover(Hash, <<V, Sig:64/binary>>) when V == 27; V == 28 ->
|
||||
<<0:96, ShortPub/binary>>;
|
||||
{error, _} ->
|
||||
<<0:256>>
|
||||
end.
|
||||
end;
|
||||
recover(_Hash, _VSig) ->
|
||||
<<0:256>>.
|
||||
|
||||
-spec recover(<<_:(32*8)>>, <<_:(65*8)>>, integer()) -> <<_:(32*8)>>.
|
||||
recover(_Hash, _Sig, _RecId) ->
|
||||
|
Loading…
x
Reference in New Issue
Block a user