@@ -93,7 +93,7 @@ impl TriptychProof {
93
93
/// You must also supply a [`Transcript`] `transcript`.
94
94
///
95
95
/// This function specifically avoids constant-time operations for efficiency.
96
- #[ cfg( feature = "rand" ) ]
96
+ #[ cfg( all ( feature = "rand" , feature = "hazmat" ) ) ]
97
97
pub fn prove_vartime (
98
98
witness : & TriptychWitness ,
99
99
statement : & TriptychStatement ,
@@ -113,6 +113,7 @@ impl TriptychProof {
113
113
/// You must also supply a [`CryptoRngCore`] random number generator `rng` and a [`Transcript`] `transcript`.
114
114
///
115
115
/// This function specifically avoids constant-time operations for efficiency.
116
+ #[ cfg( feature = "hazmat" ) ]
116
117
pub fn prove_with_rng_vartime < R : CryptoRngCore > (
117
118
witness : & TriptychWitness ,
118
119
statement : & TriptychStatement ,
@@ -1143,7 +1144,7 @@ mod test {
1143
1144
}
1144
1145
1145
1146
#[ test]
1146
- #[ cfg( feature = "rand" ) ]
1147
+ #[ cfg( all ( feature = "rand" , feature = "hazmat" ) ) ]
1147
1148
#[ allow( non_snake_case, non_upper_case_globals) ]
1148
1149
fn test_prove_verify_vartime ( ) {
1149
1150
// Generate data
@@ -1158,6 +1159,7 @@ mod test {
1158
1159
}
1159
1160
1160
1161
#[ test]
1162
+ #[ cfg( feature = "hazmat" ) ]
1161
1163
#[ allow( non_snake_case, non_upper_case_globals) ]
1162
1164
fn test_prove_verify_vartime_with_rng ( ) {
1163
1165
// Generate data
@@ -1183,9 +1185,8 @@ mod test {
1183
1185
let ( witnesses, statements, mut transcripts) = generate_data ( n, m, 1 , & mut rng) ;
1184
1186
1185
1187
// Generate and verify a proof
1186
- let proof =
1187
- TriptychProof :: prove_with_rng_vartime ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1188
- . unwrap ( ) ;
1188
+ let proof = TriptychProof :: prove_with_rng ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1189
+ . unwrap ( ) ;
1189
1190
assert ! ( proof. verify( & statements[ 0 ] , & mut transcripts[ 0 ] ) . is_ok( ) ) ;
1190
1191
1191
1192
// Serialize the proof
@@ -1207,9 +1208,8 @@ mod test {
1207
1208
let ( witnesses, statements, mut transcripts) = generate_data ( n, m, 1 , & mut rng) ;
1208
1209
1209
1210
// Generate and verify a proof
1210
- let proof =
1211
- TriptychProof :: prove_with_rng_vartime ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1212
- . unwrap ( ) ;
1211
+ let proof = TriptychProof :: prove_with_rng ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1212
+ . unwrap ( ) ;
1213
1213
assert ! ( proof. verify( & statements[ 0 ] , & mut transcripts[ 0 ] ) . is_ok( ) ) ;
1214
1214
1215
1215
// Serialize the proof
@@ -1232,7 +1232,7 @@ mod test {
1232
1232
1233
1233
// Generate the proofs
1234
1234
let proofs = izip ! ( witnesses. iter( ) , statements. iter( ) , transcripts. clone( ) . iter_mut( ) )
1235
- . map ( |( w, s, t) | TriptychProof :: prove_with_rng_vartime ( w, s, & mut rng, t) . unwrap ( ) )
1235
+ . map ( |( w, s, t) | TriptychProof :: prove_with_rng ( w, s, & mut rng, t) . unwrap ( ) )
1236
1236
. collect :: < Vec < TriptychProof > > ( ) ;
1237
1237
1238
1238
// Verify the batch with and without blame
@@ -1261,7 +1261,7 @@ mod test {
1261
1261
1262
1262
// Generate the proofs
1263
1263
let proofs = izip ! ( witnesses. iter( ) , statements. iter( ) , transcripts. clone( ) . iter_mut( ) )
1264
- . map ( |( w, s, t) | TriptychProof :: prove_with_rng_vartime ( w, s, & mut rng, t) . unwrap ( ) )
1264
+ . map ( |( w, s, t) | TriptychProof :: prove_with_rng ( w, s, & mut rng, t) . unwrap ( ) )
1265
1265
. collect :: < Vec < TriptychProof > > ( ) ;
1266
1266
1267
1267
// Manipulate a transcript so the corresponding proof is invalid
@@ -1285,7 +1285,7 @@ mod test {
1285
1285
1286
1286
// Generate the proofs
1287
1287
let proofs = izip ! ( witnesses. iter( ) , statements. iter( ) , transcripts. clone( ) . iter_mut( ) )
1288
- . map ( |( w, s, t) | TriptychProof :: prove_with_rng_vartime ( w, s, & mut rng, t) . unwrap ( ) )
1288
+ . map ( |( w, s, t) | TriptychProof :: prove_with_rng ( w, s, & mut rng, t) . unwrap ( ) )
1289
1289
. collect :: < Vec < TriptychProof > > ( ) ;
1290
1290
1291
1291
// Iteratively manipulate each transcript to make the corresponding proof invalid
@@ -1319,7 +1319,7 @@ mod test {
1319
1319
1320
1320
// Generate the proofs
1321
1321
let proofs = izip ! ( witnesses. iter( ) , statements. iter( ) , transcripts. clone( ) . iter_mut( ) )
1322
- . map ( |( w, s, t) | TriptychProof :: prove_with_rng_vartime ( w, s, & mut rng, t) . unwrap ( ) )
1322
+ . map ( |( w, s, t) | TriptychProof :: prove_with_rng ( w, s, & mut rng, t) . unwrap ( ) )
1323
1323
. collect :: < Vec < TriptychProof > > ( ) ;
1324
1324
1325
1325
// Manipulate some of the transcripts to make the corresponding proofs invalid
@@ -1346,8 +1346,8 @@ mod test {
1346
1346
let ( witnesses, statements, mut transcripts) = generate_data ( n, m, 1 , & mut rng) ;
1347
1347
1348
1348
// Generate a proof
1349
- let proof = TriptychProof :: prove_with_rng_vartime ( & witnesses [ 0 ] , & statements [ 0 ] , & mut rng , & mut transcripts [ 0 ] )
1350
- . unwrap ( ) ;
1349
+ let proof =
1350
+ TriptychProof :: prove_with_rng ( & witnesses [ 0 ] , & statements [ 0 ] , & mut rng , & mut transcripts [ 0 ] ) . unwrap ( ) ;
1351
1351
1352
1352
// Generate a modified transcript
1353
1353
let mut evil_transcript = Transcript :: new ( b"Evil transcript" ) ;
@@ -1366,9 +1366,8 @@ mod test {
1366
1366
let ( witnesses, statements, mut transcripts) = generate_data ( n, m, 1 , & mut rng) ;
1367
1367
1368
1368
// Generate a proof
1369
- let proof =
1370
- TriptychProof :: prove_with_rng_vartime ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1371
- . unwrap ( ) ;
1369
+ let proof = TriptychProof :: prove_with_rng ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1370
+ . unwrap ( ) ;
1372
1371
1373
1372
// Generate a statement with a modified input set
1374
1373
let mut M = statements[ 0 ] . get_input_set ( ) . get_keys ( ) . to_vec ( ) ;
@@ -1398,9 +1397,8 @@ mod test {
1398
1397
let ( witnesses, statements, mut transcripts) = generate_data ( n, m, 1 , & mut rng) ;
1399
1398
1400
1399
// Generate a proof
1401
- let proof =
1402
- TriptychProof :: prove_with_rng_vartime ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1403
- . unwrap ( ) ;
1400
+ let proof = TriptychProof :: prove_with_rng ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1401
+ . unwrap ( ) ;
1404
1402
1405
1403
// Generate a statement with a modified input set
1406
1404
let M = statements[ 0 ] . get_input_set ( ) . get_keys ( ) . to_vec ( ) ;
@@ -1430,9 +1428,8 @@ mod test {
1430
1428
let ( witnesses, statements, mut transcripts) = generate_data ( n, m, 1 , & mut rng) ;
1431
1429
1432
1430
// Generate a proof
1433
- let proof =
1434
- TriptychProof :: prove_with_rng_vartime ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1435
- . unwrap ( ) ;
1431
+ let proof = TriptychProof :: prove_with_rng ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1432
+ . unwrap ( ) ;
1436
1433
1437
1434
// Generate a statement with a modified linking tag
1438
1435
let evil_statement = TriptychStatement :: new (
@@ -1457,9 +1454,8 @@ mod test {
1457
1454
let ( witnesses, statements, mut transcripts) = generate_data ( n, m, 1 , & mut rng) ;
1458
1455
1459
1456
// Generate a proof
1460
- let proof =
1461
- TriptychProof :: prove_with_rng_vartime ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1462
- . unwrap ( ) ;
1457
+ let proof = TriptychProof :: prove_with_rng ( & witnesses[ 0 ] , & statements[ 0 ] , & mut rng, & mut transcripts[ 0 ] . clone ( ) )
1458
+ . unwrap ( ) ;
1463
1459
1464
1460
// Generate a statement with a modified offset
1465
1461
let evil_statement = TriptychStatement :: new (
0 commit comments