@@ -372,7 +372,7 @@ impl<C: CurveGroup> ShoupVess<C> {
372
372
ct : & VessCiphertext ,
373
373
comm : & <FeldmanVss < C > as VerifiableSecretSharing >:: Commitment ,
374
374
aad : & [ u8 ] ,
375
- ) -> Result < bool , VessError > {
375
+ ) -> Result < ( ) , VessError > {
376
376
let mut verifier_state = self . io_pattern ( aad) . to_verifier_state ( & ct. transcript ) ;
377
377
378
378
// verifier logic until Step 4b
@@ -407,10 +407,14 @@ impl<C: CurveGroup> ShoupVess<C> {
407
407
. expect ( "subset_size > 0, so is shifted_polys.len()" )
408
408
. as_ref ( ) ,
409
409
) ;
410
+
411
+ let mut unshifted_comm = vec ! [ ] ;
410
412
for ( shifted, delta) in shifted_comm. into_iter ( ) . zip ( comm. iter ( ) ) {
411
413
// g^omega'' / C in paper
412
- hasher . update ( serialize_to_vec ! [ shifted - delta] ? )
414
+ unshifted_comm . push ( shifted - delta) ;
413
415
}
416
+ let unshifted_comm = C :: normalize_batch ( & unshifted_comm) ;
417
+ hasher. update ( serialize_to_vec ! [ unshifted_comm] ?) ;
414
418
415
419
let mre_ct = mre_cts
416
420
. pop_front ( )
@@ -435,7 +439,11 @@ impl<C: CurveGroup> ShoupVess<C> {
435
439
debug_assert ! ( mre_cts. is_empty( ) ) ;
436
440
debug_assert ! ( seeds. is_empty( ) ) ;
437
441
438
- Ok ( h != hasher. finalize ( ) . as_slice ( ) )
442
+ if h == hasher. finalize ( ) . as_slice ( ) {
443
+ Ok ( ( ) )
444
+ } else {
445
+ Err ( VessError :: FailedVerification )
446
+ }
439
447
}
440
448
441
449
/// Decrypt with a decryption key `recv_sk` (labeled with node_idx, see `LabeledDecryptionKey`)
@@ -473,7 +481,7 @@ impl<C: CurveGroup> ShoupVess<C> {
473
481
let share = shifted_eval - unshifted_eval;
474
482
475
483
// check correctness
476
- if FeldmanVss :: < C > :: verify ( & self . vss_pp , node_idx, & share, & comm) ? {
484
+ if FeldmanVss :: < C > :: verify ( & self . vss_pp , node_idx, & share, & comm) . is_ok ( ) {
477
485
return Ok ( share) ;
478
486
}
479
487
}
@@ -643,6 +651,8 @@ pub enum VessError {
643
651
IndexOutOfBound ( usize , usize ) ,
644
652
#[ error( "wrong vss commitment supplied" ) ]
645
653
WrongCommitment ,
654
+ #[ error( "failed verification: proof verification failed" ) ]
655
+ FailedVerification ,
646
656
#[ error( "decryption fail" ) ]
647
657
DecryptionFailed ,
648
658
}
@@ -692,10 +702,10 @@ mod tests {
692
702
let aad = b"Associated data" ;
693
703
let ( ct, comm) = vess. encrypted_shares ( & recv_pks, secret, aad) . unwrap ( ) ;
694
704
695
- assert ! ( vess. verify( & recv_pks, & ct, & comm, aad) . unwrap ( ) ) ;
705
+ assert ! ( vess. verify( & recv_pks, & ct, & comm, aad) . is_ok ( ) ) ;
696
706
for labeled_recv_sk in labeled_sks {
697
707
let share = vess. decrypt_share ( & labeled_recv_sk, & ct, aad) . unwrap ( ) ;
698
- assert ! ( Vss :: verify( & vess. vss_pp, labeled_recv_sk. node_idx, & share, & comm) . unwrap ( ) ) ;
708
+ assert ! ( Vss :: verify( & vess. vss_pp, labeled_recv_sk. node_idx, & share, & comm) . is_ok ( ) ) ;
699
709
}
700
710
}
701
711
0 commit comments