Compare commits

..

No commits in common. "2ca58d8b5ad8f7d5d09dec35a7076a0e5089deba" and "e2e59e50a6791e994fe95c27540ef39e3fdc3f92" have entirely different histories.

1 changed files with 6 additions and 10 deletions

View File

@ -30,7 +30,6 @@ use super::super::cred;
use super::super::scalar_u32;
use super::super::{BridgeAuth, IssuerPubKey};
use super::super::{CMZ_A, CMZ_A_TABLE};
pub const H_GENERATOR_STRING: &str = "PR Generator H for ";
#[derive(Serialize, Deserialize)]
pub struct Request {
@ -45,7 +44,7 @@ pub struct Request {
CQ: RistrettoPoint,
// Fields for proving which bucket we have
pub date: u32, // date is used to compute H
pub H: RistrettoPoint,
pub BP: RistrettoPoint,
// Fields for proving 3 <= trust_level <= 4
@ -87,13 +86,13 @@ pub fn request(lox_cred: &cred::Lox, lox_pub: &IssuerPubKey) -> Result<Request,
let Atable: &RistrettoBasepointTable = &CMZ_A_TABLE;
// TODO: Where should this go? For efficiency, this should probably be global
let date: u32 = time::OffsetDateTime::now_utc()
let today: u32 = time::OffsetDateTime::now_utc()
.date()
.to_julian_day()
.try_into()
.unwrap();
let H: RistrettoPoint = RistrettoPoint::hash_from_bytes::<Sha512>(
format!("{}{}", H_GENERATOR_STRING, date).as_bytes(),
format!("PR Generator H for {}", today).as_bytes(),
);
let Htable: RistrettoBasepointTable = RistrettoBasepointTable::create(&H);
@ -224,7 +223,7 @@ pub fn request(lox_cred: &cred::Lox, lox_pub: &IssuerPubKey) -> Result<Request,
CInvRemain,
CBlockages,
CQ,
date,
H,
BP,
CGsq,
piUser,
@ -235,11 +234,8 @@ impl BridgeAuth {
/// Receive a positive report request
pub fn handle_positive_report(&mut self, req: Request) -> Result<(), ProofError> {
let A: &RistrettoPoint = &CMZ_A;
let H: RistrettoPoint = RistrettoPoint::hash_from_bytes::<Sha512>(
format!("{}{}", H_GENERATOR_STRING, req.date).as_bytes(),
);
if req.P.is_identity() {
if req.P.is_identity() || req.H.is_identity() {
return Err(ProofError::VerificationFailure);
}
@ -279,7 +275,7 @@ impl BridgeAuth {
Xsince: &self.lox_pub.X[4].compress(),
Xinvremain: &self.lox_pub.X[5].compress(),
Xblockages: &self.lox_pub.X[6].compress(),
H: &H.compress(),
H: &req.H.compress(),
BP: &req.BP.compress(),
CG: &CG.compress(),
CGsq: &req.CGsq.compress(),