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
aes-kw: no_std
support + other cleanups
#7
Conversation
- Makes the `Kek::{wrap, unwrap}` functions take an output buffer rather than allocating a `Vec<u8>`, allowing them to be used in heapless `no_std` contexts. - Adds an `alloc` feature along with `Kek::{wrap_vec, unwrap_vec}` functions which provided the previous API. - Adds convenience `KekAes128`/`KekAes192`/`KekAes256` type aliases. - Makes the `IV` and `IV_LEN` constants public. - Removes the use of `hex` for test vectors replacing it with `hex-literal` instead. - Improves README.md and rustdoc documentation.
aes-kw/src/error.rs
Outdated
/// Input data length invalid. | ||
InvalidDataLength, | ||
/// Invalid kek size. | ||
InvalidKekSize(usize), | ||
/// Output buffer size invalid. | ||
InvalidOutputSize { | ||
/// Expected size in bytes. | ||
expected: usize, | ||
}, | ||
/// Integrity check did not pass. | ||
IntegrityCheckFailed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like these could be a little more consistent:
*Length
vs*Size
- Tuple variant vs one with named fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably suggest settling on *Size
(it's what we tend to use in other crates, and also shorter).
I'd also suggest changing InvalidKekSize { size: usize }
for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, makes sense to standardize on size
@@ -8,8 +9,41 @@ | |||
#![forbid(unsafe_code)] | |||
#![warn(missing_docs, rust_2018_idioms)] | |||
|
|||
//! # Usage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to move the usage out of README.md in order to be able to feature-gate the doctests, unfortunately.
Otherwise they fail unless the correct features are available.
ed4ba84
to
4415799
Compare
4415799
to
1ff6729
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
I think this is ready to release then? @dignifiedquire anything else? Should I cut a release or do you want to? |
Functionally, looks good. Just upd Deno PR to use latest commit, and is now passing 100% of WPT (WebCrypto/wrapKey_unwrapKey) and JOSE (AxxxKW) tests! Great work, guys. Thanks a lot for your effort and patience ;) |
Kek::{wrap, unwrap}
functions take an output buffer rather than allocating aVec<u8>
, allowing them to be used in heaplessno_std
contexts.alloc
feature along withKek::{wrap_vec, unwrap_vec}
functions which provided the previous API.KekAes128
/KekAes192
/KekAes256
type aliases.IV
andIV_LEN
constants public.hex
for test vectors replacing it withhex-literal
instead.