*/
#include <encryption-decryption-env.h>
+#include <ckm-common.h>
using namespace CKM;
size_t left,
CKM::RawBuffer& output)
{
+#ifdef TZ_BACKEND
+ ckmc_backend_info_h info;
+ size_t maxSize;
+ // All unexportable keys go to TZ if enabled (and all of them are unexportable)
+ assert_positive(ckmc_get_backend_info, CKMC_BACKEND_TZ, &info);
+ assert_positive(ckmc_backend_get_max_chunk_size, info, &maxSize);
+ const size_t CHUNK_SIZE = 80 < maxSize ? 80 : maxSize;
+#else
const size_t CHUNK_SIZE = 80;
+#endif
ckmc_raw_buffer_s* out = nullptr;
ckmc_raw_buffer_s* in = nullptr;
size_t size = CHUNK_SIZE;
PLAIN_DATA = create_raw_buffer(createRandomBufferCAPI(BUF_LEN));
#ifdef TZ_BACKEND
- BIG_DATA = create_raw_buffer(createRandomBufferCAPI(1000));
+ ckmc_backend_info_h info;
+ size_t size;
+ assert_positive(ckmc_get_backend_info, CKMC_BACKEND_TZ, &info);
+ assert_positive(ckmc_backend_get_max_chunk_size, info, &size);
+ BIG_DATA = create_raw_buffer(createRandomBufferCAPI(size));
#else
BIG_DATA = create_raw_buffer(createRandomBufferCAPI(500000));
#endif
RUNNER_TEST(T1020_save_big_data)
{
#ifdef TZ_BACKEND
- const size_t BIG_SIZE = 100000;
+ ckmc_backend_info_h info;
+ size_t size;
+ // all data goes to TZ when enabled
+ assert_positive(ckmc_get_backend_info, CKMC_BACKEND_TZ, &info);
+ assert_positive(ckmc_backend_get_max_chunk_size, info, &size);
+ const size_t BIG_SIZE = size;
+
CKM::PolicyBackend backend = CKM::PolicyBackend::FORCE_HARDWARE;
#else
const size_t BIG_SIZE = 5000000;
remove_user_data(USER_APP);
}
+RUNNER_TEST(T1027_backend_info)
+{
+ //int ckmc_get_backend_info(ckmc_backend_id_e backend, ckmc_backend_info_h* ppinfo)
+ ckmc_backend_info_h info;
+ size_t size;
+ assert_invalid_param(ckmc_get_backend_info, static_cast<ckmc_backend_id_e>(-1), &info);
+ assert_invalid_param(ckmc_get_backend_info, static_cast<ckmc_backend_id_e>(2), &info);
+ assert_invalid_param(ckmc_get_backend_info, CKMC_BACKEND_SW, nullptr);
+
+#ifdef TZ_BACKEND
+ assert_positive(ckmc_get_backend_info, CKMC_BACKEND_TZ, &info);
+ RUNNER_ASSERT_MSG(info != nullptr, "Backend info is null");
+
+ assert_positive(ckmc_backend_get_max_chunk_size, info, &size);
+ RUNNER_ASSERT_MSG(size != 0, "Unexpected max chunk size");
+#else
+ assert_invalid_param(ckmc_get_backend_info, CKMC_BACKEND_TZ, &info);
+#endif
+
+ assert_positive(ckmc_get_backend_info, CKMC_BACKEND_SW, &info);
+ RUNNER_ASSERT_MSG(info != nullptr, "Backend info is null");
+
+ assert_positive(ckmc_backend_get_max_chunk_size, info, &size);
+ RUNNER_ASSERT_MSG(size == 0, "Unexpected max chunk size");
+}
+
+
RUNNER_TEST(T1029_deinit)
{
remove_user_data(USER_APP);