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

ESP32C3 RISCV Support #654

Open
448-OG opened this issue Oct 14, 2023 · 4 comments
Open

ESP32C3 RISCV Support #654

448-OG opened this issue Oct 14, 2023 · 4 comments

Comments

@448-OG
Copy link

448-OG commented Oct 14, 2023

Hi!

I am try to use secpk2561 library on RISCV ESP32C3 board and I keep getting this error and then the board just disconnects. The issue is whenever let secp = Secp256k1::new(); is called like in the board below:

    use secp256k1::hashes::sha256;
    use secp256k1::rand::rngs::OsRng;
    use secp256k1::{Message, Secp256k1};

    let secp = Secp256k1::new();
    let (secret_key, public_key) = secp.generate_keypair(&mut OsRng);
    let message = Message::from_hashed_data::<sha256::Hash>("Hello World!".as_bytes());

    let sig = secp.sign_ecdsa(&message, &secret_key);
    assert!(secp.verify_ecdsa(&message, &sig, &public_key).is_ok());

Here is the error I am getting - https://gist.github.com/448-OG/9fd2ad60c535da95c5cec444c4a2b153
If I use the rust k256 crate to try and do this it works fine, so I am guessing it is somewhere in the FFI for secp256k1 but I need some some help

@apoelstra
Copy link
Member

Which version of rust-secp256k1 are you using?

Have you made any modifications to the library (e.g. to change or remove the C code we're binding to)?

Are you able to measure how much memory is being allocated? Can you try enabling the lowmemory feature on rust-secp?

@448-OG
Copy link
Author

448-OG commented Oct 14, 2023

My current dependencies are

secp256k1 = { version = "0.27.0", features = [
    "lowmemory",
    "bitcoin-hashes",
    "rand-std",
] }
rand = "0.8.5"

@Kixunil
Copy link
Collaborator

Kixunil commented Oct 14, 2023

Can you attach any debugger to it? Try stepping through new until something breaks?

@448-OG
Copy link
Author

448-OG commented Oct 14, 2023

Let me try that I will get back to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants