CKM: Expect fail when wrapping/unwrapping RSA keys 62/296262/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 24 Jul 2023 11:29:46 +0000 (13:29 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 24 Jul 2023 11:33:46 +0000 (13:33 +0200)
Change-Id: Id0d235961ba57ebf6ec849f209253d104edcb493

src/ckm/unprivileged/key-wrapping.cpp

index e6f7649a1b1c989652e109246757b6788bd69959..1b7696b6d59d07d7a0b989cceee5c32f064c4bef 100644 (file)
@@ -1305,8 +1305,6 @@ RUNNER_TEST(TKW_IMPORT_EXPORT_RSA_LABEL){
 RUNNER_TEST(TKW_RSA_WRAPPED_KEY){
        ckmc_raw_buffer_s *encrypted = nullptr;
        ckmc_raw_buffer_s *rsaKeyData = nullptr;
-       ckmc_raw_buffer_s *decrypted = nullptr;
-       ckmc_raw_buffer_s *finalData = nullptr;
 
        ckmc_key_s *ppKey = nullptr;
        ckmc_key_s *rsaKey = nullptr;
@@ -1332,7 +1330,7 @@ RUNNER_TEST(TKW_RSA_WRAPPED_KEY){
                                nullptr,
                                &wrappedRsaKey);
 
-       assert_positive(ckmc_import_wrapped_key,
+       assert_invalid_param(ckmc_import_wrapped_key,
                                params.get(),
                                AES_KEY_256_ALIAS.c_str(),
                                nullptr,
@@ -1340,31 +1338,15 @@ RUNNER_TEST(TKW_RSA_WRAPPED_KEY){
                                wrappedRsaKey,
                                EXPORTABLE);
 
-       assert_positive(ckmc_export_wrapped_key,
+       assert_invalid_param(ckmc_export_wrapped_key,
                                params.get(),
                                AES_KEY_256_ALIAS.c_str(),
                                nullptr,
-                               IMPORTED_ALIAS.c_str(),
+                               "RPV",
                                nullptr,
                                &ppKey);
 
-       assert_positive(ckmc_buffer_new,
-                               ppKey->raw_key,
-                               ppKey->key_size,
-                               &finalData);
-
-       assert_positive(ckmc_decrypt_data,
-                               params.get(),
-                               AES_KEY_256_ALIAS.c_str(),
-                               nullptr,
-                               *finalData,
-                               &decrypted);
-
-       assert_buffers_equal(rsaKeyData, decrypted);
-
        ckmc_buffer_free(rsaKeyData);
-       ckmc_buffer_free(finalData);
-       ckmc_buffer_free(decrypted);
        ckmc_buffer_free(encrypted);
        ckmc_key_free(wrappedRsaKey);
        ckmc_key_free(rsaKey);