Handle non valid input, remove debug

This commit is contained in:
Sean Hinde
2023-01-12 15:48:11 +01:00
parent 2946ac84f8
commit 55cb5526eb
2 changed files with 5 additions and 7 deletions
+2 -6
View File
@@ -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);