From 69cf8f5f77c86980b80cdf568774fbb7cb3a2a2a Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 22 Dec 2021 05:22:56 +0000 Subject: [PATCH] Remove `CurveAffine::{read, write}` This removes the last dependency on `std::io`. --- CHANGELOG.md | 2 ++ src/arithmetic/curves.rs | 16 ---------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 768dde2..56142bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ and this project adheres to Rust's notion of - `FieldExt::{from_bytes, read, to_bytes, write}` (use `ff::PrimeField::{from_repr, to_repr}` instead). - `FieldExt::rand` (use `ff::Field::random` instead). + - `CurveAffine::{read, write}` + (use `group::GroupEncoding::{from_bytes, to_bytes}` instead). ## [0.2.1] - 2021-09-17 ### Changed diff --git a/src/arithmetic/curves.rs b/src/arithmetic/curves.rs index 4bd128f..2ada7bc 100644 --- a/src/arithmetic/curves.rs +++ b/src/arithmetic/curves.rs @@ -12,7 +12,6 @@ use super::{FieldExt, Group}; #[cfg(feature = "std")] use std::{ boxed::Box, - io::{self, Read, Write}, ops::{Add, Mul, Sub}, }; @@ -123,21 +122,6 @@ pub trait CurveAffine: /// always be true unless an "unchecked" API was used. fn is_on_curve(&self) -> Choice; - /// Reads a compressed element from the buffer and attempts to parse it - /// using `from_bytes`. - fn read(reader: &mut R) -> io::Result { - let mut compressed = Self::Repr::default(); - reader.read_exact(compressed.as_mut())?; - Option::from(Self::from_bytes(&compressed)) - .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "invalid point encoding in proof")) - } - - /// Writes an element in compressed form to the buffer. - fn write(&self, writer: &mut W) -> io::Result<()> { - let compressed = self.to_bytes(); - writer.write_all(compressed.as_ref()) - } - /// Returns the curve constant $a$. fn a() -> Self::Base;