tests/test_suite_ecp: Fix ECP group compare test
ECP group compare function should not check the value of T. We only need
to assert the value of T after the ECP group copy function is called.
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
diff --git a/tests/suites/test_suite_ecp.function b/tests/suites/test_suite_ecp.function
index 6110a78..53c3f87 100644
--- a/tests/suites/test_suite_ecp.function
+++ b/tests/suites/test_suite_ecp.function
@@ -61,12 +61,11 @@
if (grp1->t_data != grp2->t_data) {
return 1;
}
- if (grp1->T_size != grp2->T_size) {
- return 1;
- }
- if (grp1->T != grp2->T) {
- return 1;
- }
+ /* Here we should not compare T and T_size as the value of T is
+ * always NULL for Montgomery curves and for Weierstrass curves
+ * it will be NULL until ecp_mul is called. After calling ecp_mul,
+ * the value will be unique (dynamically allocated).
+ */
return 0;
}
@@ -1207,6 +1206,8 @@
// Copy group and compare with original
TEST_EQUAL(mbedtls_ecp_group_copy(&grp_cpy, &grp), 0);
+ TEST_ASSERT(grp_cpy.T == NULL);
+ TEST_ASSERT(grp_cpy.T_size == 0);
TEST_EQUAL(mbedtls_ecp_group_cmp(&grp, &grp_cpy), 0);
// Check curve is in curve list and group ID list