Skip to content

Commit

Permalink
k256+p256: impl PrimeCurveArithmetic; MSRV 1.52 (#415)
Browse files Browse the repository at this point in the history
Implements the `PrimeCurveArithmetic` trait introduced in
RustCrypto/traits#739.
  • Loading branch information
tarcieri authored Sep 8, 2021
1 parent 4ef2a5e commit 9748fd9
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bp256.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bp384.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -47,7 +47,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
steps:
- uses: actions/checkout@v2
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/k256.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
steps:
- uses: actions/checkout@v2
Expand All @@ -72,15 +72,15 @@ jobs:
include:
# 32-bit Linux
- target: i686-unknown-linux-gnu
rust: 1.51.0 # MSRV
rust: 1.52.0 # MSRV
deps: sudo apt update && sudo apt install gcc-multilib
- target: i686-unknown-linux-gnu
rust: stable
deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit Linux
- target: x86_64-unknown-linux-gnu
rust: 1.51.0 # MSRV
rust: 1.52.0 # MSRV
- target: x86_64-unknown-linux-gnu
rust: stable

Expand All @@ -105,19 +105,19 @@ jobs:
# include:
# # ARM32
# - target: armv7-unknown-linux-gnueabihf
# rust: 1.51.0 # MSRV
# rust: 1.52.0 # MSRV
# - target: armv7-unknown-linux-gnueabihf
# rust: stable
#
# # ARM64
# - target: aarch64-unknown-linux-gnu
# rust: 1.51.0 # MSRV
# rust: 1.52.0 # MSRV
# - target: aarch64-unknown-linux-gnu
# rust: stable
#
# # PPC32
# - target: powerpc-unknown-linux-gnu
# rust: 1.51.0 # MSRV
# rust: 1.52.0 # MSRV
# - target: powerpc-unknown-linux-gnu
# rust: stable
#
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/p256.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand Down Expand Up @@ -54,15 +54,15 @@ jobs:
include:
# 32-bit Linux
- target: i686-unknown-linux-gnu
rust: 1.51.0 # MSRV
rust: 1.52.0 # MSRV
deps: sudo apt update && sudo apt install gcc-multilib
- target: i686-unknown-linux-gnu
rust: stable
deps: sudo apt update && sudo apt install gcc-multilib

# 64-bit Linux
- target: x86_64-unknown-linux-gnu
rust: 1.51.0 # MSRV
rust: 1.52.0 # MSRV
- target: x86_64-unknown-linux-gnu
rust: stable

Expand All @@ -87,19 +87,19 @@ jobs:
# include:
# # ARM32
# - target: armv7-unknown-linux-gnueabihf
# rust: 1.51.0 # MSRV
# rust: 1.52.0 # MSRV
# - target: armv7-unknown-linux-gnueabihf
# rust: stable
#
# # ARM64
# - target: aarch64-unknown-linux-gnu
# rust: 1.51.0 # MSRV
# rust: 1.52.0 # MSRV
# - target: aarch64-unknown-linux-gnu
# rust: stable
#
# # PPC32
# - target: powerpc-unknown-linux-gnu
# rust: 1.51.0 # MSRV
# rust: 1.52.0 # MSRV
# - target: powerpc-unknown-linux-gnu
# rust: stable
#
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/p384.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -48,7 +48,7 @@ jobs:
strategy:
matrix:
rust:
- 1.51.0 # MSRV
- 1.52.0 # MSRV
- stable
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.51.0
toolchain: 1.52.0
components: clippy
override: true
profile: minimal
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if you are interested in curves beyond the ones listed here.

## Minimum Supported Rust Version

All crates in this repository support Rust **1.51** or higher.
All crates in this repository support Rust **1.52** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand All @@ -50,7 +50,7 @@ dual licensed as above, without any additional terms or conditions.

[//]: # (badges)

[rustc-image]: https://img.shields.io/badge/rustc-1.51+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.52+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260040-elliptic-curves
[deps-image]: https://deps.rs/repo/github/RustCrypto/elliptic-curves/status.svg
Expand Down
4 changes: 2 additions & 2 deletions bp256/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ implemented in terms of traits from the [`elliptic-curve`] crate.

## Minimum Supported Rust Version

Rust **1.51** or higher.
Rust **1.52** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand Down Expand Up @@ -46,7 +46,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/bp256/badge.svg
[docs-link]: https://docs.rs/bp256/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.51+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.52+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260040-elliptic-curves
[build-image]: https://github.com/RustCrypto/elliptic-curves/workflows/bp256/badge.svg?branch=master&event=push
Expand Down
2 changes: 1 addition & 1 deletion bp256/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! ## Minimum Supported Rust Version
//!
//! Rust **1.51** or higher.
//! Rust **1.52** or higher.
//!
//! Minimum supported Rust version may be changed in the future, but it will be
//! accompanied with a minor version bump.
Expand Down
4 changes: 2 additions & 2 deletions bp384/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ implemented in terms of traits from the [`elliptic-curve`] crate.

## Minimum Supported Rust Version

Rust **1.51** or higher.
Rust **1.52** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand Down Expand Up @@ -46,7 +46,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/bp384/badge.svg
[docs-link]: https://docs.rs/bp384/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.51+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.52+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260040-elliptic-curves
[build-image]: https://github.com/RustCrypto/elliptic-curves/workflows/bp384/badge.svg?branch=master&event=push
Expand Down
2 changes: 1 addition & 1 deletion bp384/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! ## Minimum Supported Rust Version
//!
//! Rust **1.51** or higher.
//! Rust **1.52** or higher.
//!
//! Minimum supported Rust version may be changed in the future, but it will be
//! accompanied with a minor version bump.
Expand Down
2 changes: 1 addition & 1 deletion k256/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020 RustCrypto Developers
Copyright (c) 2020-2021 RustCrypto Developers

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
4 changes: 2 additions & 2 deletions k256/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ most popular and commonly used elliptic curves.

## Minimum Supported Rust Version

Rust **1.51** or higher.
Rust **1.52** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand Down Expand Up @@ -95,7 +95,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/k256/badge.svg
[docs-link]: https://docs.rs/k256/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.51+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.52+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260040-elliptic-curves
[build-image]: https://github.com/RustCrypto/elliptic-curves/workflows/k256/badge.svg?branch=master&event=push
Expand Down
6 changes: 5 additions & 1 deletion k256/src/arithmetic/projective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use elliptic_curve::{
sec1::{FromEncodedPoint, ToEncodedPoint},
subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption},
zeroize::DefaultIsZeroes,
ProjectiveArithmetic,
PrimeCurveArithmetic, ProjectiveArithmetic,
};

#[rustfmt::skip]
Expand All @@ -31,6 +31,10 @@ impl ProjectiveArithmetic for Secp256k1 {
type ProjectivePoint = ProjectivePoint;
}

impl PrimeCurveArithmetic for Secp256k1 {
type CurveGroup = ProjectivePoint;
}

/// A point on the secp256k1 curve in projective coordinates.
#[derive(Clone, Copy, Debug)]
#[cfg_attr(docsrs, doc(cfg(feature = "arithmetic")))]
Expand Down
2 changes: 1 addition & 1 deletion k256/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//!
//! ## Minimum Supported Rust Version
//!
//! Rust **1.51** or higher.
//! Rust **1.52** or higher.
//!
//! Minimum supported Rust version may be changed in the future, but it will be
//! accompanied with a minor version bump.
Expand Down
2 changes: 1 addition & 1 deletion p256/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020 RustCrypto Developers
Copyright (c) 2020-2021 RustCrypto Developers

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
4 changes: 2 additions & 2 deletions p256/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ like TLS and the associated X.509 PKI.

## Minimum Supported Rust Version

Rust **1.51** or higher.
Rust **1.52** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand Down Expand Up @@ -79,7 +79,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/p256/badge.svg
[docs-link]: https://docs.rs/p256/
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.51+-blue.svg
[rustc-image]: https://img.shields.io/badge/rustc-1.52+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260040-elliptic-curves
[build-image]: https://github.com/RustCrypto/elliptic-curves/workflows/p256/badge.svg?branch=master&event=push
Expand Down
6 changes: 5 additions & 1 deletion p256/src/arithmetic/projective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ use elliptic_curve::{
sec1::{FromEncodedPoint, ToEncodedPoint},
subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption},
zeroize::DefaultIsZeroes,
ProjectiveArithmetic,
PrimeCurveArithmetic, ProjectiveArithmetic,
};

impl ProjectiveArithmetic for NistP256 {
type ProjectivePoint = ProjectivePoint;
}

impl PrimeCurveArithmetic for NistP256 {
type CurveGroup = ProjectivePoint;
}

/// A point on the secp256r1 curve in projective coordinates.
#[derive(Clone, Copy, Debug)]
#[cfg_attr(docsrs, doc(cfg(feature = "arithmetic")))]
Expand Down
2 changes: 1 addition & 1 deletion p256/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
//!
//! ## Minimum Supported Rust Version
//!
//! Rust **1.51** or higher.
//! Rust **1.52** or higher.
//!
//! Minimum supported Rust version may be changed in the future, but it will be
//! accompanied with a minor version bump.
Expand Down
2 changes: 1 addition & 1 deletion p384/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020 RustCrypto Developers
Copyright (c) 2020-2021 RustCrypto Developers

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
Expand Down
2 changes: 1 addition & 1 deletion p384/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! ## Minimum Supported Rust Version
//!
//! Rust **1.51** or higher.
//! Rust **1.52** or higher.
//!
//! Minimum supported Rust version may be changed in the future, but it will be
//! accompanied with a minor version bump.
Expand Down

0 comments on commit 9748fd9

Please sign in to comment.