Merge pull request #1039 from Mbed-TLS/mbedtls-2.28

Merge mbedtls-2.28 into mbedtls-2.28-restricted
This commit is contained in:
Gilles Peskine 2023-07-21 15:39:20 +02:00 committed by GitHub
commit 27d8c21a87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,12 +61,11 @@ inline static int mbedtls_ecp_group_cmp(mbedtls_ecp_group *grp1,
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 @@ void mbedtls_ecp_group_metadata(int id, int bit_size, int crv_type,
// 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