CKM: Update ECDH TCs for TZ Backend 14/296714/3
authorDongsun Lee <ds73.lee@samsung.com>
Thu, 3 Aug 2023 09:15:06 +0000 (18:15 +0900)
committerDongsun Lee <ds73.lee@samsung.com>
Wed, 9 Aug 2023 07:44:51 +0000 (16:44 +0900)
Change-Id: I2249411fcc60c858d9cbaacb676de93da59590da

src/ckm/unprivileged/key-derivation.cpp

index 9bdf4eb739ddf5ec58803e930f1efc2cdac51cd5..84c6ece752bfb61a2cb0fb0c38f3e750a49021ac 100644 (file)
@@ -39,6 +39,7 @@ const KeyAliasPair PEERS = { "peer_ec_private", "peer_ec_public" };
 const KeyAliasPair PEERS2 = { "peer2_ec_private", "peer2_ec_public" };
 const KeyAliasPair WRONG = { "wrong_ec_private", "wrong_ec_public" };
 const KeyAliasPair RSA = { "rsa_private", "rsa_public" };
+const KeyAliasPair RSA_EXPORTABLE = { "rsa_private_exp", "rsa_public_exp" };
 const std::string DERIVED = "derived";
 const std::string DERIVED2 = "derived2";
 const std::string SECRET = "secret";
@@ -102,6 +103,13 @@ public:
                         RSA.pub.c_str(),
                         UNEXPORTABLE,
                         EXPORTABLE);
+
+        assert_positive(ckmc_create_key_pair_rsa,
+                        1024,
+                        RSA_EXPORTABLE.prv.c_str(),
+                        RSA_EXPORTABLE.pub.c_str(),
+                        EXPORTABLE,
+                        EXPORTABLE);
     }
 
     void Finish() override
@@ -115,6 +123,7 @@ public:
         remove(PEERS2);
         remove(WRONG);
         remove(RSA);
+        remove(RSA_EXPORTABLE);
 
         int ret = ckmc_lock_user_key(UID);
         if (ret != CKMC_ERROR_NONE)
@@ -486,7 +495,7 @@ RUNNER_TEST(TECDH_0210_different_curves, DerivedFixture)
 
 RUNNER_TEST(TECDH_0220_different_key_types, DerivedFixture)
 {
-    deriveEcdh(OURS.prv, "", RSA.pub, DERIVED, UNEXPORTABLE, CKMC_ERROR_INVALID_PARAMETER);
+    deriveEcdh(OURS.prv, "", RSA_EXPORTABLE.pub, DERIVED, UNEXPORTABLE, CKMC_ERROR_INVALID_PARAMETER);
     deriveEcdh(RSA.prv, "", OURS.pub, DERIVED, UNEXPORTABLE, CKMC_ERROR_INVALID_PARAMETER);
 }
 
@@ -497,7 +506,7 @@ RUNNER_TEST(TECDH_0230_public_instead_of_private, DerivedFixture)
 
 RUNNER_TEST(TECDH_0230_wrong_key_types, DerivedFixture)
 {
-    deriveEcdh(RSA.prv, "", RSA.pub, DERIVED, UNEXPORTABLE, CKMC_ERROR_INVALID_PARAMETER);
+    deriveEcdh(RSA.prv, "", RSA_EXPORTABLE.pub, DERIVED, UNEXPORTABLE, CKMC_ERROR_INVALID_PARAMETER);
 }