glome icon indicating copy to clipboard operation
glome copied to clipboard

Add a Rust library and an example

Open burgerdev opened this issue 1 year ago • 2 comments

More or less the first thing I did when I started this branch was researching the appropriate X25519 library to use. Now, almost 3 years later, I still find it rather hard to decide. My top picks were x25519_dalek, ed25519_compact and openssl bindings, in order of preference. But when I started with the Dalek crate, I encountered strange problems when using its getrandom feature, so I rewrote the thing for ed25519_compact. Quite a lot seems to have happened since then - I did not see any of the issues I had back then when I re-rewrote the thing just now.

This train of rewrites is the main motivation behind me implementing two versions of the API. I really wanted to have an interface that does not leak the underlying X25519 library - this is how we ended up with the untyped module. Happy to hear your thoughts, but I, for one, consider

fn tag(ours: &[u8; 32], theirs: &[u8; 32], ctr: u8, msg: &[u8]) -> [u8; 32]

... not as an improvement over C, so I wrote the typed module, too, which uses dalek types.

There is probably a third option, with an API that accepts traits and next to it a few impls for x25519 choices, but I don't think my Rust is up to that yet.

burgerdev avatar Feb 29 '24 22:02 burgerdev

Looks interesting, but my Rust is at a hello world level, so probably can't do a good review here :)

vvidic avatar Mar 07 '24 20:03 vvidic

This looks straightforward and simple now. Thank you! :D

I had one question on chat if you can now implement these traits from another crate. And two things I stumbled upon was the dalek import from lib and lib being no_std. But I'd be happy to merge this as-is. The PR is still technically in draft mode, though. (And I understand that there are the TODOs in the code, so maybe we still want to extend TagArgs a little bit before merging?

pkern avatar Apr 12 '24 08:04 pkern

This should be good to review now, I'll add a Github Action later on.

burgerdev avatar Jun 01 '24 10:06 burgerdev

@nicmue could you please take a look at this PR, with particular attention to module structure, Rust best practices and the test implementation? I wonder if there's a better way to execute all test vectors for a given PublicKey/PrivateKey implementation.

burgerdev avatar Jun 01 '24 10:06 burgerdev

@nicmue Thanks so much for the review, and sorry for taking some time to get back to it. This was really helpful, and now I know about clippy (and check, for that matter).

A follow-up to this PR should add these checks to CI.

burgerdev avatar Jun 15 '24 09:06 burgerdev

@nicmue since you are now co-author here, do you want to sign Google's CLA? Alternatively, I can remove the Co-authored-by lines from the commits if you'd prefer.

burgerdev avatar Jun 15 '24 09:06 burgerdev

@nicmue since you are now co-author here, do you want to sign Google's CLA? Alternatively, I can remove the Co-authored-by lines from the commits if you'd prefer.

Sure why not. What do I need to do? :D

nicmue avatar Jun 15 '24 10:06 nicmue

The CLA bot check failure has some info: https://github.com/google/glome/pull/175/checks?check_run_id=26263501184. tl;dr: sign in to https://cla.developers.google.com/clas and agree to the terms.

burgerdev avatar Jun 17 '24 05:06 burgerdev

The CLA bot check failure has some info: https://github.com/google/glome/pull/175/checks?check_run_id=26263501184. tl;dr: sign in to https://cla.developers.google.com/clas and agree to the terms.

Done you can try to retrigger. :)

nicmue avatar Jun 17 '24 07:06 nicmue