diff options
author | Samuel Neves <sneves@dei.uc.pt> | 2018-08-08 00:23:27 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-08-07 17:25:07 -0700 |
commit | 913b4e55505b4ca638c025163ebf3a7ce01f8b9e (patch) | |
tree | 794e4aa4f4c45efe577dccfc913afa5dfd4cbb4f /kernel-tree-scripts | |
parent | 68550c35a4e0e365bb7d8d2c338bce6aa6294396 (diff) |
curve25519-hacl64: simplify u64_eq_mask
Avoid signed right shift.
Z3 script showing equivalence:
>>> from z3 import *
>>>
>>> x = BitVec("x", 64)
>>> y = BitVec("y", 64)
>>>
>>> # Before
... x_ = ~(x ^ y)
>>> x_ &= x_ << 32
>>> x_ &= x_ << 16
>>> x_ &= x_ << 8
>>> x_ &= x_ << 4
>>> x_ &= x_ << 2
>>> x_ &= x_ << 1
>>> x_ >>= 63
>>>
>>> # After
... y_ = x ^ y
>>> y_ = y_ | -y_
>>> y_ = LShR(y_, 63) - 1
>>>
>>> prove(x_ == y_)
proved
Signed-off-by: Samuel Neves <sneves@dei.uc.pt>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'kernel-tree-scripts')
0 files changed, 0 insertions, 0 deletions