mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 06:04:18 +01:00
Code readability improvements
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
a1d8322f74
commit
947bb0b06f
@ -154,33 +154,24 @@ static int psa_snprint_algorithm(char *buffer, size_t buffer_size,
|
|||||||
append(&buffer, buffer_size, &required_size,
|
append(&buffer, buffer_size, &required_size,
|
||||||
"PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(", 33);
|
"PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(", 33);
|
||||||
length_modifier = PSA_MAC_TRUNCATED_LENGTH(alg);
|
length_modifier = PSA_MAC_TRUNCATED_LENGTH(alg);
|
||||||
} else {
|
} else if (core_alg != alg) {
|
||||||
if (core_alg != alg) {
|
append(&buffer, buffer_size, &required_size,
|
||||||
append(&buffer, buffer_size, &required_size,
|
"PSA_ALG_TRUNCATED_MAC(", 22);
|
||||||
"PSA_ALG_TRUNCATED_MAC(", 22);
|
length_modifier = PSA_MAC_TRUNCATED_LENGTH(alg);
|
||||||
length_modifier = PSA_MAC_TRUNCATED_LENGTH(alg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (PSA_ALG_IS_AEAD(alg)) {
|
} else if (PSA_ALG_IS_AEAD(alg)) {
|
||||||
core_alg = PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg);
|
core_alg = PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg);
|
||||||
if (alg & PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG) {
|
if (core_alg == 0) {
|
||||||
if (core_alg == 0) {
|
/* For unknown AEAD algorithms, there is no "default tag length". */
|
||||||
/* For unknown AEAD algorithms, there is no "default tag length". */
|
core_alg = alg;
|
||||||
core_alg = alg;
|
} else if (alg & PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG) {
|
||||||
} else {
|
append(&buffer, buffer_size, &required_size,
|
||||||
append(&buffer, buffer_size, &required_size,
|
"PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(", 43);
|
||||||
"PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(", 43);
|
length_modifier = PSA_AEAD_TAG_LENGTH(alg);
|
||||||
length_modifier = PSA_AEAD_TAG_LENGTH(alg);
|
} else if (core_alg != alg) {
|
||||||
}
|
append(&buffer, buffer_size, &required_size,
|
||||||
} else {
|
"PSA_ALG_AEAD_WITH_SHORTENED_TAG(", 32);
|
||||||
if (core_alg == 0) {
|
length_modifier = PSA_AEAD_TAG_LENGTH(alg);
|
||||||
/* For unknown AEAD algorithms, there is no "default tag length". */
|
|
||||||
core_alg = alg;
|
|
||||||
} else if (core_alg != alg) {
|
|
||||||
append(&buffer, buffer_size, &required_size,
|
|
||||||
"PSA_ALG_AEAD_WITH_SHORTENED_TAG(", 32);
|
|
||||||
length_modifier = PSA_AEAD_TAG_LENGTH(alg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (PSA_ALG_IS_KEY_AGREEMENT(alg) &&
|
} else if (PSA_ALG_IS_KEY_AGREEMENT(alg) &&
|
||||||
!PSA_ALG_IS_RAW_KEY_AGREEMENT(alg)) {
|
!PSA_ALG_IS_RAW_KEY_AGREEMENT(alg)) {
|
||||||
|
@ -104,33 +104,24 @@ static int psa_snprint_algorithm(char *buffer, size_t buffer_size,
|
|||||||
append(&buffer, buffer_size, &required_size,
|
append(&buffer, buffer_size, &required_size,
|
||||||
"PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(", 33);
|
"PSA_ALG_AT_LEAST_THIS_LENGTH_MAC(", 33);
|
||||||
length_modifier = PSA_MAC_TRUNCATED_LENGTH(alg);
|
length_modifier = PSA_MAC_TRUNCATED_LENGTH(alg);
|
||||||
} else {
|
} else if (core_alg != alg) {
|
||||||
if (core_alg != alg) {
|
append(&buffer, buffer_size, &required_size,
|
||||||
append(&buffer, buffer_size, &required_size,
|
"PSA_ALG_TRUNCATED_MAC(", 22);
|
||||||
"PSA_ALG_TRUNCATED_MAC(", 22);
|
length_modifier = PSA_MAC_TRUNCATED_LENGTH(alg);
|
||||||
length_modifier = PSA_MAC_TRUNCATED_LENGTH(alg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (PSA_ALG_IS_AEAD(alg)) {
|
} else if (PSA_ALG_IS_AEAD(alg)) {
|
||||||
core_alg = PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg);
|
core_alg = PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg);
|
||||||
if (alg & PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG) {
|
if (core_alg == 0) {
|
||||||
if (core_alg == 0) {
|
/* For unknown AEAD algorithms, there is no "default tag length". */
|
||||||
/* For unknown AEAD algorithms, there is no "default tag length". */
|
core_alg = alg;
|
||||||
core_alg = alg;
|
} else if (alg & PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG) {
|
||||||
} else {
|
append(&buffer, buffer_size, &required_size,
|
||||||
append(&buffer, buffer_size, &required_size,
|
"PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(", 43);
|
||||||
"PSA_ALG_AEAD_WITH_AT_LEAST_THIS_LENGTH_TAG(", 43);
|
length_modifier = PSA_AEAD_TAG_LENGTH(alg);
|
||||||
length_modifier = PSA_AEAD_TAG_LENGTH(alg);
|
} else if (core_alg != alg) {
|
||||||
}
|
append(&buffer, buffer_size, &required_size,
|
||||||
} else {
|
"PSA_ALG_AEAD_WITH_SHORTENED_TAG(", 32);
|
||||||
if (core_alg == 0) {
|
length_modifier = PSA_AEAD_TAG_LENGTH(alg);
|
||||||
/* For unknown AEAD algorithms, there is no "default tag length". */
|
|
||||||
core_alg = alg;
|
|
||||||
} else if (core_alg != alg) {
|
|
||||||
append(&buffer, buffer_size, &required_size,
|
|
||||||
"PSA_ALG_AEAD_WITH_SHORTENED_TAG(", 32);
|
|
||||||
length_modifier = PSA_AEAD_TAG_LENGTH(alg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (PSA_ALG_IS_KEY_AGREEMENT(alg) &&
|
} else if (PSA_ALG_IS_KEY_AGREEMENT(alg) &&
|
||||||
!PSA_ALG_IS_RAW_KEY_AGREEMENT(alg)) {
|
!PSA_ALG_IS_RAW_KEY_AGREEMENT(alg)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user