1
- //! ZK-proof for factoring of a RSA modulus. Called Пfac or Rfac in the CGGMP21
1
+ //! ZK-proof for factoring of a RSA modulus. Called Пfac or Rfac in the CGGMP24
2
2
//! paper.
3
3
//!
4
4
//! ## Description
@@ -145,8 +145,6 @@ pub struct Commitment {
145
145
pub b : Integer ,
146
146
#[ udigest( as = crate :: common:: encoding:: Integer ) ]
147
147
pub t : Integer ,
148
- #[ udigest( as = crate :: common:: encoding:: Integer ) ]
149
- pub sigma : Integer ,
150
148
}
151
149
152
150
/// Verifier's challenge to prover. Can be obtained deterministically by
@@ -198,7 +196,6 @@ pub mod interactive {
198
196
let beta = Integer :: from_rng_pm ( & n_root_modulo, & mut rng) ;
199
197
let mu = Integer :: from_rng_pm ( & l_n_circ_modulo, & mut rng) ;
200
198
let nu = Integer :: from_rng_pm ( & l_n_circ_modulo, & mut rng) ;
201
- let sigma = Integer :: from_rng_pm ( & ( & two_to_l * & n_n_circ) . complete ( ) , & mut rng) ;
202
199
let r = Integer :: from_rng_pm ( & ( & two_to_l_plus_e * & n_n_circ) . complete ( ) , & mut rng) ;
203
200
let x = Integer :: from_rng_pm ( & l_e_n_circ_modulo, & mut rng) ;
204
201
let y = Integer :: from_rng_pm ( & l_e_n_circ_modulo, & mut rng) ;
@@ -209,14 +206,7 @@ pub mod interactive {
209
206
let b = aux. combine ( & beta, & y) ?;
210
207
let t = aux. rsa_modulo . combine ( & q, & alpha, & aux. t , & r) ?;
211
208
212
- let commitment = Commitment {
213
- p,
214
- q,
215
- a,
216
- b,
217
- t,
218
- sigma,
219
- } ;
209
+ let commitment = Commitment { p, q, a, b, t } ;
220
210
let private_commitment = PrivateCommitment {
221
211
alpha,
222
212
beta,
@@ -239,18 +229,17 @@ pub mod interactive {
239
229
/// Compute proof for given data and prior protocol values
240
230
pub fn prove (
241
231
pdata : PrivateData ,
242
- comm : & Commitment ,
243
232
pcomm : & PrivateCommitment ,
244
233
challenge : & Challenge ,
245
234
) -> Result < Proof , Error > {
246
- let sigma_circ = ( & comm . sigma - & pcomm. nu * pdata. p ) . complete ( ) ;
235
+ let nu_p = ( & pcomm. nu * pdata. p ) . complete ( ) ;
247
236
248
237
Ok ( Proof {
249
238
z1 : ( & pcomm. alpha + challenge * pdata. p ) . complete ( ) ,
250
239
z2 : ( & pcomm. beta + challenge * pdata. q ) . complete ( ) ,
251
240
w1 : ( & pcomm. x + challenge * & pcomm. mu ) . complete ( ) ,
252
241
w2 : ( & pcomm. y + challenge * & pcomm. nu ) . complete ( ) ,
253
- v : & pcomm. r + challenge * sigma_circ ,
242
+ v : & pcomm. r - challenge * nu_p ,
254
243
} )
255
244
}
256
245
@@ -279,7 +268,7 @@ pub mod interactive {
279
268
}
280
269
// check 3
281
270
{
282
- let r = aux. combine ( data . n , & commitment . sigma ) ?;
271
+ let r = aux. pow_mod ( & aux . s , data . n ) ?;
283
272
let q_to_z1 = aux. pow_mod ( & commitment. q , & proof. z1 ) ?;
284
273
let t_to_v = aux. pow_mod ( & aux. t , & proof. v ) ?;
285
274
let lhs = ( q_to_z1 * t_to_v) . modulo ( & aux. rsa_modulo ) ;
@@ -328,7 +317,7 @@ pub mod non_interactive {
328
317
) -> Result < Proof , Error > {
329
318
let ( commitment, pcomm) = super :: interactive:: commit ( aux, data, pdata, security, rng) ?;
330
319
let challenge = challenge :: < D > ( shared_state, aux, data, & commitment, security) ;
331
- let proof = super :: interactive:: prove ( pdata, & commitment , & pcomm, & challenge) ?;
320
+ let proof = super :: interactive:: prove ( pdata, & pcomm, & challenge) ?;
332
321
Ok ( Proof { commitment, proof } )
333
322
}
334
323
0 commit comments