jonas-schievink / rubble

(going to be a) BLE stack for embedded Rust
BSD Zero Clause License
396 stars 56 forks source link

Add a P-256 crypto provider API #102

Closed jonas-schievink closed 4 years ago

jonas-schievink commented 4 years ago

2 providers are built in: ring and nisty. (cc @nickray if you're interested in this)

This should unblock pairing support.

DO NOT MERGE until nisty is published on crates.io (this uses ECDH, which is only in master).

Closes https://github.com/jonas-schievink/rubble/issues/40

nickray commented 4 years ago

Neat! I was thinking of waiting for some feedback, and maybe adding key agreement and point compression before the release. But if you have need, I'll publish earlier.

nickray commented 4 years ago

I published 0.1.0-alpha.1 which contains key agreement (also serialization to ASN.1 DER as optional feature). Let me know in particular if you have any build issues, as I switched back to always use bindgen.

jonas-schievink commented 4 years ago

Hmm, I can't get it to build with the updated version, since log pulls in libstd now. Probably because of the bindgen dependency?

nickray commented 4 years ago

Ughh... I managed to build your nrf52-demo for 52840 by disabling the bindgen default-features, published as nisty 0.1.0-alpha.2 and micro-ecc-sys 0.3.1. Any build issues left, or other test cases you have? Of course this is a bit whack-a-mole, but I'd currently prefer keeping bindgen for ease of ~use~ maintenance. Thoughts on this?

jonas-schievink commented 4 years ago

Thanks a lot, looks like that works!

jonas-schievink commented 4 years ago

wtf this is llvm 3.8

jonas-schievink commented 4 years ago

Hmm, not sure why micro-ecc-sys is trying to include /usr/include/x86_64-linux-gnu/gnu/stubs.h during binding generation for thumb targets. That seems wrong.

jonas-schievink commented 4 years ago

This uses p256 instead of nisty now, which solves all the FFI problems