-
Notifications
You must be signed in to change notification settings - Fork 27
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
ASN.1 Integer minimal encoding is required per X.690-0207 Section 8.3.2 #209
Conversation
Thank you! I approved CI run. I’ll take more time for reviewing next Monday 😃 |
picky-asn1/src/wrapper.rs
Outdated
@@ -379,8 +394,14 @@ impl IntegerAsn1 { | |||
} | |||
} | |||
|
|||
// TODO: This method should probably take a `&[u8]`: |
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.
We can’t take owership of bytes anymore in this case though. Is start == 0
not common enough? Also, do you have code in mind requiring keeping the bytes
at call site? In my experience the input object is never used again once the IntegerAsn1 struct is built.
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 can remove this comment if you would like... but in our usage, we are trying to translate an EccParameter
into an IntegerAsn1
. The EccParameter
only has a value()
method that allows one to obtain a &[u8]
which represents the parameter:
https://docs.rs/tss-esapi/latest/tss_esapi/structures/struct.EccParameter.html
As it stands, I believe our only option is to convert .to_vec()
the &[u8]
in order to construct the IntegerAsn1
... and in the scenario where a resize needs to take place, we slice the Vec and create yet another Vec, but if the parameter was a &[u8]
we could avoid one of the Vec
conversions.
Alternatively, if the API took a mut Vec
then we could drain(0..start)
and avoid the need for the extra Vec
allocation.
...although, perhaps all of this is premature optimization.
@CBenoit how would you like me to proceed? Would you like me to remove the comment in regard to taking a |
I’m open to changing the API to a |
How about if I just remove this comment for now, that idea can always be addressed in a separate PR. |
36d697e
to
1b2f863
Compare
Sounds good! |
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.
Looks good to me! Thank you 😄
I’ll publish next candidate version next Monday!
Thanks! |
picky-asn1 0.7.2 contains a fix for occasional incorrect ASN1 Integer builds: Devolutions/picky-rs#209 Fixes: parallaxsecond#101 Signed-off-by: Anton Antonov <[email protected]>
picky-asn1 0.7.2 contains a fix for occasional incorrect ASN1 Integer builds: Devolutions/picky-rs#209 Signed-off-by: Anton Antonov <[email protected]>
picky-asn1 0.7.2 contains a fix for occasional incorrect ASN1 Integer builds: Devolutions/picky-rs#209 Signed-off-by: Anton Antonov <[email protected]>
Validation of ASN1.Integer in Go code was failing due to the encoding not being minimal, and the spec indicates that it is required to be minimal.