Skip to content
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

Symbolic bit rotates by more than word size have wrong semantics #160

Closed
brianhuffman opened this issue Jan 16, 2015 · 0 comments
Closed

Comments

@brianhuffman
Copy link
Contributor

Rotation of a bitvector x : [n] works correctly for rotation amounts less than n, but not for n or above:

Cryptol> 0x01 <<< 8 == 0x01
True
Cryptol> :prove 0x01 <<< 8 == 0x01
(0x01 <<< 8 == 0x01) = False

Currently, rotations by n or more result in zero:

Cryptol> :sat (==) [ 0x8 <<< (i:[3]) | i <- [0..7] ]
(==) [0x8 <<< (i : [3]) | i <- [0 .. 7]] [0x8, 0x1, 0x2, 0x4, 0x0,
                                          0x0, 0x0, 0x0] = True

The correct behavior would be to reduce the rotation amount modulo n before doing the rotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant