Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 35 additions & 34 deletions .github/workflows/k256.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,37 +99,38 @@ jobs:
- run: cargo test --release --target ${{ matrix.target }} --features field-montgomery
- run: cargo test --release --target ${{ matrix.target }} --all-features

cross:
strategy:
matrix:
include:
# ARM32
- target: armv7-unknown-linux-gnueabihf
rust: 1.51.0 # MSRV
- target: armv7-unknown-linux-gnueabihf
rust: stable

# ARM64
- target: aarch64-unknown-linux-gnu
rust: 1.51.0 # MSRV
- target: aarch64-unknown-linux-gnu
rust: stable

# PPC32
- target: powerpc-unknown-linux-gnu
rust: 1.51.0 # MSRV
- target: powerpc-unknown-linux-gnu
rust: stable

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: ${{ matrix.deps }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- run: cargo install cross
- run: cross test --release --target ${{ matrix.target }} --all-features
# TODO(tarcieri): re-enable when new `elliptic-curve` and `ecdsa` crates are released
# cross:
# strategy:
# matrix:
# include:
# # ARM32
# - target: armv7-unknown-linux-gnueabihf
# rust: 1.51.0 # MSRV
# - target: armv7-unknown-linux-gnueabihf
# rust: stable
#
# # ARM64
# - target: aarch64-unknown-linux-gnu
# rust: 1.51.0 # MSRV
# - target: aarch64-unknown-linux-gnu
# rust: stable
#
# # PPC32
# - target: powerpc-unknown-linux-gnu
# rust: 1.51.0 # MSRV
# - target: powerpc-unknown-linux-gnu
# rust: stable
#
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - run: ${{ matrix.deps }}
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: ${{ matrix.rust }}
# target: ${{ matrix.target }}
# override: true
# - run: cargo install cross
# - run: cross test --release --target ${{ matrix.target }} --all-features
69 changes: 35 additions & 34 deletions .github/workflows/p256.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,37 +80,38 @@ jobs:
- run: cargo test --release --target ${{ matrix.target }}
- run: cargo test --release --target ${{ matrix.target }} --all-features

cross:
strategy:
matrix:
include:
# ARM32
- target: armv7-unknown-linux-gnueabihf
rust: 1.51.0 # MSRV
- target: armv7-unknown-linux-gnueabihf
rust: stable

# ARM64
- target: aarch64-unknown-linux-gnu
rust: 1.51.0 # MSRV
- target: aarch64-unknown-linux-gnu
rust: stable

# PPC32
- target: powerpc-unknown-linux-gnu
rust: 1.51.0 # MSRV
- target: powerpc-unknown-linux-gnu
rust: stable

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: ${{ matrix.deps }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- run: cargo install cross
- run: cross test --release --target ${{ matrix.target }} --all-features
# TODO(tarcieri): re-enable when new `elliptic-curve` and `ecdsa` crates are released
# cross:
# strategy:
# matrix:
# include:
# # ARM32
# - target: armv7-unknown-linux-gnueabihf
# rust: 1.51.0 # MSRV
# - target: armv7-unknown-linux-gnueabihf
# rust: stable
#
# # ARM64
# - target: aarch64-unknown-linux-gnu
# rust: 1.51.0 # MSRV
# - target: aarch64-unknown-linux-gnu
# rust: stable
#
# # PPC32
# - target: powerpc-unknown-linux-gnu
# rust: 1.51.0 # MSRV
# - target: powerpc-unknown-linux-gnu
# rust: stable
#
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - run: ${{ matrix.deps }}
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: ${{ matrix.rust }}
# target: ${{ matrix.target }}
# override: true
# - run: cargo install cross
# - run: cross test --release --target ${{ matrix.target }} --all-features
28 changes: 13 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ members = [
"p256",
"p384",
]

[patch.crates-io]
ecdsa = { git = "https://github.com/RustCrypto/signatures.git" }
elliptic-curve = { git = "https://github.com/RustCrypto/traits.git" }
6 changes: 3 additions & 3 deletions bp256/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bp256"
description = "Brainpool P-256 (brainpoolP256r1 and brainpoolP256t1) elliptic curves"
version = "0.2.0" # Also update html_root_url in lib.rs when bumping this
version = "0.3.0-pre" # Also update html_root_url in lib.rs when bumping this
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
documentation = "https://docs.rs/elliptic-curve"
Expand All @@ -12,10 +12,10 @@ categories = ["cryptography", "no-std"]
keywords = ["brainpool", "crypto", "ecc"]

[dependencies]
elliptic-curve = { version = "0.10", default-features = false, features = ["hazmat"] }
elliptic-curve = { version = "=0.11.0-pre", default-features = false, features = ["hazmat"] }

# optional dependencies
ecdsa = { version = "0.12", optional = true, default-features = false, features = ["der"] }
ecdsa = { version = "=0.13.0-pre", optional = true, default-features = false, features = ["der"] }
sha2 = { version = "0.9", optional = true, default-features = false }

[features]
Expand Down
2 changes: 1 addition & 1 deletion bp256/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_root_url = "https://docs.rs/bp256/0.2.0"
html_root_url = "https://docs.rs/bp256/0.3.0-pre"
)]
#![forbid(unsafe_code)]
#![warn(missing_docs, rust_2018_idioms, unused_qualifications)]
Expand Down
6 changes: 3 additions & 3 deletions bp384/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bp384"
description = "Brainpool P-384 (brainpoolP384r1 and brainpoolP384t1) elliptic curves"
version = "0.2.0" # Also update html_root_url in lib.rs when bumping this
version = "0.3.0-pre" # Also update html_root_url in lib.rs when bumping this
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
documentation = "https://docs.rs/elliptic-curve"
Expand All @@ -12,10 +12,10 @@ categories = ["cryptography", "no-std"]
keywords = ["brainpool", "crypto", "ecc"]

