diff --git a/Cargo.toml b/Cargo.toml index eeab765..922dec3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,19 +1,20 @@ [package] name = "ff" -version = "0.5.1" +version = "0.6.3" authors = ["Sean Bowe "] description = "Library for building and interfacing with finite fields" readme = "README.md" -documentation = "https://docs.rs/ff/" -homepage = "https://github.com/ebfull/ff" +documentation = "https://docs.rs/ff-zeroize/" +homepage = "https://github.com/algorand/ff-zeroize" license = "MIT/Apache-2.0" -repository = "https://github.com/ebfull/ff" +repository = "https://github.com/algorand/ff-zeroize" edition = "2018" [dependencies] byteorder = "1" -ff_derive = { version = "0.4.0", path = "ff_derive", optional = true } +ff_derive = { version = "0.6.2", path = "ff_derive", optional = true } rand_core = "0.5" +zeroize = {version = "1.1", features = ["zeroize_derive"]} [features] default = [] diff --git a/README.md b/README.md index 57ef693..c9e87be 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# ff +# ff-zeroize -`ff` is a finite field library written in pure Rust, with no `unsafe{}` code. +* `ff-zeroize` is a temporary crate that enables `zeroize` features for `ff`crate +* `ff` is a finite field library written in pure Rust, with no `unsafe{}` code. ## Disclaimers @@ -12,7 +13,7 @@ Add the `ff` crate to your `Cargo.toml`: ```toml [dependencies] -ff = "0.5" +ff_zeroize = "0.6.1" ``` The `ff` crate contains `Field`, `PrimeField`, `PrimeFieldRepr` and `SqrtField` traits. @@ -29,7 +30,7 @@ First, enable the `derive` crate feature: ```toml [dependencies] -ff = { version = "0.4", features = ["derive"] } +ff_zeroize = { version = "0.6.1", features = ["derive"] } ``` And then use the macro like so: diff --git a/ff_derive/Cargo.toml b/ff_derive/Cargo.toml index 88ba23e..32d7e46 100644 --- a/ff_derive/Cargo.toml +++ b/ff_derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ff_derive" -version = "0.4.0" +version = "0.6.2" authors = ["Sean Bowe "] description = "Procedural macro library used to build custom prime field implementations" documentation = "https://docs.rs/ff/" diff --git a/ff_derive/src/lib.rs b/ff_derive/src/lib.rs index 5e56e74..92213cb 100644 --- a/ff_derive/src/lib.rs +++ b/ff_derive/src/lib.rs @@ -116,7 +116,7 @@ fn fetch_attr(name: &str, attrs: &[syn::Attribute]) -> Option { // Implement PrimeFieldRepr for the wrapped ident `repr` with `limbs` limbs. fn prime_field_repr_impl(repr: &syn::Ident, limbs: usize) -> proc_macro2::TokenStream { quote! { - #[derive(Copy, Clone, PartialEq, Eq, Default)] + #[derive(Copy, Clone, PartialEq, Eq, Default, Zeroize)] pub struct #repr(pub [u64; #limbs]); impl ::std::fmt::Debug for #repr diff --git a/src/lib.rs b/src/lib.rs index c66163d..b85ccd1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,9 @@ extern crate ff_derive; #[cfg(feature = "derive")] pub use ff_derive::*; +#[macro_use] +extern crate zeroize; + use rand_core::RngCore; use std::error::Error; use std::fmt; @@ -108,6 +111,7 @@ pub trait PrimeFieldRepr: + AsRef<[u64]> + AsMut<[u64]> + From + + zeroize::Zeroize { /// Subtract another represetation from this one. fn sub_noborrow(&mut self, other: &Self);