From daa8dc048f19e7d11a9d8a8125b35cd8eb5f5046 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 19 Jan 2023 20:11:56 +0100 Subject: [PATCH] Upgrade `p256` to v0.12 (#90) * Upgrade `p256` to v0.12 * Upgrade MSRV to 1.60 --- .github/workflows/main.yml | 2 +- Cargo.toml | 4 ++-- README.md | 2 +- src/group/elliptic_curve.rs | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4131f71..c09240e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,7 +43,7 @@ jobs: - --features serde toolchain: - stable - - 1.57.0 + - 1.60.0 name: test steps: - name: Checkout sources diff --git a/Cargo.toml b/Cargo.toml index 6ac472b..15f3dde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "voprf" readme = "README.md" repository = "https://github.com/novifinancial/voprf/" -rust-version = "1.57" +rust-version = "1.60" version = "0.5.0-pre.1" [features] @@ -45,7 +45,7 @@ zeroize = { version = "1.5", default-features = false } generic-array = { version = "0.14", features = ["more_lengths"] } hex = "0.4" json = "0.12" -p256 = { version = "0.11", default-features = false, features = [ +p256 = { version = "0.12", default-features = false, features = [ "hash2curve", "voprf", ] } diff --git a/README.md b/README.md index 7b8a685..3f74279 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ voprf = "0.5.0-pre.1" ### Minimum Supported Rust Version -Rust **1.57** or higher. +Rust **1.60** or higher. Contributors ------------ diff --git a/src/group/elliptic_curve.rs b/src/group/elliptic_curve.rs index edbd958..b534e8e 100644 --- a/src/group/elliptic_curve.rs +++ b/src/group/elliptic_curve.rs @@ -23,7 +23,7 @@ use crate::{Error, InternalError, Result}; impl Group for C where C: GroupDigest, - ProjectivePoint: CofactorGroup + ToEncodedPoint, + ProjectivePoint: CofactorGroup, FieldSize: ModulusSize, AffinePoint: FromEncodedPoint + ToEncodedPoint, Scalar: FromOkm, @@ -65,7 +65,8 @@ where } fn serialize_elem(elem: Self::Elem) -> GenericArray { - let bytes = elem.to_encoded_point(true); + let affine: AffinePoint = elem.into(); + let bytes = affine.to_encoded_point(true); let bytes = bytes.as_bytes(); let mut result = GenericArray::default(); result[..bytes.len()].copy_from_slice(bytes);