CK_RV rsa_funcs() { int i; CK_RV rv = CKR_OK; // published (known answer) tests for (i = 0; i < NUM_OF_PUBLISHED_TESTSUITES; i++) { rv = do_SignRSA(&published_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; rv = do_VerifyRSA(&published_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } // generated sign verify tests for (i = 0; i < NUM_OF_GENERATED_SIGVER_TESTSUITES; i++) { rv = do_SignVerifyRSA(&generated_sigver_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } for (i = 0; i < NUM_OF_GENERATED_PSS_TESTSUITES; i++) { rv = do_SignVerify_RSAPSS(&generated_pss_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } // generated crypto tests for (i = 0; i < NUM_OF_GENERATED_CRYPTO_TESTSUITES; i++) { rv = do_EncryptDecryptRSA(&generated_crypto_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } for (i = 0; i < NUM_OF_GENERATED_OAEP_TESTSUITES; i++) { rv = do_EncryptDecryptRSA(&generated_oaep_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } for ( i = 0; i < NUM_OF_GENERATED_OAEP_TESTSUITES; i++) { rv = do_WrapUnwrapRSA(&generated_oaep_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } // generated keywrap tests for ( i = 0; i < NUM_OF_GENERATED_KEYWRAP_TESTSUITES; i++) { rv = do_WrapUnwrapRSA(&generated_keywrap_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } return rv; }
CK_RV rsa_funcs() { int i, generate_key; CK_RV rv = CKR_OK; generate_key = get_key_type(); // true if slot requires generated // (secure) keys if (generate_key == -1){ testcase_error("Could not get token info."); return -1; } // published (known answer) tests for (i = 0; i < NUM_OF_PUBLISHED_TESTSUITES; i++) { if (!generate_key) { rv = do_SignRSA(&published_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; rv = do_VerifyRSA(&published_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } } // generated sign verify tests for (i = 0; i < NUM_OF_GENERATED_SIGVER_TESTSUITES; i++) { rv = do_SignVerifyRSA(&generated_sigver_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } // generated crypto tests for (i = 0; i < NUM_OF_GENERATED_CRYPTO_TESTSUITES; i++) { rv = do_EncryptDecryptRSA(&generated_crypto_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } // generated keywrap tests for ( i = 0; i < NUM_OF_GENERATED_KEYWRAP_TESTSUITES; i++) { rv = do_WrapUnwrapRSA(&generated_keywrap_test_suites[i]); if (rv != CKR_OK && (!no_stop)) break; } return rv; }