mirror of
https://github.com/saymrwulf/risc0-curve25519-dalek-source.git
synced 2026-09-07 20:30:39 +00:00
Rename subtle::bytes_equal_ct() to bytes_equal().
This commit is contained in:
parent
1c4f283be4
commit
648f95887a
2 changed files with 4 additions and 4 deletions
|
|
@ -91,7 +91,7 @@ use constants;
|
||||||
use field::FieldElement;
|
use field::FieldElement;
|
||||||
use scalar::Scalar;
|
use scalar::Scalar;
|
||||||
use subtle::arrays_equal;
|
use subtle::arrays_equal;
|
||||||
use subtle::bytes_equal_ct;
|
use subtle::bytes_equal;
|
||||||
use subtle::CTAssignable;
|
use subtle::CTAssignable;
|
||||||
use subtle::CTEq;
|
use subtle::CTEq;
|
||||||
use subtle::CTNegatable;
|
use subtle::CTNegatable;
|
||||||
|
|
@ -1081,7 +1081,7 @@ fn select_precomputed_point<T>(x: i8, points: &[T; 8]) -> T
|
||||||
for j in 1..9 {
|
for j in 1..9 {
|
||||||
// Copy `points[j-1] == j*P` onto `t` in constant time if `|x| == j`.
|
// Copy `points[j-1] == j*P` onto `t` in constant time if `|x| == j`.
|
||||||
t.conditional_assign(&points[j-1],
|
t.conditional_assign(&points[j-1],
|
||||||
bytes_equal_ct(xabs as u8, j as u8));
|
bytes_equal(xabs as u8, j as u8));
|
||||||
}
|
}
|
||||||
// Now t == |x| * P.
|
// Now t == |x| * P.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ impl<T> CTNegatable for T
|
||||||
///
|
///
|
||||||
/// Returns `1u8` if `a == b` and `0u8` otherwise.
|
/// Returns `1u8` if `a == b` and `0u8` otherwise.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn bytes_equal_ct(a: u8, b: u8) -> u8 {
|
pub fn bytes_equal(a: u8, b: u8) -> u8 {
|
||||||
let mut x: u8;
|
let mut x: u8;
|
||||||
|
|
||||||
x = !(a ^ b);
|
x = !(a ^ b);
|
||||||
|
|
@ -149,7 +149,7 @@ pub fn arrays_equal(a: &[u8], b: &[u8]) -> u8 {
|
||||||
for i in 0 .. a.len() {
|
for i in 0 .. a.len() {
|
||||||
x |= a[i] ^ b[i];
|
x |= a[i] ^ b[i];
|
||||||
}
|
}
|
||||||
bytes_equal_ct(x, 0)
|
bytes_equal(x, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue