• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tari-project / tari-crypto / 7818179339
81%

Build:
DEFAULT BRANCH: main
Ran 07 Feb 2024 04:45PM UTC
Jobs 1
Files 22
Run time 3s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

07 Feb 2024 04:42PM UTC coverage: 90.755% (-0.06%) from 90.817%
7818179339

push

github

web-flow
feat: add constant-time trait bounds (#219)

Currently, the only implementation of the `SecretKey` and `PublicKey`
traits is for Ristretto, where both
[scalars](https://github.com/dalek-cryptography/curve25519-dalek/blob/<a class=hub.com/tari-project/tari-crypto/commit/ba737a379071191158bacfa6d138f6249b12fc09">ba737a379/curve25519-dalek/src/scalar.rs#L296-L300)
and [group
elements](https://github.com/dalek-cryptography/curve25519-dalek/blob/ba737a379071191158bacfa6d138f6249b12fc09/curve25519-dalek/src/ristretto.rs#L822-L826)
use constant-time equality in their underlying `PartialEq`
implementations, and which support the `ConstantTimeEq` trait.

This PR does what it can to encourage the use of constant-time equality
for keys by doing a few things.

First, it requires that any types implementing `SecretKey` or
`PublicKey` also implement `ConstantTimeEq`. Unfortunately, this doesn't
guarantee that their `PartialEq` implementation defaults to this, and it
doesn't appear possible to enforce this at the trait level.

It also sets a good example by manually implementing `PartialEq` on the
Ristretto key types to use their `ConstantTimeEq` implementations. This
isn't strictly necessary, but hopefully helps to indicate best practice.
It also implements `ConstantTimeEq` directly as required by the new
trait bounds.

Finally, it implements `ConstantTimeEq` for `DiffieHellmanSharedSecret`
using the new trait bound, and removes a redundant `Zeroize` trait
bound.

Note that this doesn't actually change the current implementations'
behavior, and therefore incurs no performance hit.

Closes #139.

3485 of 3840 relevant lines covered (90.76%)

58.31 hits per line

Jobs
ID Job ID Ran Files Coverage
1 7818179339.1 07 Feb 2024 04:45PM UTC 22
90.76
GitHub Action Run
Source Files on build 7818179339
  • Tree
  • List 22
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • a6cef074 on github
  • Prev Build on main (#7817080501)
  • Next Build on main (#7818206641)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc