commit_hash
stringlengths
40
40
author
stringlengths
1
57
date
timestamp[s]date
2010-07-26 04:45:09
2026-04-14 18:21:10
message
stringlengths
8
1.39M
diff
stringlengths
68
51.2k
files_changed
int64
1
136
insertions
int64
0
2.35k
deletions
int64
0
1.9k
8e1fff418a58f6a4353e674264f5e95582182830
Yehonatan Cohen Scaly
2023-11-14T23:28:13
k256+primeorder: add `BatchInvert` and `BatchNormalize` impls (#971)
diff --git a/Cargo.lock b/Cargo.lock index 256e5cac..d2209256 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -372,8 +372,7 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-in...
18
426
28
cbbf27e212f8c6f5e64053ae7a14917a27486cae
Tony Arcieri
2023-11-11T20:05:38
p521: get rid of private `MODULUS_HEX` constant (#970) It has extra unnecessary zeros to allow decoding as a U576 which are undesirable in a string representation.
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index 9bbee554..62948995 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -46,11 +46,8 @@ use elliptic_curve::{ #[cfg(target_pointer_width = "32")] use super::util; -/// Constant representing the modulus serializ...
1
3
6
91a5b3282840c78e86bb4ee6ccb21e822d59dcf0
Tony Arcieri
2023-11-11T19:38:09
p521: merge `u576_to_le_bytes` into `FieldBytes::from_uint_unchecked` (#969) Moves `u576_to_le_bytes` from the `util` module to inside of `from_uint_unchecked`. The old function in the `util` module was not general-purpose, but specialized to the case of decoding P-521 base field elements in the unsaturated form...
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index 2dc67c14..9bbee554 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -43,7 +43,8 @@ use elliptic_curve::{ Error, FieldBytesEncoding, }; -use super::util::u576_to_le_bytes; +#[cfg(target_pointer_width = "...
2
35
34
0b28c07408b267f735343dc1f6a41a11aeaead79
Tony Arcieri
2023-11-11T14:53:04
p521: fix panics when decoding `FieldElement`s (#967) Some `debug_assert!`s were getting triggered on inputs that need to be handled without panicking. Fixes #965
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index 3bc4a93e..b8e7344c 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -630,6 +630,7 @@ impl<'a> Product<&'a FieldElement> for FieldElement { mod tests { use super::FieldElement; use elliptic_curve::ff:...
2
9
14
f19ccf0aa0a906122d432834e0c358ea7c557cf6
Tony Arcieri
2023-11-11T14:19:06
p521: move `Debug` impl for `FieldElement` (#966) Puts it with the other trait impls
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index 96e355a7..3bc4a93e 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -30,6 +30,7 @@ pub(crate) use self::loose::LooseFieldElement; use self::field_impl::*; use crate::{FieldBytes, NistP521, U576}; use core::{...
1
36
34
d128d2dc1addeee28644cec47bb7ceaa6e63745d
Tony Arcieri
2023-11-10T02:55:42
p521: `serde` feature (#962) Adds `serde::{Serialize, Deserialize}` impls for `AffinePoint` and `Scalar`.
diff --git a/Cargo.lock b/Cargo.lock index c35b0a45..e05fbe62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -785,6 +785,7 @@ dependencies = [ "hex-literal", "primeorder", "rand_core", + "serdect", "sha2", ] diff --git a/p521/Cargo.toml b/p521/Cargo.toml index 9d7fd6bd..18829e28 100644 --- a/p521/Cargo.toml +++...
4
34
1
c3deb5addd8f64e48223bc8012b5695b2cf510df
Tony Arcieri
2023-11-10T02:10:40
p521: remove `pub` from `arithmetic` module (#961) The relevant types from the `arithmetic` module are available via re-exports, so direct access to the module is unnecessary. It was accidentally exposed in the v0.13.1 release (#958). Exposing the module directly is inconsistent with p192/p224/p256/p384, so this...
diff --git a/p521/src/lib.rs b/p521/src/lib.rs index a86043de..83a61a5c 100644 --- a/p521/src/lib.rs +++ b/p521/src/lib.rs @@ -16,7 +16,7 @@ )] #[cfg(feature = "arithmetic")] -pub mod arithmetic; +mod arithmetic; #[cfg(feature = "ecdh")] pub mod ecdh; diff --git a/p521/tests/projective.rs b/p521/tests/projectiv...
2
2
2
269502a269106337feb59f6e20854e9c2d250fad
Tony Arcieri
2023-11-10T01:02:10
k256: fix typo in field_5x52.rs (#959)
diff --git a/k256/src/arithmetic/field/field_5x52.rs b/k256/src/arithmetic/field/field_5x52.rs index 3653ec50..fbb97330 100644 --- a/k256/src/arithmetic/field/field_5x52.rs +++ b/k256/src/arithmetic/field/field_5x52.rs @@ -1,4 +1,4 @@ -//! Field element modulo the curve internal modulus using 32-bit limbs. +//! Field e...
1
1
1
7862950c276591e9661b88b619987cc593edad0d
Yehonatan Cohen Scaly
2023-11-09T00:29:18
k256: rename `lincomb_generic` to `lincomb` and expose it. (#955)
diff --git a/k256/src/arithmetic.rs b/k256/src/arithmetic.rs index b6ba5673..d738c091 100644 --- a/k256/src/arithmetic.rs +++ b/k256/src/arithmetic.rs @@ -12,6 +12,7 @@ pub(crate) mod scalar; mod dev; pub use field::FieldElement; +pub use mul::lincomb; use self::{affine::AffinePoint, projective::ProjectivePoint,...
3
5
4
8d3b67e0f0467a8e713b888b30a140dc54ce31bd
Tony Arcieri
2023-11-03T01:35:06
p521: add `ecdh` feature (#954) Adds a feature for performing elliptic curve Diffie-Hellman
diff --git a/Cargo.lock b/Cargo.lock index 79616e19..b7caf0cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -782,6 +782,7 @@ dependencies = [ "elliptic-curve", "hex-literal", "primeorder", + "rand_core", "sha2", ] diff --git a/p521/Cargo.toml b/p521/Cargo.toml index 42f02924..50071a94 100644 --- a/p521/Cargo.t...
4
57
0
3a19153b256e79021c0594fc1c6c46adeba0cc04
Tony Arcieri
2023-11-03T00:10:44
p521: `arithmetic` feature (#953) Now that #946, #950, and #951 have landed it seems prudent to add a real `arithmetic` feature. This adds a feature similar to the other crates in this repo which exposes the following types which provide a curve arithmetic implementation: - `AffinePoint` - `ProjectivePoint` ...
diff --git a/p521/Cargo.toml b/p521/Cargo.toml index 98b8b937..42f02924 100644 --- a/p521/Cargo.toml +++ b/p521/Cargo.toml @@ -29,15 +29,15 @@ hex-literal = "0.4" primeorder = { version = "0.13.3", features = ["dev"], path = "../primeorder" } [features] -default = ["pem", "std"] +default = ["arithmetic", "pem", "st...
3
7
4
e77b79860a5a2f7292c3399fdba93c29c6e77fb3
Tony Arcieri
2023-11-02T22:32:42
p521: fix projective arithmetic tests (#951) The tests added in #950 weren't actually running due to feature gating (the feature is named `wip-arithmetic-do-not-use`, but the conditional gating was using `arithmetic` instead). It turns out a small modification to `primeorder` was needed, since the `impl_projecti...
diff --git a/p521/Cargo.toml b/p521/Cargo.toml index b88f63dc..14a4e6d4 100644 --- a/p521/Cargo.toml +++ b/p521/Cargo.toml @@ -26,6 +26,7 @@ base16ct = "0.2.0" [dev-dependencies] hex-literal = "0.4" +primeorder = { version = "0.13", features = ["dev"], path = "../primeorder" } [features] default = ["pem", "std"...
4
15
9
81f6087bdcfda22b2fc30836849a9e75af641913
Arvind Mukund
2023-11-02T22:20:15
p521: Improve `Debug` for unsaturated math (#949) When using p521, the limbs can be populated differently which when deriving [`Debug`] shows up as different values for equal FieldElements, this can lead to confusion. See: - https://github.com/RustCrypto/elliptic-curves/pull/946#issuecomment-1789749836, equal ...
diff --git a/Cargo.lock b/Cargo.lock index 82af62d2..97c603e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -778,6 +778,7 @@ dependencies = [ name = "p521" version = "0.13.0" dependencies = [ + "base16ct", "elliptic-curve", "hex-literal", "primeorder", diff --git a/p521/Cargo.toml b/p521/Cargo.toml index de426f0...
3
37
1
f9916b2eeb70edabfb85a719959ccb7e36d18c4f
Tony Arcieri
2023-11-02T21:58:52
p521: projective arithmetic tests (#950) Uses `impl_projective_arithmetic_tests!` to test projective arithmetic against a set of test vectors. Includes test vectors from: http://point-at-infinity.org/ecc/nisttv
diff --git a/Cargo.lock b/Cargo.lock index ab0300e2..82af62d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -779,6 +779,7 @@ name = "p521" version = "0.13.0" dependencies = [ "elliptic-curve", + "hex-literal", "primeorder", "sha2", ] diff --git a/p521/Cargo.toml b/p521/Cargo.toml index 5b2a2dea..de426f0a 100644 ...
6
289
0
a9e16d0a8885fb09a3e99833fd3e820fd0073956
Tony Arcieri
2023-11-02T18:34:54
p521: remove unneeded allow(dead_code) attribute
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index 1f75aca7..5230e879 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -601,7 +601,6 @@ mod tests { }; /// t = (modulus - 1) >> S - #[allow(dead_code)] const T: [u64; 9] = [ 0xffffffff...
1
0
1
a7a39d9cffeb2837d9387a50c6908f6762ace798
Arvind Mukund
2023-11-02T18:11:28
p521: Improve field arithmetic (#948) - sqn: Has an extra copy - sqrt: Can have simplified math Signed-off-by: Arvind Mukund <armu30@gmail.com>
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index 9651a2d4..1f75aca7 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -201,8 +201,8 @@ impl FieldElement { /// Returns self^(2^n) mod p const fn sqn(&self, n: usize) -> Self { - let mut x = *se...
1
13
17
6fd4817ec41a3ba5cbc035d0e387c59b87f5efc6
Tony Arcieri
2023-11-02T16:46:02
p521: impl `FieldElement::{sqrt, invert}` and add basic field tests (#946) Implements `sqrt` using Shank's algorithm, and `invert` using an addition chain originally from #787. Changes the `ConstantTimeEq` implementation to compare `FieldElement`s using `fiat_p521_to_bytes` output. Also adds basic tests for va...
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index 0a57b35a..9651a2d4 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -42,7 +42,7 @@ use elliptic_curve::{ Error, FieldBytesEncoding, }; -use super::util::uint_to_le_bytes_unchecked; +use super::util::u57...
2
100
11
1f6eb5be686e876736038cb4d62d88b06ea82b75
Arvind Mukund
2023-11-01T01:38:15
p521: Use unsaturated limbs (#945) `U576::words()` returns saturated 64-bit limbs but the field arithmetic for tight points require 59-bit limbs, convert it into a little endian byte array and let `fiat-crypto` deal with the unsaturation. Signed-off-by: Arvind Mukund <armu30@gmail.com>
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index de625f54..0a57b35a 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -42,8 +42,7 @@ use elliptic_curve::{ Error, FieldBytesEncoding, }; -#[cfg(target_pointer_width = "32")] -use super::util::u32x18_to_u6...
2
48
14
1c243c8989e348789fdb0c480c081f7b0076e979
Jack Lloyd
2023-10-18T22:41:35
Add inline annotations on conditional_select in p256, k256, and primeorder (#942) This seems to help situations where the Rust compiler otherwise will not completely inline conditional_select, causing algoritms which depend on this to become significantly slower than they would otherwise. See #940 for discussion.
diff --git a/k256/src/arithmetic/field.rs b/k256/src/arithmetic/field.rs index 6e97ee78..7e68f1b4 100644 --- a/k256/src/arithmetic/field.rs +++ b/k256/src/arithmetic/field.rs @@ -323,6 +323,7 @@ impl PrimeField for FieldElement { } impl ConditionallySelectable for FieldElement { + #[inline(always)] fn condi...
7
7
0
57bbeb61e985c54c00296c3101f9b57fe96ba605
Tony Arcieri
2023-10-03T13:36:51
k256: fix comment (#929) Copy/paste where NIST P-256 wasn't changed to secp256k1
diff --git a/k256/src/ecdh.rs b/k256/src/ecdh.rs index 2ab73bc0..ffaf138d 100644 --- a/k256/src/ecdh.rs +++ b/k256/src/ecdh.rs @@ -40,7 +40,7 @@ pub use elliptic_curve::ecdh::diffie_hellman; use crate::{AffinePoint, Secp256k1}; -/// NIST P-256 Ephemeral Diffie-Hellman Secret. +/// secp256k1 Ephemeral Diffie-Hellma...
1
1
1
c74d363a7c60acf6f34cc8b25ca9acb9b26e8b7d
crwn1337
2023-08-31T20:15:24
p521: add initial VOPRF support (#924)
diff --git a/Cargo.lock b/Cargo.lock index b2ddf688..d2ec03bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -790,6 +790,7 @@ version = "0.13.0" dependencies = [ "elliptic-curve", "primeorder", + "sha2", ] [[package]] diff --git a/p521/Cargo.toml b/p521/Cargo.toml index f80160e8..5b2a2dea 100644 --- a/p521/Cargo....
3
12
0
d8e44b0440dbf61b1c42fe02e4e95b4f0e55ba69
Bogdan Opanchuk
2023-08-06T23:56:05
k256: simplify internal helper functions in the scalar arithmetic (#917)
diff --git a/k256/src/arithmetic/scalar/wide32.rs b/k256/src/arithmetic/scalar/wide32.rs index 4af8cdc1..1f5b31f4 100644 --- a/k256/src/arithmetic/scalar/wide32.rs +++ b/k256/src/arithmetic/scalar/wide32.rs @@ -417,28 +417,18 @@ impl WideScalar { } } -/// Constant-time comparison. -#[inline(always)] -fn ct_less...
2
30
50
aac9320d4e6b2869c8b98ae7b1c329ca7bf3d76b
ashWhiteHat
2023-08-02T17:48:08
bp384: add sqrt (#918)
diff --git a/bp384/src/arithmetic/scalar.rs b/bp384/src/arithmetic/scalar.rs index 56444865..0cb77ef0 100644 --- a/bp384/src/arithmetic/scalar.rs +++ b/bp384/src/arithmetic/scalar.rs @@ -212,19 +212,26 @@ impl Scalar { res } - /// Returns the square root of self mod n, or `None` if no square root - ...
1
24
14
07cc02536c65bc110cbec829b1e2e3fa19d9c692
Bogdan Opanchuk
2023-08-01T00:10:43
k256: check for R being the identity point on Schnorr verification (#916)
diff --git a/k256/src/schnorr/verifying.rs b/k256/src/schnorr/verifying.rs index 06ecc08e..e35130e2 100644 --- a/k256/src/schnorr/verifying.rs +++ b/k256/src/schnorr/verifying.rs @@ -4,6 +4,7 @@ use super::{tagged_hash, Signature, CHALLENGE_TAG}; use crate::{AffinePoint, FieldBytes, ProjectivePoint, PublicKey, Scalar}...
1
2
1
5c829a47c076ff9df4fc790f7bb14c2ccf73a5a5
Tony Arcieri
2023-07-22T01:40:42
k256: reject signatures which aren't low-S normalized (#914) Closes #908
diff --git a/k256/src/ecdsa.rs b/k256/src/ecdsa.rs index f8178395..a3f28ab7 100644 --- a/k256/src/ecdsa.rs +++ b/k256/src/ecdsa.rs @@ -198,7 +198,15 @@ impl SignPrimitive<Secp256k1> for Scalar { } #[cfg(feature = "ecdsa")] -impl VerifyPrimitive<Secp256k1> for AffinePoint {} +impl VerifyPrimitive<Secp256k1> for Affi...
1
9
1
dd656af151c1850f0dd6dcd965160f01baaefd16
Tony Arcieri
2023-07-21T21:14:03
k256: use generic signing implementation from `ecdsa` (#911) Uses `ecdsa::hazmat::sign_prehashed` which provides a generic implementation of ECDSA signing. The code is largely identical to what was previously used, that code having originally been copied from `p256` and updated iteratively to match the generic i...
diff --git a/k256/Cargo.toml b/k256/Cargo.toml index dd3c7335..a6c5afe5 100644 --- a/k256/Cargo.toml +++ b/k256/Cargo.toml @@ -23,7 +23,7 @@ elliptic-curve = { version = "0.13", default-features = false, features = ["hazm # optional dependencies once_cell = { version = "1.18", optional = true, default-features = fa...
2
8
39
61c5daf190f53b32612a91c2761824813cea5755
ashWhiteHat
2023-07-08T16:58:06
p224: implement `Scalar::sqrt` (#904)
diff --git a/p224/src/arithmetic/scalar.rs b/p224/src/arithmetic/scalar.rs index 80a502b5..8f7da4d3 100644 --- a/p224/src/arithmetic/scalar.rs +++ b/p224/src/arithmetic/scalar.rs @@ -124,10 +124,24 @@ impl Scalar { Self(Uint::from_words(words)) } - /// Compute modular square root. + /// Atkin algo...
1
22
5
366f4f3bfce6aab73ba476371ff2da414c45b35e
Tony Arcieri
2023-05-31T14:06:54
p256: revert `primeorder` field impls (#885) Partially reverts cea8f60 which caused a performance degradation
diff --git a/p256/src/arithmetic/field.rs b/p256/src/arithmetic/field.rs index 735d09f1..ea153a88 100644 --- a/p256/src/arithmetic/field.rs +++ b/p256/src/arithmetic/field.rs @@ -2,58 +2,356 @@ #![allow(clippy::assign_op_pattern, clippy::op_ref)] -#[cfg_attr(target_pointer_width = "32", path = "field/field32.rs")]...
4
648
495
0b9ac9f08c5b873a31ba123a045a751c2abbe770
Alexandr Kitaev
2023-05-30T13:23:45
bign256: cleanup (#892)
diff --git a/bign256/Cargo.toml b/bign256/Cargo.toml index bb4caf3e..6b9d379b 100644 --- a/bign256/Cargo.toml +++ b/bign256/Cargo.toml @@ -8,7 +8,7 @@ general purpose curve arithmetic """ authors = ["RustCrypto Developers"] license = "Apache-2.0 OR MIT" -documentation = "https://docs.rs/bign-curve256v1" +documentati...
4
96
56
1ccab739621c67ef365eaffddfeb0b3badfef847
Willian Wang
2023-05-17T02:26:55
primeorder: improve initialization from uncompressed point (#891)
diff --git a/primeorder/src/affine.rs b/primeorder/src/affine.rs index e7f2fecc..3fb01d90 100644 --- a/primeorder/src/affine.rs +++ b/primeorder/src/affine.rs @@ -182,8 +182,11 @@ where } sec1::Coordinates::Uncompressed { x, y } => { C::FieldElement::from_repr(*y).and_then(|y|...
1
5
2
5b18bcf957cacbd6b34f96bd2d8ccba1a3dae0e6
Tony Arcieri
2023-04-16T23:28:49
bp384: `CurveArithmetic` + `PrimeCurveParams` (#877) Adds impls of the `CurveArithmetic` and `PrimeCurveArithmetic` traits, the latter of which defines the coefficients of the curve equation as well as the coordinates of the generator point. Impls have been added for both `Brainpool384r1` and `Brainpool384t1`, w...
diff --git a/bp384/src/arithmetic/scalar.rs b/bp384/src/arithmetic/scalar.rs index 7e1d661d..56444865 100644 --- a/bp384/src/arithmetic/scalar.rs +++ b/bp384/src/arithmetic/scalar.rs @@ -37,7 +37,7 @@ use elliptic_curve::{ use core::ops::{Add, Mul, Sub}; /// Element of the brainpoolP384's scalar field. -#[derive(Cl...
6
153
1
4eaadf00209c470c7d3924da3b0a67a952d2a34d
Tony Arcieri
2023-04-16T23:04:27
bp256: `CurveArithmetic` + `PrimeCurveParams` (#876) Adds impls of the `CurveArithmetic` and `PrimeCurveArithmetic` traits, the latter of which defines the coefficients of the curve equation as well as the coordinates of the generator point. Impls have been added for both `Brainpool256r1` and `Brainpool256t1`, w...
diff --git a/bp256/src/arithmetic/scalar.rs b/bp256/src/arithmetic/scalar.rs index ec9ccabc..c91b3634 100644 --- a/bp256/src/arithmetic/scalar.rs +++ b/bp256/src/arithmetic/scalar.rs @@ -36,8 +36,8 @@ use elliptic_curve::{ #[cfg(doc)] use core::ops::{Add, Mul, Sub}; -/// Element of the brainpoolP256's scalar field....
6
154
2
7a408f4fb31bd4f9ebb6e0a1e2ef480efb7530dd
Tony Arcieri
2023-04-16T19:00:21
bp384: impl `FieldElement::sqrt` (#875)
diff --git a/bp256/src/arithmetic/scalar.rs b/bp256/src/arithmetic/scalar.rs index fb283bae..ec9ccabc 100644 --- a/bp256/src/arithmetic/scalar.rs +++ b/bp256/src/arithmetic/scalar.rs @@ -217,7 +217,7 @@ impl Scalar { pub fn sqrt(&self) -> CtOption<Self> { // Because n ≡ 3 mod 4 for brainpoolP256's scalar ...
3
29
6
1408300373eb86981a72a272d9a12aedb6595148
Tony Arcieri
2023-04-16T18:48:46
bp256: implement `FieldElement::sqrt` and `Scalar::sqrt` (#874)
diff --git a/bp256/src/arithmetic/field.rs b/bp256/src/arithmetic/field.rs index dd3141b0..38cc3ede 100644 --- a/bp256/src/arithmetic/field.rs +++ b/bp256/src/arithmetic/field.rs @@ -201,7 +201,16 @@ impl FieldElement { /// Returns the square root of self mod p, or `None` if no square root /// exists. pu...
2
31
7
bea5cc935fbc575d204703bffa9ae41088befbfc
Tony Arcieri
2023-04-16T18:37:08
bp384: define `PrimeField` constants for `Scalar` (#873) Calculated in `sage` as follows: sage: p = 0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565 sage: multiplicative_generator = GF(p).primitive_element() sage: p_minus_1_bin = (p - 1).binary() sage: s = len(p_...
diff --git a/bp384/src/arithmetic/scalar.rs b/bp384/src/arithmetic/scalar.rs index 296ab98b..0caf8f61 100644 --- a/bp384/src/arithmetic/scalar.rs +++ b/bp384/src/arithmetic/scalar.rs @@ -321,11 +321,11 @@ impl PrimeField for Scalar { const NUM_BITS: u32 = 384; const CAPACITY: u32 = 383; const TWO_INV: Se...
1
28
5
36acc3c89ebe30ffd0549538387a6527417a0d3e
Tony Arcieri
2023-04-16T18:24:10
bp384: define `PrimeField` constants for `FieldElement` (#872) Calculated in `sage` as follows: sage: p = 0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec53 sage: multiplicative_generator = GF(p).primitive_element() sage: p_minus_1_bin = (p - 1).binary() sage: s = ...
diff --git a/bp256/src/arithmetic/field.rs b/bp256/src/arithmetic/field.rs index 47dee052..dd3141b0 100644 --- a/bp256/src/arithmetic/field.rs +++ b/bp256/src/arithmetic/field.rs @@ -286,7 +286,7 @@ mod tests { use primeorder::{impl_field_identity_tests, impl_field_invert_tests, impl_primefield_tests}; /// ...
2
29
6
864c77fe034bd636a273d660967d850e0f137216
Tony Arcieri
2023-04-16T18:03:15
bp256: define `PrimeField` constants for `Scalar` (#871) Calculated in `sage` as follows: sage: p = 0xa9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7 sage: multiplicative_generator = GF(p).primitive_element() sage: p_minus_1_bin = (p - 1).binary() sage: s = len(p_minus_1_bin) - len(p_minus_1_bin...
diff --git a/bp256/src/arithmetic/scalar.rs b/bp256/src/arithmetic/scalar.rs index 6ba56496..54fb26a2 100644 --- a/bp256/src/arithmetic/scalar.rs +++ b/bp256/src/arithmetic/scalar.rs @@ -321,11 +321,12 @@ impl PrimeField for Scalar { const NUM_BITS: u32 = 256; const CAPACITY: u32 = 255; const TWO_INV: Se...
1
27
5
6fe1a11f0f3230ba3b8dea876be8869f3caff5de
Tony Arcieri
2023-04-16T17:40:55
bp256: define `PrimeField` constants for `FieldElement` (#870) Calculated in `sage` as follows: sage: p = 0xa9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377 sage: multiplicative_generator = GF(p).primitive_element() sage: p_minus_1_bin = (p - 1).binary() sage: s = len(p_minus_1_bin) - len(p_minus...
diff --git a/bp256/src/arithmetic/field.rs b/bp256/src/arithmetic/field.rs index 7f564aab..47dee052 100644 --- a/bp256/src/arithmetic/field.rs +++ b/bp256/src/arithmetic/field.rs @@ -256,11 +256,12 @@ impl PrimeField for FieldElement { const NUM_BITS: u32 = 256; const CAPACITY: u32 = 255; const TWO_INV: ...
1
27
5
dcfd1be563eab52f0d56d6d87f9d810ef121e1a2
Tony Arcieri
2023-04-16T15:16:56
p192/p224: add `bits` feature (#868)
diff --git a/p192/Cargo.toml b/p192/Cargo.toml index 5a58e9d2..45d43cc6 100644 --- a/p192/Cargo.toml +++ b/p192/Cargo.toml @@ -36,6 +36,7 @@ alloc = ["elliptic-curve/alloc"] std = ["alloc", "elliptic-curve/std"] arithmetic = ["dep:primeorder", "elliptic-curve/arithmetic"] +bits = ["arithmetic", "elliptic-curve/bits...
4
4
2
af9a4445f46d3f2402c64a207b63aeb70458f30b
Tony Arcieri
2023-04-15T22:24:27
sm2: factor out `distid` module (#865) This code is reusable across all of the SM2 algorithms. This commit decouples it from the SM2DSA implementation.
diff --git a/sm2/src/distid.rs b/sm2/src/distid.rs new file mode 100644 index 00000000..d74d3162 --- /dev/null +++ b/sm2/src/distid.rs @@ -0,0 +1,44 @@ +//! Distinguished identifier support. + +use crate::{AffinePoint, Hash, Sm2}; +use elliptic_curve::{ + sec1::{self, ToEncodedPoint}, + Error, Result, +}; +use pr...
5
91
59
b9fcdd3b8ac41a8b9abadeb79dd0fcdc8dfdfe4b
Tony Arcieri
2023-04-15T20:53:12
sm2: enable `dsa` feature by default (#862) It's currently the main use case for this crate
diff --git a/sm2/Cargo.toml b/sm2/Cargo.toml index 3dcd412b..aa3de25d 100644 --- a/sm2/Cargo.toml +++ b/sm2/Cargo.toml @@ -32,7 +32,7 @@ proptest = "1" rand_core = { version = "0.6", features = ["getrandom"] } [features] -default = ["arithmetic", "pem", "std"] +default = ["arithmetic", "dsa", "pem", "std"] alloc =...
1
1
1
c17e54adc77f33789dd3e7acb98df30e657fa65d
Tony Arcieri
2023-04-15T19:47:56
p192/p224/p384/p521/sm2: add `all-features = true` on docsrs (#861) This option was previously not set in Cargo.toml
diff --git a/p192/Cargo.toml b/p192/Cargo.toml index 50e0e621..5a58e9d2 100644 --- a/p192/Cargo.toml +++ b/p192/Cargo.toml @@ -44,4 +44,5 @@ serde = ["elliptic-curve/serde", "primeorder?/serde", "serdect"] test-vectors = ["hex-literal"] [package.metadata.docs.rs] +all-features = true rustdoc-args = ["--cfg", "docs...
5
8
0
c7019c1a669c7a3590114fc51d7bb1e06b6bb8f4
Tony Arcieri
2023-04-15T19:33:07
Update fiat crypto docs (#860) Some of the field implementations came from the git repo, others were synthesized by running fiat-crypto locally. This changes the boilerplate to be vague enough to cover both cases, as opposed to what it was before where it claimed all of them were copied from the git repo.
diff --git a/p192/src/arithmetic/field.rs b/p192/src/arithmetic/field.rs index 884b5c81..41f22bd7 100644 --- a/p192/src/arithmetic/field.rs +++ b/p192/src/arithmetic/field.rs @@ -1,7 +1,6 @@ //! Field arithmetic modulo p = 2^{192} − 2^{64} - 1 //! -//! Arithmetic implementations are extracted Rust code from the Coq f...
10
55
9
fbc5d26ee76fcbcdcd3ea8663c4585f80b38389f
Tony Arcieri
2023-04-15T16:52:24
p192/p224/p256/p384/p521/sm2: use `dep:primeorder` (#857) Followup to #851: uses `dep:primeorder` in Cargo.toml, gating serde support via weak feature activation. Also fills out `serde` support in `sm2`.
diff --git a/Cargo.lock b/Cargo.lock index 61b373b3..e1552d98 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1131,6 +1131,7 @@ dependencies = [ "proptest", "rand_core", "rfc6979", + "serdect", "signature", "sm3", ] diff --git a/p192/Cargo.toml b/p192/Cargo.toml index e8fab350..c252169c 100644 --- a/p192/Cargo....
8
33
10
2133622b782cb5e8c96dbe74d74647cc66b3889c
Halvor Lyche Strandvoll
2023-04-14T15:26:58
p192: add `ecdsa` feature (#850)
diff --git a/Cargo.lock b/Cargo.lock index 9283fa73..dba4a62c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -712,6 +712,7 @@ checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" name = "p192" version = "0.0.0" dependencies = [ + "ecdsa", "elliptic-curve", "hex-literal", "primeorder", dif...
6
203
2
f3764ab0729d75b0166f480b8dc7297e83a8e4ed
Tony Arcieri
2023-04-13T20:31:20
p224: add note about Scalar::sqrt being unimplemented
diff --git a/p224/src/arithmetic/scalar.rs b/p224/src/arithmetic/scalar.rs index aa1cdd50..5081f49d 100644 --- a/p224/src/arithmetic/scalar.rs +++ b/p224/src/arithmetic/scalar.rs @@ -108,6 +108,7 @@ impl Scalar { /// Compute modular square root. pub fn sqrt(&self) -> CtOption<Self> { + // See RustCry...
1
1
0
f3214efb6ee8f12e346ec8a3794106ec4e3c8de5
Tony Arcieri
2023-04-13T17:08:16
sm2: add `Scalar::sqrt` (#844)
diff --git a/p192/src/arithmetic/field.rs b/p192/src/arithmetic/field.rs index 9fb64e4f..884b5c81 100644 --- a/p192/src/arithmetic/field.rs +++ b/p192/src/arithmetic/field.rs @@ -101,7 +101,8 @@ impl FieldElement { /// Returns the square root of self mod p, or `None` if no square root /// exists. pub fn ...
3
20
6
69fb76ab44cf68c7bad178918c91414b8b8f50f8
Tony Arcieri
2023-04-13T16:51:00
p192: add `Scalar::sqrt` (#843)
diff --git a/p192/src/arithmetic/scalar.rs b/p192/src/arithmetic/scalar.rs index 3060a1e6..492318a1 100644 --- a/p192/src/arithmetic/scalar.rs +++ b/p192/src/arithmetic/scalar.rs @@ -106,9 +106,42 @@ impl Scalar { Self(U192::from_words(words)) } - /// Compute modular square root. - pub fn sqrt(&se...
1
41
5
bfb529f6c24a50f0fac10acd4bbe17d2e52ff10e
Tony Arcieri
2023-04-13T16:37:50
sm2: add `FieldElement::sqrt` (#842)
diff --git a/sm2/src/arithmetic/field.rs b/sm2/src/arithmetic/field.rs index cdae86c2..be28ca69 100644 --- a/sm2/src/arithmetic/field.rs +++ b/sm2/src/arithmetic/field.rs @@ -99,7 +99,14 @@ impl FieldElement { /// Returns the square root of self mod p, or `None` if no square root /// exists. pub fn sqrt(...
1
13
3
8b4bebecefc82b4fbb013f2c68c3978521aeac24
Tony Arcieri
2023-04-13T16:24:37
p192: add `FieldElement::sqrt` (#841)
diff --git a/p192/src/arithmetic/field.rs b/p192/src/arithmetic/field.rs index ba075f8d..9fb64e4f 100644 --- a/p192/src/arithmetic/field.rs +++ b/p192/src/arithmetic/field.rs @@ -101,7 +101,9 @@ impl FieldElement { /// Returns the square root of self mod p, or `None` if no square root /// exists. pub fn ...
1
8
3
50c58391f0c9b920bd6586d4fd0d518e24b74ac8
Tony Arcieri
2023-04-12T23:50:00
p192: projective arithmetic tests (#837) Uses `impl_projective_arithmetic_tests!` to test projective arithmetic against a set of test vectors. Includes test vectors from: http://point-at-infinity.org/ecc/nisttv
diff --git a/Cargo.lock b/Cargo.lock index e7effdca..0306ec2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -713,6 +713,7 @@ name = "p192" version = "0.0.0" dependencies = [ "elliptic-curve", + "hex-literal", "primeorder", "sec1", ] diff --git a/p192/Cargo.toml b/p192/Cargo.toml index 242e58c4..9fc045b4 100644 -...
6
291
1
841eb9867df47d771decd951e65d632095e47571
Tony Arcieri
2023-04-12T17:07:11
sm2: `CurveArithmetic` + `PrimeCurveParams` (#835) Adds impls of the `CurveArithmetic` and `PrimeCurveArithmetic` traits, the latter of which defines the coefficients of the curve equation as well as the coordinates of the generator point. Constants have been sourced from draft-shen-sm2-ecdsa Appendix D.
diff --git a/sm2/src/arithmetic.rs b/sm2/src/arithmetic.rs index d1f491b3..c2aa66e3 100644 --- a/sm2/src/arithmetic.rs +++ b/sm2/src/arithmetic.rs @@ -7,3 +7,52 @@ pub(crate) mod field; pub(crate) mod scalar; + +pub use self::scalar::Scalar; + +use self::field::FieldElement; +use crate::Sm2; +use elliptic_curve::{C...
3
57
1
a20692ab336efe2a027ded82f7ac9de18bd84971
Tony Arcieri
2023-04-12T16:11:30
p192: `CurveArithmetic` + `PrimeCurveParams` (#834) Adds impls of the `CurveArithmetic` and `PrimeCurveArithmetic` traits, the latter of which defines the coefficients of the curve equation as well as the coordinates of the generator point. Constants have been sourced from FIPS 186-4 § D.1.2.1: Curve P-192.
diff --git a/p192/src/arithmetic.rs b/p192/src/arithmetic.rs index 4ad1c4a3..0d0bac02 100644 --- a/p192/src/arithmetic.rs +++ b/p192/src/arithmetic.rs @@ -6,3 +6,52 @@ pub(crate) mod field; pub(crate) mod scalar; + +pub use self::scalar::Scalar; + +use self::field::FieldElement; +use crate::NistP192; +use elliptic_...
2
50
0
13d0dcb15b6508adb45f7245320a713b5cd5ed73
Tony Arcieri
2023-04-12T14:25:02
p224: enable `arithmetic` and `ecdsa` by default (#833) Matches the default features of `p256`
diff --git a/p224/Cargo.toml b/p224/Cargo.toml index f174af62..008625ad 100644 --- a/p224/Cargo.toml +++ b/p224/Cargo.toml @@ -32,7 +32,7 @@ primeorder = { version = "0.13", features = ["dev"], path = "../primeorder" } rand_core = { version = "0.6", features = ["getrandom"] } [features] -default = ["pem", "std"] +d...
1
1
1
716570362d437685dd3d874ede47b01d19eafb29
Tony Arcieri
2023-04-12T13:56:03
p256: enable `pem` feature by default (#832) Better matches `p384`
diff --git a/p256/Cargo.toml b/p256/Cargo.toml index c5e5e1e0..166f4b88 100644 --- a/p256/Cargo.toml +++ b/p256/Cargo.toml @@ -36,7 +36,7 @@ proptest = "1" rand_core = { version = "0.6", features = ["getrandom"] } [features] -default = ["arithmetic", "ecdsa", "pkcs8", "std"] +default = ["arithmetic", "ecdsa", "pem"...
1
1
1
508ed3c94fee27e510dd863d23fd787ce8afab17
Tony Arcieri
2023-04-11T18:37:14
sm2: define `PrimeField` constants for `Scalar` (#831) Calculated in `sage` as follows: sage: p = 0xfffffffeffffffffffffffffffffffff7203df6b21c6052b53bbf40939d54123 sage: multiplicative_generator = GF(p).primitive_element() sage: p_minus_1_bin = (p - 1).binary() sage: s = len(p_minus_1_bin) - len(p_minus_1_bin.r...
diff --git a/sm2/src/arithmetic/scalar.rs b/sm2/src/arithmetic/scalar.rs index 6511f064..fa716fba 100644 --- a/sm2/src/arithmetic/scalar.rs +++ b/sm2/src/arithmetic/scalar.rs @@ -180,12 +180,13 @@ impl PrimeField for Scalar { const MODULUS: &'static str = ORDER_HEX; const NUM_BITS: u32 = 256; const CAPAC...
1
28
6
6b3c11f2901801c26bd052d574f288982c839668
Tony Arcieri
2023-04-11T18:01:28
sm2: define `PrimeField` constants for `FieldElement` (#829) Calculated in `sage` as follows: sage: p = 0xfffffffeffffffffffffffffffffffffffffffff00000000ffffffffffffffff sage: multiplicative_generator = GF(p).primitive_element() sage: p_minus_1_bin = (p - 1).binary() sage: s = len(p_minus_1_bin) - len(p_minus_1...
diff --git a/sm2/src/arithmetic/field.rs b/sm2/src/arithmetic/field.rs index d1f330fa..cdae86c2 100644 --- a/sm2/src/arithmetic/field.rs +++ b/sm2/src/arithmetic/field.rs @@ -81,7 +81,7 @@ impl FieldElement { let words = primeorder::impl_bernstein_yang_invert!( self.0.as_words(), Self...
1
29
7
64d26ab4a39c49d7aa59122fc3b4d3eff396adf6
Tony Arcieri
2023-04-11T15:55:19
p192: define `PrimeField` constants for `Scalar` (#828) Calculated in `sage` as follows: sage: p = 0xffffffffffffffffffffffff99def836146bc9b1b4d22831 sage: multiplicative_generator = GF(p).primitive_element() sage: p_minus_1_bin = (p - 1).binary() sage: s = len(p_minus_1_bin) - len(p_minus_1_bin.rstrip('0')) # c...
diff --git a/p192/src/arithmetic/scalar.rs b/p192/src/arithmetic/scalar.rs index 4392a7b0..3060a1e6 100644 --- a/p192/src/arithmetic/scalar.rs +++ b/p192/src/arithmetic/scalar.rs @@ -182,12 +182,12 @@ impl PrimeField for Scalar { const MODULUS: &'static str = ORDER_HEX; const NUM_BITS: u32 = 192; const C...
1
22
6
62610a85f8dca691e79fe6251f6fd305471cc48d
Tony Arcieri
2023-04-11T15:27:27
p192: define `PrimeField` constants for `FieldElement` (#827) Calculated in `sage` as follows: sage: p = 0xfffffffffffffffffffffffffffffffeffffffffffffffff sage: multiplicative_generator = GF(p).primitive_element() sage: p_minus_1_bin = (p - 1).binary() sage: s = len(p_minus_1_bin) - len(p_minus_1_bin.rstrip('0'...
diff --git a/p192/src/arithmetic/field.rs b/p192/src/arithmetic/field.rs index d0ded554..ba075f8d 100644 --- a/p192/src/arithmetic/field.rs +++ b/p192/src/arithmetic/field.rs @@ -111,12 +111,12 @@ impl PrimeField for FieldElement { const MODULUS: &'static str = MODULUS_HEX; const NUM_BITS: u32 = 192; con...
1
21
6
5e36b7117431881e95110dd0f3f1a50c0b515359
Tony Arcieri
2023-04-10T01:11:54
p224: add FIPS 186-4 ECDSA test vectors (#817) Adapted from `SigGen.txt` in `186-4ecdsatestvectors.zip` https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/digital-signatures
diff --git a/Cargo.lock b/Cargo.lock index 8b4f7071..cc8cdd3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -337,9 +337,9 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.5" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298d10b6d24e99de17b92bd41bfe33...
5
167
3
f110174010d134429441314b9b4565237c76f051
Tony Arcieri
2023-04-09T01:04:26
p224: add `ecdh` feature (#814) Adds a feature for performing elliptic curve Diffie-Hellman similar to the same feature in the `p256` and `p384` crates.
diff --git a/Cargo.lock b/Cargo.lock index 6669ee3f..9271dbc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -721,6 +721,7 @@ dependencies = [ "elliptic-curve", "hex-literal 0.4.1", "primeorder", + "rand_core", ] [[package]] diff --git a/p224/Cargo.toml b/p224/Cargo.toml index ba5fcb66..ac1013e0 100644 --- a/p22...
6
59
2
4cd3f476621660eebb0fdd1e7af530aeeeb619d7
Tony Arcieri
2023-04-09T00:09:18
p256+p384: move point compaction support TODO
diff --git a/p256/tests/affine.rs b/p256/tests/affine.rs index a8536881..8e4bb816 100644 --- a/p256/tests/affine.rs +++ b/p256/tests/affine.rs @@ -1,7 +1,5 @@ //! Affine arithmetic tests. -// TODO(tarcieri): point compaction support - #![cfg(all(feature = "arithmetic"))] use elliptic_curve::{ diff --git a/p384/t...
2
2
2
661a0b6a3539a3f2192fb4318053f645814f066e
Tony Arcieri
2023-04-09T00:06:25
p224: projective arithmetic tests (#813) Extracts the `p256` projective arithmetic tests into an `impl_projective_arithmetic_tests!` macro which is now used in `p224`, `p256`, and `p384`. Includes test vectors from: http://point-at-infinity.org/ecc/nisttv
diff --git a/Cargo.lock b/Cargo.lock index 9ed0889d..6667254f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -719,6 +719,7 @@ name = "p224" version = "0.13.0" dependencies = [ "elliptic-curve", + "hex-literal 0.4.1", "primeorder", ] diff --git a/p224/Cargo.toml b/p224/Cargo.toml index 363a5a1f..ba5fcb66 100644 --...
13
473
279
5173e896d6b14215518ccdf17eb8f9868d51773f
Tony Arcieri
2023-04-05T19:42:29
p256: ECDSA verifying key recovery test (#811) Also bumps `ecdsa` to v0.16.4, which contains a bugfix: RustCrypto/signatures#702 This test confirms it's fixed.
diff --git a/Cargo.lock b/Cargo.lock index 4d186d77..9ed0889d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -314,9 +314,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc302fd9b18d66834a6f092d10ea85489c...
2
38
10
f1b7d907387be9c9dedbb8432c9f597c4f5726e7
Tony Arcieri
2023-04-04T17:18:59
primeorder: remove outdated comment (#807)
diff --git a/primeorder/src/point_arithmetic.rs b/primeorder/src/point_arithmetic.rs index 9c0741ea..b4130899 100644 --- a/primeorder/src/point_arithmetic.rs +++ b/primeorder/src/point_arithmetic.rs @@ -2,15 +2,6 @@ //! //! Support for formulas specialized to the short Weierstrass equation's //! 𝒂-coefficient. -//!...
1
0
9
8f5000d7eb9a693d3dc9acc22a4b0fdcae1d3302
Tony Arcieri
2023-04-04T14:41:26
primeorder: reorder `PointArithmetic` impls (#806) Reorders the impls so they match the ordering in the paper, which makes it easier to compare the paper to the Rust code.
diff --git a/primeorder/src/point_arithmetic.rs b/primeorder/src/point_arithmetic.rs index 30a8a883..9c0741ea 100644 --- a/primeorder/src/point_arithmetic.rs +++ b/primeorder/src/point_arithmetic.rs @@ -24,194 +24,25 @@ mod sealed { /// Provides implementation of point arithmetic (point addition, point doubling) w...
1
175
173
8b4845e07bedf1d5042309e21178962621547057
Luke Parker
2023-03-28T13:54:30
Correct product definition for empty iterators (#802) Fixes #801.
diff --git a/k256/src/arithmetic/field.rs b/k256/src/arithmetic/field.rs index f55099c4..6e97ee78 100644 --- a/k256/src/arithmetic/field.rs +++ b/k256/src/arithmetic/field.rs @@ -486,7 +486,7 @@ impl<'a> Sum<&'a FieldElement> for FieldElement { impl Product for FieldElement { fn product<I: Iterator<Item = Self>...
6
6
6
2bcc0e0f175645f3382e777b60b0578d868bae33
Tony Arcieri
2023-03-26T17:41:53
primeorder: simplified `impl_field_sqrt_tests!` (#800) Changes the test to only check that sqrt round trips back when squared. Closes #789
diff --git a/p256/src/arithmetic/scalar.rs b/p256/src/arithmetic/scalar.rs index 78be24c4..0bae3f9d 100644 --- a/p256/src/arithmetic/scalar.rs +++ b/p256/src/arithmetic/scalar.rs @@ -752,7 +752,10 @@ mod tests { use super::Scalar; use crate::{FieldBytes, SecretKey}; use elliptic_curve::group::ff::{Field,...
3
10
29
8ec49a3b84843f5d6725d13305c6307abed73707
Tony Arcieri
2023-03-26T16:52:16
p224/p256/p384: make `primeorder` dependency optional (#799) It's not needed when the `arithmetic` feature is disabled
diff --git a/p224/Cargo.toml b/p224/Cargo.toml index 6aecf42b..363a5a1f 100644 --- a/p224/Cargo.toml +++ b/p224/Cargo.toml @@ -17,7 +17,9 @@ rust-version = "1.65" [dependencies] elliptic-curve = { version = "0.13", default-features = false, features = ["hazmat", "sec1"] } -primeorder = { version = "0.13", path = "....
3
8
6
6b41a257402fe7db500e121fd3c815dfcf3be376
Tony Arcieri
2023-03-26T03:10:03
p224/p256/p384: better `Debug` for field elements (#798) Updates the `Debug` impls on `FieldElement` and `Scalar` to print the inner bigint value as hex.
diff --git a/p224/src/arithmetic/field.rs b/p224/src/arithmetic/field.rs index 4467638e..79a02810 100644 --- a/p224/src/arithmetic/field.rs +++ b/p224/src/arithmetic/field.rs @@ -28,6 +28,7 @@ mod field_impl; use self::field_impl::*; use crate::{FieldBytes, NistP224, Uint}; use core::{ + fmt::{self, Debug}, ...
6
48
6
b5092f1dd50fc61753d815174c0a25b2826cf531
Samuel Moelius
2023-03-18T15:44:51
Update field.rs (#794)
diff --git a/k256/src/arithmetic/field.rs b/k256/src/arithmetic/field.rs index 0d165dac..f55099c4 100644 --- a/k256/src/arithmetic/field.rs +++ b/k256/src/arithmetic/field.rs @@ -703,7 +703,7 @@ mod tests { assert!(y.normalize().is_odd().unwrap_u8() == 0); // This panics since `y` is not normalized....
1
1
1
e3283b70f02a99bdbe134f0daa9f0a8b76550590
Dirk Stolle
2023-03-17T00:53:09
chore: fix some typos (#792)
diff --git a/k256/src/arithmetic/projective.rs b/k256/src/arithmetic/projective.rs index 40d4d14f..560769e4 100644 --- a/k256/src/arithmetic/projective.rs +++ b/k256/src/arithmetic/projective.rs @@ -223,7 +223,7 @@ impl ProjectivePoint { /// Check whether `self` is equal to an affine point. /// /// This ...
2
3
3
ccd20c2068d8718b0254ecfafd954095761340b4
Tony Arcieri
2023-03-13T20:35:07
Bump `crypto-bigint` to v0.5.1 (#791)
diff --git a/Cargo.lock b/Cargo.lock index 5d18396b..04fa9224 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071c0f5945634bc9ba7a452f...
1
2
2
93354cd7b1d513fad480efd25b303664115cc207
Tony Arcieri
2023-03-13T17:12:41
Expand field element tests (#790) - Add `impl_field_identity_tests!` - Use `impl_field_sqrt_tests!` NOTE: this change uncovered some test failures with `p256::Scalar::sqrt` and `p384::Scalar::sqrt` implementations, tracked as #789. There are now TODOs in the relevant places in the code.
diff --git a/p224/src/arithmetic/field.rs b/p224/src/arithmetic/field.rs index c449d999..4467638e 100644 --- a/p224/src/arithmetic/field.rs +++ b/p224/src/arithmetic/field.rs @@ -330,7 +330,10 @@ impl PrimeField for FieldElement { mod tests { use super::FieldElement; use elliptic_curve::ff::PrimeField; - ...
8
56
63
ef9e7e9e19a9545b8a985cdd9ef86633e2a8884c
Tony Arcieri
2023-03-13T03:05:14
p224: impl `FieldElement::sqrt` (#788) Uses an implementation generated by `ff_derive` using the following parameters: #[derive(PrimeField)] #[PrimeFieldModulus = "26959946667150639794667015087019630673557916260026308143510066298881"] #[PrimeFieldGenerator = "22"]
diff --git a/p224/src/arithmetic/field.rs b/p224/src/arithmetic/field.rs index f33dbaed..c449d999 100644 --- a/p224/src/arithmetic/field.rs +++ b/p224/src/arithmetic/field.rs @@ -33,7 +33,7 @@ use core::{ }; use elliptic_curve::{ ff::PrimeField, - subtle::{Choice, ConstantTimeEq, CtOption}, + subtle::{Choi...
3
188
12
fd6807411d1ef5680f023b8720f3e487ab24ae4b
Tony Arcieri
2023-03-13T00:52:28
p224+p521: impl Bernstein-Yang scalar inversions (#786) Extracts an `impl_bernstein_yang_invert!` macro from the `p384` crate which uses the divstep implementation from fiat-crypto. This is used to implement `p224::Scalar` and `p521::Scalar` inversions. Also extracts a `impl_field_invert_tests!` macro and uses ...
diff --git a/p224/src/arithmetic/field.rs b/p224/src/arithmetic/field.rs index 4dddefe8..f33dbaed 100644 --- a/p224/src/arithmetic/field.rs +++ b/p224/src/arithmetic/field.rs @@ -76,6 +76,7 @@ impl FieldElement { /// Returns the multiplicative inverse of self. /// /// Does not check that self is non-zero...
8
209
136
3049c501f02c8d2a3594c03139f0524b5c9df139
Louis Thiery
2023-03-02T20:39:56
fix compactabtility check (#772) \
diff --git a/p256/tests/affine.rs b/p256/tests/affine.rs index daedbada..a8536881 100644 --- a/p256/tests/affine.rs +++ b/p256/tests/affine.rs @@ -118,3 +118,21 @@ fn identity_encoding() { .is_identity() )) } + +#[test] +fn noncompatible_is_none() { + use elliptic_curve::generic_array::GenericArra...
2
19
1
195ff6788b1b2c3ae481e05000e4a3156ea30d41
Tony Arcieri
2023-03-02T04:23:05
Cargo.lock: bump dependencies (#771)
diff --git a/Cargo.lock b/Cargo.lock index fd90907c..436bcb83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,9 +42,9 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64ct" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/...
1
180
52
4f5d3091022cdfd8cb339a3d5a4ee6f8bbdc5738
Tony Arcieri
2023-03-02T04:17:58
Bump `elliptic-curve` dependency to v0.13 (#770) Also bumps `ecdsa` to v0.16
diff --git a/Cargo.lock b/Cargo.lock index add2cebf..fd90907c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,12 +34,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "base16ct" -...
9
23
29
5a43e666f1c73cfe05c4a687c295312d51cee1d6
Tony Arcieri
2023-02-13T02:18:51
p224: field inversion support (#765) Adds an inversion implementation adapted from the addition chain generated by addchain: https://github.com/mmcloughlin/addchain It uses a sequence of 11 multiplications and 223 squarings.
diff --git a/p224/src/arithmetic/field.rs b/p224/src/arithmetic/field.rs index 91710d70..4dddefe8 100644 --- a/p224/src/arithmetic/field.rs +++ b/p224/src/arithmetic/field.rs @@ -70,7 +70,36 @@ primeorder::impl_mont_field_element!( impl FieldElement { /// Compute [`FieldElement`] inversion: `1 / self`. pub f...
2
85
6
267e3c38bc80459d55dc500f2a90083bdf54fe19
Tony Arcieri
2023-02-13T01:13:45
p521: `CurveArithmetic` + `PrimeCurveParams` (#764) Adds impls of the `CurveArithmetic` and `PrimeCurveArithmetic` traits, the latter of which defines the coefficients of the curve equation as well as the coordinates of the generator point. Constants have been sourced from NIST SP 800-186 § 3.2.1.5: P-521.
diff --git a/Cargo.lock b/Cargo.lock index 297398da..0279650f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -706,6 +706,7 @@ name = "p521" version = "0.0.0" dependencies = [ "elliptic-curve", + "primeorder", ] [[package]] diff --git a/p224/src/lib.rs b/p224/src/lib.rs index 8ff6115f..b43ec06b 100644 --- a/p224/sr...
7
94
68
2fde7a0ea95e52e61d0111f6900510e6421e1bad
Tony Arcieri
2023-02-12T23:26:40
p224: `CurveArithmetic` + `PrimeCurveParams` (#763) Adds impls of the `CurveArithmetic` and `PrimeCurveArithmetic` traits, the latter of which defines the coefficients of the curve equation as well as the coordinates of the generator point. Constants have been sourced from NIST SP 800-186 § 3.2.1.2: P-224.
diff --git a/p224/src/arithmetic.rs b/p224/src/arithmetic.rs index 714dc99c..1e28531b 100644 --- a/p224/src/arithmetic.rs +++ b/p224/src/arithmetic.rs @@ -1,8 +1,76 @@ //! Pure Rust implementation of group operations on secp224r1. //! -//! Curve parameters can be found in [NIST SP 800-186] § G.1.1: Curve P-384. +//! ...
2
75
4
300ce4f2e49049b42cd74a3df4985a8e094e7b64
Tony Arcieri
2023-02-12T22:21:34
Field element macro cleanups (#762) - Renames `primeorder::impl_field_element` to `impl_mont_field_element` to reflect it supports a Montgomery internal representation. - Removes an unused parameter on `impl_field_op` macro. - Removes some unused code in `p521`'s field element module.
diff --git a/p224/src/arithmetic/field.rs b/p224/src/arithmetic/field.rs index 03e7409e..91710d70 100644 --- a/p224/src/arithmetic/field.rs +++ b/p224/src/arithmetic/field.rs @@ -51,7 +51,7 @@ const MODULUS: Uint = #[derive(Clone, Copy, Debug)] pub struct FieldElement(pub(super) Uint); -primeorder::impl_field_eleme...
7
15
14
2afc27e2a6a6965c7f641a8ecd29b56994461751
Tony Arcieri
2023-02-12T19:06:59
p521: regen fiat-crypto `FieldElement` backend (#761) Regenerates fiat-crypto field arithmetic with: $ ./unsaturated_solinas --lang Rust --inline p521 64 9 '2^521 - 1' This generates all available operations, including "carry" ops for addition, subtraction, and negation. These should provide better perfo...
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index a4a6725d..5231337a 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -167,49 +167,59 @@ impl FieldElement { } /// Add elements. - pub(crate) const fn add(&self, rhs: &Self) -> LooseFieldElement { ...
3
202
67
e7a1de3c5254bd81c90716bebcea652e4bcd6e4f
Tony Arcieri
2023-02-12T16:42:06
p521: split `neg`/`neg_carry`; reorder `FieldElement` methods (#759)
diff --git a/p521/src/arithmetic/field.rs b/p521/src/arithmetic/field.rs index a5388005..a4a6725d 100644 --- a/p521/src/arithmetic/field.rs +++ b/p521/src/arithmetic/field.rs @@ -171,20 +171,19 @@ impl FieldElement { LooseFieldElement(fiat_p521_add(&self.0, &rhs.0)) } - /// Add elements and carry. - ...
1
21
16
b7b5ccafddf904658c029657b3caa109d3ccb97d
Tony Arcieri
2023-02-11T22:31:24
k256: add complete end-to-end Ethereum signature recovery test (#756) Adds a test which signs a message using Keccak256 as the digest function, testing that the resulting signature matches the one produced by web3.js, as used in the ethers-rs test vectors. After the signature has been produced, it recovers the `V...
diff --git a/k256/src/ecdsa.rs b/k256/src/ecdsa.rs index e2c44a2c..3f9049b0 100644 --- a/k256/src/ecdsa.rs +++ b/k256/src/ecdsa.rs @@ -283,11 +283,12 @@ mod tests { #[cfg(feature = "sha256")] mod recovery { use crate::{ - ecdsa::{RecoveryId, Signature, VerifyingKey}, + ecdsa::{s...
1
34
1
da3562bad4b9a851bfa5d14a200f2fbc81d28f82
Tony Arcieri
2023-02-11T22:13:28
k256: simply ECDSA signature recovery example (#755) Uses the `SigningKey::sign_digest_recoverable` method
diff --git a/k256/src/ecdsa.rs b/k256/src/ecdsa.rs index d23c0594..e2c44a2c 100644 --- a/k256/src/ecdsa.rs +++ b/k256/src/ecdsa.rs @@ -79,7 +79,8 @@ //! //! This example shows how to compute a signature and its associated //! [`RecoveryId`] in a manner which is byte-for-byte compatible with -//! Ethereum libraries: ...
1
5
8
d66e8aca97d44d9c9f503fd3a75b0f82a88f04cb
Yehonatan Cohen Scaly
2023-02-07T14:38:00
k256: add `serde` support for `schnorr` types (#748)
diff --git a/k256/src/schnorr/signing.rs b/k256/src/schnorr/signing.rs index b1226da7..ecfdfa0a 100644 --- a/k256/src/schnorr/signing.rs +++ b/k256/src/schnorr/signing.rs @@ -18,6 +18,9 @@ use signature::{ DigestSigner, Error, KeypairRef, RandomizedDigestSigner, RandomizedSigner, Result, Signer, }; +#[cfg(featu...
2
46
0
9263229e4fafea600225cb68420744fc7818022f
Tony Arcieri
2023-02-07T03:53:20
k256: more basic tests of `invert` and `invert_vartime` (#751)
diff --git a/k256/src/arithmetic/scalar.rs b/k256/src/arithmetic/scalar.rs index 6f56e4a5..36aa1e8c 100644 --- a/k256/src/arithmetic/scalar.rs +++ b/k256/src/arithmetic/scalar.rs @@ -902,17 +902,42 @@ mod tests { } } - /// Basic tests that invert works. + /// Basic tests that `invert` works. ...
1
27
2
2cb2bdf41f7592b057216a4c7495e21bf6522c6b
Tony Arcieri
2023-02-07T02:54:05
p224: fix `FieldElement::CAPACITY` constant (#750) Should be `NUM_BITS - 1`
diff --git a/p224/src/arithmetic/field.rs b/p224/src/arithmetic/field.rs index 230a16a5..2f9f9d1c 100644 --- a/p224/src/arithmetic/field.rs +++ b/p224/src/arithmetic/field.rs @@ -85,7 +85,7 @@ impl PrimeField for FieldElement { const MODULUS: &'static str = MODULUS_HEX; const NUM_BITS: u32 = 224; - const...
1
1
1
1a941133f6e1cf4f551bd2be04a21ca5318e863f
Tony Arcieri
2023-02-06T19:49:54
p224: update `PrimeField` constants for `FieldElement` (#749) Previously `S` was miscomputed. This updates it to 96, and recomputes `MULTIPLICATIVE_GENERATOR` and `DELTA` accordingly (using sage).
diff --git a/p224/src/arithmetic/field.rs b/p224/src/arithmetic/field.rs index 7d8b41a9..230a16a5 100644 --- a/p224/src/arithmetic/field.rs +++ b/p224/src/arithmetic/field.rs @@ -85,18 +85,24 @@ impl PrimeField for FieldElement { const MODULUS: &'static str = MODULUS_HEX; const NUM_BITS: u32 = 224; - con...
1
11
5
d4dbe19169099887cd25c81566d735e3005c8e5c
Denis Varlakov
2023-02-06T18:41:08
primeorder: support curves with any `a` (#729) Implements all formulas in Renes-Costello-Batina 2015, including ones for curves where a != -3. This includes generic formulas which work for any short Weierstrass curve, and formulas specialized for the case a = 0. Closes #726.
diff --git a/p256/src/arithmetic.rs b/p256/src/arithmetic.rs index b48468c5..7cdf8b1d 100644 --- a/p256/src/arithmetic.rs +++ b/p256/src/arithmetic.rs @@ -13,7 +13,7 @@ pub(crate) mod util; use self::{field::FieldElement, scalar::Scalar}; use crate::NistP256; use elliptic_curve::{CurveArithmetic, PrimeCurveArithmeti...
6
340
140
61f347d81bd23a4da418e2cb6d87473a86ce2ca3
Tony Arcieri
2023-02-05T18:12:33
k256: fast `invert_vartime` using Stein's algorithm (#743) Adapts the implementation originally contributed to the `p256` crate by @nickray to the `k256` crate. Implementation is checked against the constant-time `Scalar::invert` using proptests (where `Scalar::invert` is in turn proptested against `num-bigint`)...
diff --git a/k256/src/arithmetic/scalar.rs b/k256/src/arithmetic/scalar.rs index 376f1d3e..6f56e4a5 100644 --- a/k256/src/arithmetic/scalar.rs +++ b/k256/src/arithmetic/scalar.rs @@ -418,6 +418,64 @@ impl Invert for Scalar { fn invert(&self) -> CtOption<Self> { self.invert() } + + /// Fast variabl...
1
89
9
136fed7944d53c0508b1a93cd97bdab46891bcf7
Tony Arcieri
2023-02-03T18:27:46
Bump `elliptic-curve` to v0.13.0-pre.5 (#742) Also bumps `ecdsa` to v0.16.0-pre.1
diff --git a/Cargo.lock b/Cargo.lock index 3f4b3793..5176b347 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -330,8 +330,9 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.16.0-pre.0" -source = "git+https://github.com/RustCrypto/signatures.git#82776dc4cc21d665788a1ab04bcfaabf30fb86db" +version = "0.16.0-pr...
10
24
25
460d676c82b3ed52f2a7aeb2c0833821fc960f71
Tony Arcieri
2023-02-03T17:03:18
k256+p256+p384: impl `Invert` trait for `Scalar` types (#741) The `Invert` trait now provides an `invert_vartime` method which can use a faster implementation than the constant time version. Leveraging this requires an explicit impl of the trait however, whereas before it was provided by a blanket impl for types ...
diff --git a/Cargo.lock b/Cargo.lock index b14d0090..3f4b3793 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -331,7 +331,7 @@ dependencies = [ [[package]] name = "ecdsa" version = "0.16.0-pre.0" -source = "git+https://github.com/RustCrypto/signatures.git#4e2b0b2cfcfaef61a1e8851080cf640313a6e516" +source = "git+https://...
14
120
22
c6ea4a6d986732835f9905232042a2ad0347d6b4
Tony Arcieri
2023-02-03T03:15:47
primeorder: extract `impl_primefield_tests!` macro (#739) Extracts the tests duplicated between the `FieldElement` and `Scalar` types of the `p256` and `p384` crates into a macro which writes them. It currently adds tests for the associated constants but could be further expanded in the future.
diff --git a/p256/src/arithmetic/field.rs b/p256/src/arithmetic/field.rs index 7f5f77b2..b22dc448 100644 --- a/p256/src/arithmetic/field.rs +++ b/p256/src/arithmetic/field.rs @@ -158,6 +158,7 @@ mod tests { use super::FieldElement; use crate::{test_vectors::field::DBL_TEST_VECTORS, FieldBytes}; use ellip...
6
46
138
75fbb71935e1b4cea99f132647d0f8af2cd07f96
Tony Arcieri
2023-02-03T01:25:18
Test MULTIPLICATIVE_GENERATOR^{t} mod m == ROOT_OF_UNITY (#738)
diff --git a/k256/src/arithmetic/field.rs b/k256/src/arithmetic/field.rs index adfc4529..0d165dac 100644 --- a/k256/src/arithmetic/field.rs +++ b/k256/src/arithmetic/field.rs @@ -522,6 +522,14 @@ mod tests { } } + /// t = (modulus - 1) >> S + const T: [u64; 4] = [ + 0xffffffff7ffffe17, + ...
6
90
46
231fcafc25b4671069ab1c206114046576fa5271
Tony Arcieri
2023-02-03T00:11:34
k256+p256+p384: add `PrimeField` constant tests; define `DELTA` (#737) Adds tests for the `TWO_INV`, `ROOT_OF_UNITY`, and `ROOT_OF_UNITY_INV` and `DELTA` constants, based on the tests generated via `ff_derive`. Also fixes the following: - k256: fix FieldElement::S constant - p256+p384: missing definitions of `...
diff --git a/k256/src/arithmetic/field.rs b/k256/src/arithmetic/field.rs index 82be5031..adfc4529 100644 --- a/k256/src/arithmetic/field.rs +++ b/k256/src/arithmetic/field.rs @@ -98,6 +98,11 @@ impl FieldElement { FieldElementImpl::from_bytes(bytes).map(Self) } + /// Convert a `u64` to a field elemen...
6
248
14
5fd44d839fff81dc01b4baa62d1fe89cb8c28eac
Tony Arcieri
2023-02-01T18:58:19
p256+p384: add `const fn` inversions for all field elements (#736) This adds an internal `invert_unchecked` method to all field element types, which is `const fn`. It's used to impl the `PrimeField` constants which are inversions of other constant values.
diff --git a/p256/src/arithmetic/field.rs b/p256/src/arithmetic/field.rs index 2f0d8739..adf1df42 100644 --- a/p256/src/arithmetic/field.rs +++ b/p256/src/arithmetic/field.rs @@ -53,24 +53,6 @@ primeorder::impl_field_element!( ); impl FieldElement { - /// Returns `self^by`, where `by` is a little-endian integer ...
5
69
34
acdfa634e23aade160a744b1f3607ae41bb1b61b
daxpedda
2023-02-01T18:02:57
Update hash2curve implementations to new API (#735)
diff --git a/Cargo.lock b/Cargo.lock index 804b8cd2..b14d0090 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -349,7 +349,7 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "elliptic-curve" version = "0.13.0-pre.3" -source = "git+https://github.com/RustCrypto/traits.git...
4
11
11