CKM: Remove keys explicitly in derivation tests 48/296248/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 24 Jul 2023 08:38:42 +0000 (10:38 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 24 Jul 2023 08:55:58 +0000 (10:55 +0200)
Removing the user data is not enough in case of TZ backend. Without
explicit removal objects remain in TZ storage.

Change-Id: Id9652be186610322ea913f74ff8504f66ac8232e

src/ckm/unprivileged/key-derivation.cpp

index 99555255701d8d221d81f9a7f5434645c5a7f189..0898e7cd1070ef17da58636e90eb2594ebca18f1 100644 (file)
@@ -105,6 +105,16 @@ public:
 
     void Finish() override
     {
+        auto remove = [](const KeyAliasPair& pair) {
+            ckmc_remove_alias(pair.prv.c_str());
+            ckmc_remove_alias(pair.pub.c_str());
+        };
+        remove(OURS);
+        remove(PEERS);
+        remove(PEERS2);
+        remove(WRONG);
+        remove(RSA);
+
         int ret = ckmc_lock_user_key(UID);
         if (ret != CKMC_ERROR_NONE)
             RUNNER_ERROR_MSG("DB lock failed: " << CKMCErrorToString(ret));