mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Rename ECC Family Macros According to PSA Spec
Rename PSA_ECC_CURVE_xxx to PSA_ECC_FAMILY_xxx, also rename PSA_KEY_TYPE_GET_CURVE to PSA_KEY_TYPE_ECC_GET_FAMILY and rename psa_ecc_curve_t to psa_ecc_family_t. Old defines are provided in include/crypto_compat.h for backward compatibility. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
@@ -82,21 +82,21 @@ static void append_integer(char **buffer, size_t buffer_size,
|
||||
}
|
||||
|
||||
/* The code of these function is automatically generated and included below. */
|
||||
static const char *psa_ecc_curve_name(psa_ecc_curve_t curve);
|
||||
static const char *psa_ecc_family_name(psa_ecc_family_t curve);
|
||||
static const char *psa_dh_group_name(psa_dh_group_t group);
|
||||
static const char *psa_hash_algorithm_name(psa_algorithm_t hash_alg);
|
||||
|
||||
static void append_with_curve(char **buffer, size_t buffer_size,
|
||||
size_t *required_size,
|
||||
const char *string, size_t length,
|
||||
psa_ecc_curve_t curve)
|
||||
psa_ecc_family_t curve)
|
||||
{
|
||||
const char *curve_name = psa_ecc_curve_name(curve);
|
||||
const char *family_name = psa_ecc_family_name(curve);
|
||||
append(buffer, buffer_size, required_size, string, length);
|
||||
append(buffer, buffer_size, required_size, "(", 1);
|
||||
if (curve_name != NULL) {
|
||||
if (family_name != NULL) {
|
||||
append(buffer, buffer_size, required_size,
|
||||
curve_name, strlen(curve_name));
|
||||
family_name, strlen(family_name));
|
||||
} else {
|
||||
append_integer(buffer, buffer_size, required_size,
|
||||
"0x%02x", curve);
|
||||
@@ -159,9 +159,9 @@ static int psa_snprint_status(char *buffer, size_t buffer_size,
|
||||
}
|
||||
|
||||
static int psa_snprint_ecc_curve(char *buffer, size_t buffer_size,
|
||||
psa_ecc_curve_t curve)
|
||||
psa_ecc_family_t curve)
|
||||
{
|
||||
const char *name = psa_ecc_curve_name(curve);
|
||||
const char *name = psa_ecc_family_name(curve);
|
||||
if (name == NULL) {
|
||||
return snprintf(buffer, buffer_size, "0x%02x", (unsigned) curve);
|
||||
} else {
|
||||
@@ -199,7 +199,7 @@ static void usage(const char *program_name)
|
||||
printf("Print the symbolic name whose numerical value is VALUE in TYPE.\n");
|
||||
printf("Supported types (with = between aliases):\n");
|
||||
printf(" alg=algorithm Algorithm (psa_algorithm_t)\n");
|
||||
printf(" curve=ecc_curve Elliptic curve identifier (psa_ecc_curve_t)\n");
|
||||
printf(" curve=ecc_curve Elliptic curve identifier (psa_ecc_family_t)\n");
|
||||
printf(" group=dh_group Diffie-Hellman group identifier (psa_dh_group_t)\n");
|
||||
printf(" type=key_type Key type (psa_key_type_t)\n");
|
||||
printf(" usage=key_usage Key usage (psa_key_usage_t)\n");
|
||||
@@ -271,7 +271,7 @@ int process_unsigned(unsigned_value_type type, unsigned long max, char **argp)
|
||||
break;
|
||||
case TYPE_ECC_CURVE:
|
||||
psa_snprint_ecc_curve(buffer, sizeof(buffer),
|
||||
(psa_ecc_curve_t) value);
|
||||
(psa_ecc_family_t) value);
|
||||
break;
|
||||
case TYPE_DH_GROUP:
|
||||
psa_snprint_dh_group(buffer, sizeof(buffer),
|
||||
@@ -311,7 +311,7 @@ int main(int argc, char *argv[])
|
||||
return process_unsigned(TYPE_ALGORITHM, (psa_algorithm_t) (-1),
|
||||
argv + 2);
|
||||
} else if (!strcmp(argv[1], "curve") || !strcmp(argv[1], "ecc_curve")) {
|
||||
return process_unsigned(TYPE_ECC_CURVE, (psa_ecc_curve_t) (-1),
|
||||
return process_unsigned(TYPE_ECC_CURVE, (psa_ecc_family_t) (-1),
|
||||
argv + 2);
|
||||
} else if (!strcmp(argv[1], "group") || !strcmp(argv[1], "dh_group")) {
|
||||
return process_unsigned(TYPE_DH_GROUP, (psa_dh_group_t) (-1),
|
||||
|
Reference in New Issue
Block a user