Add typos action and correct typos (#766)

* Add `typos` action and correct typos

https://github.com/crate-ci/typos

* Add `name` to `typos` job
This commit is contained in:
Tony Arcieri 2025-06-04 09:40:10 -06:00 committed by GitHub
parent 83ddc4b34b
commit 5e0b429b05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 35 additions and 9 deletions

View file

@ -109,3 +109,10 @@ jobs:
with:
toolchain: stable
- run: cargo doc --all-features
typos:
name: Check for typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@v1.33.1

19
.typos.toml Normal file
View file

@ -0,0 +1,19 @@
[files]
extend-exclude = [
".git/",
"*.svg",
"TESTVECTORS"
]
[default]
extend-ignore-re = [
# Patterns which appear to be 36 or more characters of Base64/Base64url
'\b[0-9A-Za-z+/]{36,}\b',
'\b[0-9A-Za-z_-]{36,}\b',
]
[default.extend-words]
"AKE" = "AKE" # Authenticated Key Exchange
"Ono" = "Ono" # Surname
"Tung" = "Tung" # Name
"Monts" = "Monts" # Abbreviation for Montgomery

View file

@ -84,7 +84,7 @@ fn main() {
}
}
Ok("unstable_avx512") if !nightly => {
panic!("Could not override curve25519_dalek_backend to unstable_avx512, as this is nigthly only");
panic!("Could not override curve25519_dalek_backend to unstable_avx512, as this is nightly only");
}
// default between serial / simd (if potentially capable)
_ => match is_capable_simd(&target_arch, curve25519_dalek_bits) {

View file

@ -90,7 +90,7 @@ pub trait MultiscalarMul {
/// # Examples
///
/// The trait bound aims for maximum flexibility: the inputs must be
/// convertable to iterators (`I: IntoIter`), and the iterator's items
/// convertible to iterators (`I: IntoIter`), and the iterator's items
/// must be `Borrow<Scalar>` (or `Borrow<Point>`), to allow
/// iterators returning either `Scalar`s or `&Scalar`s.
///
@ -211,7 +211,7 @@ pub trait VartimeMultiscalarMul {
/// # Examples
///
/// The trait bound aims for maximum flexibility: the inputs must be
/// convertable to iterators (`I: IntoIter`), and the iterator's items
/// convertible to iterators (`I: IntoIter`), and the iterator's items
/// must be `Borrow<Scalar>` (or `Borrow<Point>`), to allow
/// iterators returning either `Scalar`s or `&Scalar`s.
///
@ -318,7 +318,7 @@ pub trait VartimePrecomputedMultiscalarMul: Sized {
/// length than \\(B_j\\).
///
/// The trait bound aims for maximum flexibility: the input must
/// be convertable to iterators (`I: IntoIter`), and the
/// be convertible to iterators (`I: IntoIter`), and the
/// iterator's items must be `Borrow<Scalar>`, to allow iterators
/// returning either `Scalar`s or `&Scalar`s.
fn vartime_multiscalar_mul<I>(&self, static_scalars: I) -> Self::Point
@ -352,7 +352,7 @@ pub trait VartimePrecomputedMultiscalarMul: Sized {
/// the same length.
///
/// The trait bound aims for maximum flexibility: the inputs must be
/// convertable to iterators (`I: IntoIter`), and the iterator's items
/// convertible to iterators (`I: IntoIter`), and the iterator's items
/// must be `Borrow<Scalar>` (or `Borrow<Point>`), to allow
/// iterators returning either `Scalar`s or `&Scalar`s.
fn vartime_mixed_multiscalar_mul<I, J, K>(

View file

@ -73,7 +73,7 @@ fn check_scalar(bytes: [u8; 32]) -> Result<Scalar, SignatureError> {
// potential non-reduced scalars is performed.
//
// This is compatible with ed25519-donna and libsodium when
// -DED25519_COMPAT is NOT specified.
// `-D ED25519_COMPAT` is NOT specified.
if bytes[31] & 224 != 0 {
return Err(InternalError::ScalarFormat.into());
}

View file

@ -81,7 +81,7 @@ fn get_algo_identifier() {
assert_eq!(identifier.oid, ed25519::pkcs8::ALGORITHM_OID);
let signing_key = SigningKey::from_bytes(&SK_BYTES);
let identifer = signing_key.signature_algorithm_identifier().unwrap();
assert!(identifer.parameters.is_none()); // According to rfc8410 this must be None
assert_eq!(identifer.oid, ed25519::pkcs8::ALGORITHM_OID);
let identifier = signing_key.signature_algorithm_identifier().unwrap();
assert!(identifier.parameters.is_none()); // According to rfc8410 this must be None
assert_eq!(identifier.oid, ed25519::pkcs8::ALGORITHM_OID);
}