@@ -354,7 +354,7 @@ int rsa_test(void)
354354{
355355 unsigned char in [1024 ], out [1024 ], tmp [3072 ];
356356 rsa_key key , privKey , pubKey ;
357- int hash_idx , prng_idx , stat , stat2 , i , err ;
357+ int hash_idx , prng_idx , stat , stat2 , i ;
358358 unsigned long rsa_msgsize , len , len2 , len3 , cnt , cnt2 ;
359359 static unsigned char lparam [] = { 0x01 , 0x02 , 0x03 , 0x04 };
360360 void * dP ;
@@ -421,8 +421,7 @@ print_hex("q", tmp, len);
421421 DO (rsa_encrypt_key (in , rsa_msgsize , out , & len , NULL , 0 , & yarrow_prng , prng_idx , hash_idx , & key ));
422422 /* change a byte */
423423 out [8 ] ^= 1 ;
424- DOX ((err = rsa_decrypt_key (out , len , tmp , & len2 , NULL , 0 , hash_idx , & stat2 , & key ))
425- == CRYPT_INVALID_PACKET ? CRYPT_OK :err , "should fail" );
424+ SHOULD_FAIL (rsa_decrypt_key (out , len , tmp , & len2 , NULL , 0 , hash_idx , & stat2 , & key ));
426425 /* change a byte back */
427426 out [8 ] ^= 1 ;
428427 if (len2 != rsa_msgsize ) {
@@ -453,8 +452,7 @@ print_hex("q", tmp, len);
453452 DO (rsa_encrypt_key (in , rsa_msgsize , out , & len , lparam , sizeof (lparam ), & yarrow_prng , prng_idx , hash_idx , & key ));
454453 /* change a byte */
455454 out [8 ] ^= 1 ;
456- DOX ((err = rsa_decrypt_key (out , len , tmp , & len2 , lparam , sizeof (lparam ), hash_idx , & stat2 , & key ))
457- == CRYPT_INVALID_PACKET ? CRYPT_OK :err , "should fail" );
455+ SHOULD_FAIL (rsa_decrypt_key (out , len , tmp , & len2 , lparam , sizeof (lparam ), hash_idx , & stat2 , & key ));
458456 if (len2 != rsa_msgsize ) {
459457 fprintf (stderr , "\n%i:rsa_decrypt_key mismatch len %lu (first decrypt)" , __LINE__ , len2 );
460458 return 1 ;
@@ -671,8 +669,7 @@ print_hex("q", tmp, len);
671669
672670 len3 = sizeof (tmp );
673671 /* (6) */
674- DOX (rsa_verify_hash_ex (p2 , len2 , p , 20 , LTC_PKCS_1_V1_5 , hash_idx , -1 , & stat , & pubKey )
675- == CRYPT_INVALID_PACKET ? CRYPT_OK :CRYPT_INVALID_PACKET , "should fail" );
672+ SHOULD_FAIL (rsa_verify_hash_ex (p2 , len2 , p , 20 , LTC_PKCS_1_V1_5 , hash_idx , -1 , & stat , & pubKey ));
676673 DOX (stat == 0 ?CRYPT_OK :CRYPT_FAIL_TESTVECTOR , "should fail" );
677674 }
678675 rsa_free (& key );
0 commit comments