Repository navigation
Modifications to PR #262 made during review. - #344
briansmith wants to merge 0 commit into
Conversation
There was a problem hiding this comment.
:sigh: All of these changes are just supposed to be un-indenting and re-wrapping the code.
There was a problem hiding this comment.
Ditto. I'll verify that I didn't actually change the code in any significant way other than reformatting it.
samscott89
left a comment
There was a problem hiding this comment.
Changes look great. Left a few minor formatting comments. Other than that I think the only thing to be addressed is the lack of PSS padding tests.
There was a problem hiding this comment.
This condition fits fine on one line.
There was a problem hiding this comment.
I've now split it into two conditions so that the code coverage can see whether we're testing both checks.
There was a problem hiding this comment.
Space missing from start of the line.
There was a problem hiding this comment.
(Next line would need an additional space as well)
There was a problem hiding this comment.
This also fits in one 80-char line now.
There was a problem hiding this comment.
Out of curiosity: why assert over debug_assert or returning an error?
There was a problem hiding this comment.
I changed it to a debug_assert!.
There was a problem hiding this comment.
Since you've added iter in untrusted 0.3.2, is it worth updating this code to use that instead, similarly to how you've written the equivalent code in encode?
There was a problem hiding this comment.
Yes, that's exactly what I want to happen.
There was a problem hiding this comment.
Spaces around the operator: mod_len * 8?
There was a problem hiding this comment.
As you commented in the other thread, PUBLIC_MODULUS_MAX_BITS is a better name for this.
There was a problem hiding this comment.
Outstanding tasks for this file:
- Rename to
rsa_pss_verify_padding_tests.txt. - Add failing cases.
- Cover more digest types.
Would it be simpler to add these cases to the existing rsa_pss_verify_tests.txt file instead? The only reason I could see that these should have independent tests is if the padding functions were made public.
There was a problem hiding this comment.
I can make a start on adding failing cases.
There was a problem hiding this comment.
Should the closing bracket be on the line below, at the same indentation level as line 127?
There was a problem hiding this comment.
These lines can be deleted since we not longer store the NIST tests here.
|
@samscott89 Please check out the new commits I appended to this series to address your concerns. Let me know if you want me to squash them into the prior commits before or after you review them. Pay special attention to the change I made to the PSS encoding, passing in the actual bit length of the public modulus instead of Also, do you want to take over the remaining tasks? I definitely don't want to steal this from you. |
|
Changes Unknown when pulling 5f139ea on padding into * on master*. |
1 similar comment
|
Changes Unknown when pulling 5f139ea on padding into * on master*. |
| use error; | ||
|
|
||
| #[derive(Clone, Copy, Eq, PartialEq)] | ||
| pub struct BitLength { |
There was a problem hiding this comment.
Should this be called just Length since it will presumably always be used as bits::Length vs bits::BitLength?
Also, is this not practically the canonical example for using newtypes?
There was a problem hiding this comment.
I agree it's weird to have bits::BitLength but I also think bits::Length or bit::Length is too clever. I found out that these names that only make sense with module prefixes don't work well in rustdoc (see error::Unspecified which rustdoc presents as just Unspecified, which is confusing).
I think we probably should create a "prelude" of common types that are used internally in ring and use those types (only) unprefixed. I think BitLength is a prime candidate for that.
There was a problem hiding this comment.
Regarding newtypes, see #350. The problem is that we have to constructors: from bits, and from bytes. A newtype would make the from-bits constructor implicit, but I'd rather have the constructors be used explicitly. However, we may want to switch to newtype style if it helps work around the lack of const fn.
|
Yup, all looks good to me. The
I'm more than happy to, and allow you to move onto something else. I think you've given me enough help at this point for me to get it across the finish line. I'm not worried about it being 'stolen' from me though, I'm just looking to learn/help as much as I can. If you could squash it down to a reasonable number of commits (perhaps original commit + review or something?), that would be great. I'll then pull the |
|
Changes Unknown when pulling 5f139ea on padding into * on master*. |
1 similar comment
|
Changes Unknown when pulling 5f139ea on padding into * on master*. |
I filed #350 for this.
I think we should just assume all non-BitLength lengths are in bytes. Otherwise we'd have to move ByteLength (at least) to untrusted.
Will do. |
|
I squashed and landed all these changes onto master. See discussion in #262. |
@samscott89 Could you please take a look at these changes I am proposing for your PR?