[dependencies]
elliptic-curve = { version = "0.10", default-features = false, features = ["hazmat"] }
elliptic-curve = { version = "=0.11.0-pre", default-features = false, features = ["hazmat"] }

# optional dependencies
ecdsa = { version = "0.12", optional = true, default-features = false, features = ["der"] }
ecdsa = { version = "=0.13.0-pre", optional = true, default-features = false, features = ["der"] }
sha2 = { version = "0.9", optional = true, default-features = false }

[features]
Expand Down
2 changes: 1 addition & 1 deletion bp384/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
html_root_url = "https://docs.rs/bp384/0.2.0"
html_root_url = "https://docs.rs/bp384/0.3.0-pre"
)]
#![forbid(unsafe_code)]
#![warn(missing_docs, rust_2018_idioms, unused_qualifications)]
Expand Down
14 changes: 4 additions & 10 deletions k256/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ signing/verification (including Ethereum-style signatures with public-key
recovery), Elliptic Curve Diffie-Hellman (ECDH), and general purpose secp256k1
curve arithmetic useful for implementing arbitrary group-based protocols.
"""
version = "0.9.6" # Also update html_root_url in lib.rs when bumping this
version = "0.10.0-pre" # Also update html_root_url in lib.rs when bumping this
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
documentation = "https://docs.rs/elliptic-curve"
Expand All @@ -18,24 +18,18 @@ keywords = ["bitcoin", "crypto", "ecc", "ethereum", "secp256k1"]

[dependencies]
cfg-if = "1.0"
elliptic-curve = { version = "0.10.6", default-features = false, features = ["hazmat"] }
elliptic-curve = { version = "=0.11.0-pre", default-features = false, features = ["hazmat"] }

# optional dependencies
ecdsa-core = { version = "=0.13.0-pre", package = "ecdsa", optional = true, default-features = false, features = ["der"] }
hex-literal = { version = "0.3", optional = true }
sha2 = { version = "0.9", optional = true, default-features = false }
sha3 = { version = "0.9", optional = true, default-features = false }

[dependencies.ecdsa-core]
version = "0.12.1"
package = "ecdsa"
optional = true
default-features = false
features = ["der"]

[dev-dependencies]
blobby = "0.3"
criterion = "0.3"
ecdsa-core = { version = "0.12.1", package = "ecdsa", default-features = false, features = ["dev"] }
ecdsa-core = { version = "=0.13.0-pre", package = "ecdsa", default-features = false, features = ["dev"] }
hex-literal = "0.3"
num-bigint = "0.4"
num-traits = "0.2"
Expand Down
14 changes: 5 additions & 9 deletions k256/src/arithmetic/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ impl Field for Scalar {
Scalar::one()
}

fn is_zero(&self) -> bool {
self.0.is_zero().into()
}

#[must_use]
fn square(&self) -> Self {
Scalar::square(self)
Expand Down Expand Up @@ -493,16 +489,16 @@ impl PrimeField for Scalar {
///
/// Returns None if the byte array does not contain a big-endian integer in the range
/// [0, p).
fn from_repr(bytes: FieldBytes) -> Option<Self> {
ScalarImpl::from_bytes(bytes.as_ref()).map(Self).into()
fn from_repr(bytes: FieldBytes) -> CtOption<Self> {
ScalarImpl::from_bytes(bytes.as_ref()).map(Self)
}

fn to_repr(&self) -> FieldBytes {
self.to_bytes()
}

fn is_odd(&self) -> bool {
self.0.is_odd().into()
fn is_odd(&self) -> Choice {
self.0.is_odd()
}

fn multiplicative_generator() -> Self {
Expand Down Expand Up @@ -707,7 +703,7 @@ impl Scalar {
// TODO: pre-generate several scalars to bring the probability of non-constant-timeness down?
loop {
rng.fill_bytes(&mut bytes);
if let Some(scalar) = Scalar::from_repr(bytes) {
if let Some(scalar) = Scalar::from_repr(bytes).into() {
return scalar;
}
}
Expand Down
Loading