-
Notifications
You must be signed in to change notification settings - Fork 55
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
mul_wide
inconsistencies
#4
Comments
tarcieri
changed the title
crypto-bigint:
Sep 14, 2021
mul_wide
inconsistenciesmul_wide
inconsistencies
tarcieri
added a commit
that referenced
this issue
Nov 13, 2021
Fixes the inconsistency between `UInt::mul_wide` and `Limb::mul_wide` by reversing the order of the `UInt` version so it returns `(lo, hi)`. This follows the "little endian" approach used in the rest of this crate for consistency. Closes #4
tarcieri
added a commit
that referenced
this issue
Nov 13, 2021
Fixes the inconsistency between `UInt::mul_wide` and `Limb::mul_wide` by reversing the order of the `UInt` version so it returns `(lo, hi)`. This follows the "little endian" approach used in the rest of this crate for consistency. Closes #4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RustCrypto/utils#563 corrected a bug in
wrapping_mul
, however it seems the real issue might've been in the return value ofmul_wide
Right now the return values are the following:
UInt::mul_wide
->(hi, lo)
Limb::mul_wide
->(lo, hi)
It seems RustCrypto/utils#563 might've been caused by assuming the latter worked like the former. This ordering reflects the little endian internals of this library.
Ideally these would return a
UInt
which is twice the width using aconst impl Concat
to prevent this sort of confusion, but sincemul_wide
is aconst fn
that isn't currently possible.Alternatively we could use a
struct
withlo
andhi
fields to prevent this confusion.At the very least, however, the
UInt
andLimb
versions should be consistent.The text was updated successfully, but these errors were encountered: