Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/t218 bls sig arkworks #223

Merged
merged 25 commits into from
Apr 5, 2023
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5dc6d75
Skeleton of code compiling
philippecamacho Mar 29, 2023
dd40098
Fix type errors
philippecamacho Mar 29, 2023
c7b36f7
Merge branch 'main' into feat/t218-bls-sig-arkworks
philippecamacho Mar 29, 2023
c566707
Fix trait errors
philippecamacho Mar 29, 2023
17c4ab5
Key pair generation
philippecamacho Mar 29, 2023
52b45ef
Fix clippy error.
philippecamacho Mar 29, 2023
ff4ecbc
Sketch for hash to curve.
philippecamacho Mar 30, 2023
2ba50b4
Remove type parameter P:Pairing.
philippecamacho Mar 31, 2023
d25d39d
Revert "Remove type parameter P:Pairing."
philippecamacho Apr 3, 2023
6f86ed3
Revert "Revert "Remove type parameter P:Pairing.""
philippecamacho Apr 3, 2023
5192c55
First version of hash and pray function for Bn254 curve.
philippecamacho Apr 3, 2023
b9f6038
Signature trait tests passing.
philippecamacho Apr 3, 2023
b53f097
Take into account the algorithm id
philippecamacho Apr 3, 2023
c16c1d8
Remove commented code.
philippecamacho Apr 3, 2023
9ca2f68
Fix ID of signature algorithm.
philippecamacho Apr 3, 2023
5160bea
Serde tests
philippecamacho Apr 3, 2023
203af5e
Parametrize `hash_to_curve` with the hash function for mapping bytes …
philippecamacho Apr 4, 2023
ba4825b
Add some comments / todos.
philippecamacho Apr 4, 2023
af922fe
Document hash_to_curve function.
philippecamacho Apr 4, 2023
4491b3c
Misc improvements, renaming.
philippecamacho Apr 4, 2023
60df9d0
Merge branch 'main' into feat/t218-bls-sig-arkworks
philippecamacho Apr 4, 2023
18f5243
Add `Copy` trait to `VerKey` and remove superfluous use of `clone()`.
philippecamacho Apr 5, 2023
bc53944
Simplify code for computing initial field element x.
philippecamacho Apr 5, 2023
ac95111
Better ciphersuite identifier for BLS signature scheme over BN254 curve.
philippecamacho Apr 5, 2023
a07c229
Test for long messages.
philippecamacho Apr 5, 2023
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
7 changes: 6 additions & 1 deletion primitives/src/constants.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
/// ciphersuite identifier for schnorr signature
pub const CS_ID_SCHNORR: &str = "SCHNORR_WITH_RESCUE_HASH_v01";

/// ciphersuite identifier for BLS signature, see:
/// ciphersuite identifier for BLS signature over BLS12_381, see:
/// <https://www.ietf.org/archive/id/draft-irtf-cfrg-bls-signature-05.html#name-ciphersuite-format>
pub const CS_ID_BLS_MIN_SIG: &str = "BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_";

@@ -23,3 +23,8 @@ pub const BLS_SIG_COMPRESSED_SIGNATURE_SIZE: usize = 48;
pub const BLS_SIG_PK_SIZE: usize = 192;
/// Size in bytes of a compressed verification key in our BLS signature scheme.
pub const BLS_SIG_COMPRESSED_PK_SIZE: usize = 96;

/// ciphersuite identifier for BLS signature over BN254
/// Note this is **adapted** from <https://www.ietf.org/archive/id/draft-irtf-cfrg-bls-signature-05.html#name-ciphersuite-format>.
/// In particular the "hash-and-pray" method is not part of <https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hash-to-curve-16>, so the tag "NCTH" (non constant time hash) is not standard.
pub const CS_ID_BLS_BN254: &str = "BLS_SIG_BN254G1_XMD:KECCAK_NCTH_NUL_";
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
//!
//! ```
//! use rand_core::{RngCore, OsRng};
//! use jf_primitives::signatures::{SignatureScheme, bls::BLSSignatureScheme};
//! use jf_primitives::signatures::{SignatureScheme, bls_over_bls12381::BLSSignatureScheme};
//!
//! let pp = BLSSignatureScheme::param_gen::<OsRng>(None)?;
//!
@@ -40,7 +40,7 @@
//! ```
//! use rand_core::{RngCore, OsRng};
//! use sha2::{Sha256, Digest};
//! use jf_primitives::signatures::{SignatureScheme, bls::BLSSignatureScheme};
//! use jf_primitives::signatures::{SignatureScheme, bls_over_bls12381::BLSSignatureScheme};
//!
//! let pp = BLSSignatureScheme::param_gen::<OsRng>(None)?;
//!
@@ -73,11 +73,12 @@ use super::SignatureScheme;
use crate::{
constants::{
BLS_SIG_COMPRESSED_PK_SIZE, BLS_SIG_COMPRESSED_SIGNATURE_SIZE, BLS_SIG_PK_SIZE,
BLS_SIG_SIGNATURE_SIZE, BLS_SIG_SK_SIZE, CS_ID_BLS_MIN_SIG,
BLS_SIG_SIGNATURE_SIZE, BLS_SIG_SK_SIZE,
},
errors::PrimitivesError,
};

use crate::constants::CS_ID_BLS_MIN_SIG;
use ark_serialize::*;
use ark_std::{
format,
@@ -325,15 +326,15 @@ pub struct BLSSignatureScheme;
impl SignatureScheme for BLSSignatureScheme {
const CS_ID: &'static str = CS_ID_BLS_MIN_SIG;

/// Public parameter
type PublicParameter = ();

/// Signing key
type SigningKey = BLSSignKey;

/// Verification key
type VerificationKey = BLSVerKey;

/// Public parameter
type PublicParameter = ();

/// Signature
type Signature = BLSSignature;

Loading