/ rust-base64 Public
Propose side-channel resistant feature #153
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.
Thanks for your great work and I really enjoy using your base64 crate :-) It's really fast!
We know that rustls has been widely adopted and it depends on
base64to parse PEM files. Recently Apache httpd is constructing a new
mod_tlsbased on rustls to replace the previous
mod_sslbased on openssl. Glad to see rustls as well as base64 will be shipped with Apache httpd as well.
Recently I received a report from a group of security researchers (email@example.com, firstname.lastname@example.org, email@example.com), saying that this base64 decoder is not constant time thus suffer from side-channel attacks. The consequence is that PEM decoder and rustls suffers from side-channel attacks. Google has a good solution in BoringSSL: https://github.com/google/boringssl/blob/master/crypto/base64/base64.c . This proposed decoding algorithm is the researcher's work. They proved it in a unpublished paper. If you're interested, I can loop you in the mailing thread.
Now the solution is feature gated by
cargo benchshows performance slowdown. But it's acceptable if we only use this feature for PEM decoding (usually not a frequent operation). If this PR got merged, I'll create another PR for rustls.
Please feel free to edit/comment. Thanks!