Test: Disable single-part operation tests in Profile Small

Enable support multi-part operation tests in Profile Small to align
with TF-M changes.

Signed-off-by: David Hu <david.hu@arm.com>
Change-Id: If8aa59238f4ec37ccef8c414760c863272e5df1e
diff --git a/test/config/default_test_config.cmake b/test/config/default_test_config.cmake
index 0ddef9c..599d9ab 100644
--- a/test/config/default_test_config.cmake
+++ b/test/config/default_test_config.cmake
@@ -64,6 +64,7 @@
 set(TFM_CRYPTO_TEST_ECDH                    ON          CACHE BOOL      "Test the ECDH key agreement algorithm")
 set(TFM_CRYPTO_TEST_CHACHA20                OFF         CACHE BOOL      "Test the ChaCha20 stream cipher")
 set(TFM_CRYPTO_TEST_ALG_CHACHA20_POLY1305   OFF         CACHE BOOL      "Test ChaCha20-Poly1305 AEAD algorithm")
+set(TFM_CRYPTO_TEST_SINGLE_PART_FUNCS       ON          CACHE BOOL      "Test single-part operations in hash, MAC, AEAD and symmetric ciphers")
 
 ################################## FWU Tests ###################################
 
diff --git a/test/config/profile/profile_small_test.cmake b/test/config/profile/profile_small_test.cmake
index 177b1d1..fcc122d 100644
--- a/test/config/profile/profile_small_test.cmake
+++ b/test/config/profile/profile_small_test.cmake
@@ -19,3 +19,4 @@
 set(TFM_CRYPTO_TEST_ECDH                    OFF         CACHE BOOL      "Test the ECDH key agreement algorithm")
 set(TFM_CRYPTO_TEST_CHACHA20                OFF         CACHE BOOL      "Test the ChaCha20 stream cipher")
 set(TFM_CRYPTO_TEST_ALG_CHACHA20_POLY1305   OFF         CACHE BOOL      "Test ChaCha20-Poly1305 AEAD algorithm")
+set(TFM_CRYPTO_TEST_SINGLE_PART_FUNCS       OFF         CACHE BOOL      "Test single-part operations in hash, MAC, AEAD and symmetric ciphers")
diff --git a/test/secure_fw/suites/crypto/CMakeLists.txt b/test/secure_fw/suites/crypto/CMakeLists.txt
index aa58923..20e84d9 100644
--- a/test/secure_fw/suites/crypto/CMakeLists.txt
+++ b/test/secure_fw/suites/crypto/CMakeLists.txt
@@ -54,6 +54,7 @@
             $<$<NOT:$<BOOL:${CRYPTO_ASYM_ENCRYPT_MODULE_DISABLED}>>:TFM_CRYPTO_TEST_ASYM_ENCRYPT>
             $<$<BOOL:${TFM_CRYPTO_TEST_CHACHA20}>:TFM_CRYPTO_TEST_CHACHA20>
             $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CHACHA20_POLY1305}>:TFM_CRYPTO_TEST_ALG_CHACHA20_POLY1305>
+            $<$<BOOL:${TFM_CRYPTO_TEST_SINGLE_PART_FUNCS}>:TFM_CRYPTO_TEST_SINGLE_PART_FUNCS>
         INTERFACE
             TEST_NS_CRYPTO
     )
diff --git a/test/secure_fw/suites/crypto/crypto_tests_common.c b/test/secure_fw/suites/crypto/crypto_tests_common.c
index 7c8c5ca..c31e0e5 100644
--- a/test/secure_fw/suites/crypto/crypto_tests_common.c
+++ b/test/secure_fw/suites/crypto/crypto_tests_common.c
@@ -1000,6 +1000,7 @@
 
     psa_reset_key_attributes(&key_attributes);
 
+#ifdef TFM_CRYPTO_TEST_SINGLE_PART_FUNCS
     /* Encrypt single part functions */
     status = psa_cipher_encrypt(key_id_local, alg, plain_text,
                                 sizeof(plain_text),
@@ -1050,6 +1051,7 @@
     /* Clear intermediate buffers for additional single-shot API tests */
     memset(input.encrypted_data_pad, 0, sizeof(input.encrypted_data_pad));
     memset(decrypted_data, 0, sizeof(decrypted_data));
+#endif /* TFM_CRYPTO_TEST_SINGLE_PART_FUNCS */
 
     /* Replicate the same test as above, but now using the multipart APIs */
 
@@ -1125,6 +1127,7 @@
     /* Add the last output produced, it might be encrypted padding */
     total_output_length += output_length;
 
+#ifdef TFM_CRYPTO_TEST_SINGLE_PART_FUNCS
     /* Compare encrypted data produced with single-shot and multipart APIs */
     comp_result = memcmp(encrypted_data_single_shot,
                          input.encrypted_data,
@@ -1133,6 +1136,7 @@
         TEST_FAIL("Single-shot crypt doesn't match with multipart crypt");
         goto destroy_key;
     }
+#endif /* TFM_CRYPTO_TEST_SINGLE_PART_FUNCS */
 
     /* Setup the decryption object */
     status = psa_cipher_decrypt_setup(&handle_dec, key_id_local, alg);
@@ -1377,6 +1381,7 @@
         return;
     }
 
+#ifdef TFM_CRYPTO_TEST_SINGLE_PART_FUNCS
     /* Do the same as above with the single shot APIs */
     status = psa_hash_compare(alg,
                               (const uint8_t *)msg, strlen(msg),
@@ -1385,6 +1390,7 @@
         TEST_FAIL("Error using the single shot API");
         return;
     }
+#endif
 
     ret->val = TEST_PASSED;
 }
@@ -1550,6 +1556,7 @@
         goto destroy_key_mac;
     }
 
+#ifdef TFM_CRYPTO_TEST_SINGLE_PART_FUNCS
     /* Do the same as above with the single shot APIs */
     status = psa_mac_verify(key_id_local, alg,
                             (const uint8_t *)msg, strlen(msg),
@@ -1558,6 +1565,7 @@
     if (status != PSA_SUCCESS) {
         TEST_FAIL("Error using the single shot API");
     }
+#endif
 
 destroy_key_mac:
     /* Destroy the key */
@@ -1634,6 +1642,7 @@
 
     psa_reset_key_attributes(&retrieved_attributes);
 
+#ifdef TFM_CRYPTO_TEST_SINGLE_PART_FUNCS
     /* Perform AEAD encryption */
     status = psa_aead_encrypt(key_id_local, alg, nonce, nonce_length,
                               associated_data,
@@ -1700,6 +1709,7 @@
         TEST_FAIL("Decrypted data doesn't match with plain text");
         goto destroy_key_aead;
     }
+#endif /* TFM_CRYPTO_TEST_SINGLE_PART_FUNCS */
 
     /* Setup the encryption object */
     status = psa_aead_encrypt_setup(&encop, key_id_local, alg);
@@ -1821,6 +1831,7 @@
     }
     total_encrypted_length += encrypted_data_length;
 
+#ifdef TFM_CRYPTO_TEST_SINGLE_PART_FUNCS
     /* Compare tag between single part and multipart case */
     comp_result = memcmp(
                       &encrypted_data_single_shot[total_encrypted_length],
@@ -1838,6 +1849,7 @@
         TEST_FAIL("Single shot encrypted data does not match with multipart");
         goto destroy_key_aead;
     }
+#endif /* TFM_CRYPTO_TEST_SINGLE_PART_FUNCS */
 
     /* Setup up the decryption object */
     status = psa_aead_decrypt_setup(&decop, key_id_local, alg);