blob: 9f1be4cdec71198efe598f7ef7c9c49f124b19ba [file] [log] [blame]
From 9c4d00b01062dbb2e0f124027e19562b3c2a3538 Mon Sep 17 00:00:00 2001
From: Maulik Patel <Maulik.Patel@arm.com>
Date: Fri, 7 May 2021 13:42:20 +0100
Subject: [PATCH] Update test cases for psa mac sign and verify.
Update test cases for psa_mac_sign_setup (226) and
psa_mac_verify_setup (229) against unknown MAC algorithm such that
key passed is valid but the algorithm is unknown.
Also, as per PSA Crypto Spec 1.0.0, fix the expected return value to PSA_ERROR_INVALID_ARGUMENT for incompatible key to MAC algorithm.
Change-Id: I8f42736a9e5bd7fbf604146b43ef28180e741fc3
Signed-off-by: Maulik Patel <maulik.patel@arm.com>
---
api-tests/dev_apis/crypto/test_c026/test_data.h | 15 +++++++++------
api-tests/dev_apis/crypto/test_c029/test_data.h | 15 +++++++++------
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/api-tests/dev_apis/crypto/test_c026/test_data.h b/api-tests/dev_apis/crypto/test_c026/test_data.h
index 306522a..39619f0 100644
--- a/api-tests/dev_apis/crypto/test_c026/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c026/test_data.h
@@ -67,7 +67,7 @@ static const test_data check1[] = {
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
0x0D, 0x0E, 0x0F},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN, PSA_ALG_CMAC,
- PSA_ERROR_NOT_SUPPORTED
+ PSA_ERROR_INVALID_ARGUMENT
},
#endif
@@ -116,11 +116,14 @@ static const test_data check1[] = {
#endif
#endif
-#ifdef ARCH_TEST_AES_128
-{"Test psa_mac_sign_setup bad algorithm (unknown MAC algorithm)\n", PSA_KEY_TYPE_AES,
-{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
- 0x5F, 0xC9, 0x00},
- AES_16B_KEY_SIZE, PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(0),
+#ifdef ARCH_TEST_HMAC
+{"Test psa_mac_sign_setup bad algorithm (unknown MAC algorithm)\n", PSA_KEY_TYPE_HMAC,
+{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
+ 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
+ 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
+ 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f},
+ 64, PSA_KEY_USAGE_SIGN, PSA_ALG_HMAC(0),
PSA_ERROR_NOT_SUPPORTED
},
#endif
diff --git a/api-tests/dev_apis/crypto/test_c029/test_data.h b/api-tests/dev_apis/crypto/test_c029/test_data.h
index 3b4b121..1b85212 100644
--- a/api-tests/dev_apis/crypto/test_c029/test_data.h
+++ b/api-tests/dev_apis/crypto/test_c029/test_data.h
@@ -68,7 +68,7 @@ static const test_data check1[] = {
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C,
0x0D, 0x0E, 0x0F},
AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY, PSA_ALG_CMAC,
- PSA_ERROR_NOT_SUPPORTED
+ PSA_ERROR_INVALID_ARGUMENT
},
#endif
@@ -116,11 +116,14 @@ static const test_data check1[] = {
},
#endif
-#ifdef ARCH_TEST_AES_128
-{"Test psa_mac_verify_setup bad algorithm (unknown MAC algorithm)\n", PSA_KEY_TYPE_AES,
-{0x49, 0x8E, 0xC7, 0x7D, 0x01, 0x95, 0x0D, 0x94, 0x2C, 0x16, 0xA5, 0x3E, 0x99,
- 0x5F, 0xC9, 0x00},
- AES_16B_KEY_SIZE, PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(0),
+#ifdef ARCH_TEST_HMAC
+{"Test psa_mac_verify_setup bad algorithm (unknown MAC algorithm)\n", PSA_KEY_TYPE_HMAC,
+{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
+ 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
+ 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
+ 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33,
+ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f},
+ 64, PSA_KEY_USAGE_VERIFY, PSA_ALG_HMAC(0),
PSA_ERROR_NOT_SUPPORTED
},
#endif
--
2.17.1