Skip to content

tor-llcrypto: CtByteArray derives Deref

The documentation for tor_llcrypto::util::ct::CtByteArray ends with the warning:

/// # Limitations
///
/// It is possible to avoid constant time comparisons here, just by using the
/// `as_ref()` and `as_mut()` methods.  They should therefore be approached with
/// some caution.
///
/// (The decision to avoid implementing `Deref`/`DerefMut` is deliberate.)

However, CtByteArray DOES in fact implement Deref; we started deriving it way back in !1070 (merged).

It's pretty easy to fix; either change the docs or stop deriving Deref and use manual as_ref to fix compile errors.

If this is something we want fixed, please assign this to me and I'll have an MR ready to go. If not specified, I will assume I should fix it by no longer deriving Deref.

/cc @nickm as the original author of the warning (and CtByteArray as a whole)