@@ -283,36 +283,40 @@ fn sign_verify_multipart_not_initialized() -> TestResult {
283
283
let result = session. sign_update ( & data) ;
284
284
285
285
assert ! ( result. is_err( ) ) ;
286
+ // The exact error returned is inconsistent between backends, so we only match on the function
286
287
assert ! ( matches!(
287
288
result. unwrap_err( ) ,
288
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: SignUpdate )
289
+ Error :: Pkcs11 ( _ , Function :: SignUpdate )
289
290
) ) ;
290
291
291
292
// Attempt to finalize signing without an operation having been initialized
292
293
let result = session. sign_final ( ) ;
293
294
294
295
assert ! ( result. is_err( ) ) ;
296
+ // The exact error returned is inconsistent between backends, so we only match on the function
295
297
assert ! ( matches!(
296
298
result. unwrap_err( ) ,
297
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: SignFinal )
299
+ Error :: Pkcs11 ( _ , Function :: SignFinal )
298
300
) ) ;
299
301
300
302
// Attempt to update verification without an operation having been initialized
301
303
let result = session. verify_update ( & data) ;
302
304
303
305
assert ! ( result. is_err( ) ) ;
306
+ // The exact error returned is inconsistent between backends, so we only match on the function
304
307
assert ! ( matches!(
305
308
result. unwrap_err( ) ,
306
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: VerifyUpdate )
309
+ Error :: Pkcs11 ( _ , Function :: VerifyUpdate )
307
310
) ) ;
308
311
309
312
// Attempt to finalize verification without an operation having been initialized
310
313
let result = session. verify_final ( & signature) ;
311
314
312
315
assert ! ( result. is_err( ) ) ;
316
+ // The exact error returned is inconsistent between backends, so we only match on the function
313
317
assert ! ( matches!(
314
318
result. unwrap_err( ) ,
315
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: VerifyFinal )
319
+ Error :: Pkcs11 ( _ , Function :: VerifyFinal )
316
320
) ) ;
317
321
318
322
Ok ( ( ) )
@@ -499,36 +503,40 @@ fn encrypt_decrypt_multipart_not_initialized() -> TestResult {
499
503
let result = session. encrypt_update ( & data) ;
500
504
501
505
assert ! ( result. is_err( ) ) ;
506
+ // The exact error returned is inconsistent between backends, so we only match on the function
502
507
assert ! ( matches!(
503
508
result. unwrap_err( ) ,
504
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: EncryptUpdate )
509
+ Error :: Pkcs11 ( _ , Function :: EncryptUpdate )
505
510
) ) ;
506
511
507
512
// Attempt to finalize encryption without an operation having been initialized
508
513
let result = session. encrypt_final ( ) ;
509
514
510
515
assert ! ( result. is_err( ) ) ;
516
+ // The exact error returned is inconsistent between backends, so we only match on the function
511
517
assert ! ( matches!(
512
518
result. unwrap_err( ) ,
513
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: EncryptFinal )
519
+ Error :: Pkcs11 ( _ , Function :: EncryptFinal )
514
520
) ) ;
515
521
516
522
// Attempt to update decryption without an operation having been initialized
517
523
let result = session. decrypt_update ( & data) ;
518
524
519
525
assert ! ( result. is_err( ) ) ;
526
+ // The exact error returned is inconsistent between backends, so we only match on the function
520
527
assert ! ( matches!(
521
528
result. unwrap_err( ) ,
522
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: DecryptUpdate )
529
+ Error :: Pkcs11 ( _ , Function :: DecryptUpdate )
523
530
) ) ;
524
531
525
532
// Attempt to finalize decryption without an operation having been initialized
526
533
let result = session. decrypt_final ( ) ;
527
534
528
535
assert ! ( result. is_err( ) ) ;
536
+ // The exact error returned is inconsistent between backends, so we only match on the function
529
537
assert ! ( matches!(
530
538
result. unwrap_err( ) ,
531
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: DecryptFinal )
539
+ Error :: Pkcs11 ( _ , Function :: DecryptFinal )
532
540
) ) ;
533
541
534
542
Ok ( ( ) )
@@ -1718,18 +1726,20 @@ fn sha256_digest_multipart_not_initialized() -> TestResult {
1718
1726
let result = session. digest_update ( & data) ;
1719
1727
1720
1728
assert ! ( result. is_err( ) ) ;
1729
+ // The exact error returned is inconsistent between backends, so we only match on the function
1721
1730
assert ! ( matches!(
1722
1731
result. unwrap_err( ) ,
1723
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: DigestUpdate )
1732
+ Error :: Pkcs11 ( _ , Function :: DigestUpdate )
1724
1733
) ) ;
1725
1734
1726
1735
// Attempt to finalize digest without an operation having been initialized
1727
1736
let result = session. digest_final ( ) ;
1728
1737
1729
1738
assert ! ( result. is_err( ) ) ;
1739
+ // The exact error returned is inconsistent between backends, so we only match on the function
1730
1740
assert ! ( matches!(
1731
1741
result. unwrap_err( ) ,
1732
- Error :: Pkcs11 ( RvError :: OperationNotInitialized , Function :: DigestFinal )
1742
+ Error :: Pkcs11 ( _ , Function :: DigestFinal )
1733
1743
) ) ;
1734
1744
1735
1745
Ok ( ( ) )
0 commit comments