briansmith / ring

Safe, fast, small crypto using Rust
Other
3.7k stars 698 forks source link

Improve the documentation #669

Closed HeroicKatora closed 5 years ago

HeroicKatora commented 6 years ago

See https://arxiv.org/abs/1806.04929 , investigating cryptographical implementations in Rust.

It concludes, very briefly, that users of ring produce less unsafe cryptography due to its API but rust-crypto users are more efficient due to its extensive examples.

Also, some interfaces do not comprehensively document all of their parameters. As an example, the paper notes that the nonce and ad parameters provide no explanation thus relying fully on external gathering information.

Since this library seems to have an edge on the technical side, I expect that we can improve the documentation to at least the level provided by other libraries.

briansmith commented 6 years ago

Thanks. Definitely we need to improve the documentation.

The bigger learnability problem with the AEAD interface, IMO, is actually that the API is hard to use. Thus, I've avoided documenting the current API because I want to replace the API with one that's easier to use and then document that new API.

HeroicKatora commented 6 years ago

I agree that documentation should be a focussed effort after a clear interface has been established.

This would also prevent outdated or unclear examples, which might end up giving a false sense of security. For example, it was also noted that some examples in other libraries are using unauthenticated crypto or defaulting to PKCS padding. Those weaker primitives are then carried over into actual code by inexperienced developers or because their downsides are not clearly marked for the sake of keeping the examples simple. The last point is, imho, a smell that the api could be better.

Without getting side tracked, such example documentation could also be a kind of Litmus test on the usability of the interface.

HeroicKatora commented 6 years ago

There are other interfaces that could use polish. Many come from personal experience in different contexts:

Edit: this grew larger than initially expected. Maybe we should split this and track it separately.

briansmith commented 5 years ago

Thanks. I agree with the idea of #671 and I hope to get to that soon.

I'm closing this issue. Rather than have a tracking issue tracking the need for better documentation, let's just have people write specific PRs that improve the APIs and documentation one at at time.