Skip to content

Commit 79a91a3

Browse files
remove unused code
1 parent 66c6e32 commit 79a91a3

File tree

1 file changed

+1
-52
lines changed

1 file changed

+1
-52
lines changed

src/lib.rs

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// -*- mode: rust; -*-
22
//
33
// This file is part of subtle, part of the dalek cryptography project.
4-
// Copyright (c) 2016-2022 isis lovecruft, Henry de Valence
4+
// Copyright (c) 2016-2023 isis lovecruft, Henry de Valence
55
// See LICENSE for licensing information.
66
//
77
// Authors:
@@ -254,30 +254,6 @@ pub trait IteratedOperation {
254254
fn extract_result(self) -> Choice;
255255
}
256256

257-
/// Implementing this trait automatically implements [`ConstantTimeEq`] and/or
258-
/// [`ConstantTimeGreater`], depending on [`Self::To`].
259-
///
260-
///```
261-
/// use subtle::{ConstantTimeEq, ConstantTimeGreater, Convertible};
262-
///
263-
/// struct S(pub u8);
264-
/// impl Convertible for S {
265-
/// type To = u8;
266-
/// fn for_constant_operation(&self) -> u8 { self.0 }
267-
/// }
268-
///
269-
/// assert_eq!(0, S(0).ct_eq(&S(1)).unwrap_u8());
270-
/// assert_eq!(1, S(1).ct_eq(&S(1)).unwrap_u8());
271-
/// assert_eq!(1, S(1).ct_gt(&S(0)).unwrap_u8());
272-
/// assert_eq!(0, S(1).ct_gt(&S(1)).unwrap_u8());
273-
///```
274-
pub trait Convertible {
275-
/// The type to convert to.
276-
type To;
277-
/// Convert to a constant-time comparable object.
278-
fn for_constant_operation(&self) -> Self::To;
279-
}
280-
281257
/// An `Eq`-like trait that produces a `Choice` instead of a `bool`.
282258
///
283259
/// # Example
@@ -350,15 +326,6 @@ impl IteratedEq {
350326
}
351327
}
352328

353-
impl<T: ConstantTimeEq, C: Convertible<To = T>> ConstantTimeEq for C {
354-
#[inline]
355-
fn ct_eq(&self, other: &Self) -> Choice {
356-
let a: T = self.for_constant_operation();
357-
let b: T = other.for_constant_operation();
358-
a.ct_eq(&b)
359-
}
360-
}
361-
362329
impl<T: ConstantTimeEq> ConstantTimeEq for [T] {
363330
/// Check whether two slices of `ConstantTimeEq` types are equal.
364331
///
@@ -927,15 +894,6 @@ impl LexicographicIteratedGreater {
927894
}
928895
}
929896

930-
impl<T: ConstantTimeGreater, C: Convertible<To = T>> ConstantTimeGreater for C {
931-
#[inline]
932-
fn ct_gt(&self, other: &Self) -> Choice {
933-
let a: T = self.for_constant_operation();
934-
let b: T = other.for_constant_operation();
935-
a.ct_gt(&b)
936-
}
937-
}
938-
939897
macro_rules! generate_unsigned_integer_greater {
940898
($t_u: ty, $bit_width: expr) => {
941899
impl ConstantTimeGreater for $t_u {
@@ -1141,12 +1099,3 @@ impl LexicographicIteratedLess {
11411099
*was_gt |= b.ct_lt(&a);
11421100
}
11431101
}
1144-
1145-
impl<T: ConstantTimeLess, C: Convertible<To = T>> ConstantTimeLess for C {
1146-
#[inline]
1147-
fn ct_lt(&self, other: &Self) -> Choice {
1148-
let a: T = self.for_constant_operation();
1149-
let b: T = other.for_constant_operation();
1150-
a.ct_lt(&b)
1151-
}
1152-
}

0 commit comments

Comments
 (0)