mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-06 03:40:04 +00:00
benchmark: improve code readability
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
This commit is contained in:
parent
022b9a1ca0
commit
5cae6e8ddd
@ -679,6 +679,7 @@ int main(int argc, char *argv[])
|
||||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||
if (todo.des3) {
|
||||
mbedtls_des3_context des3;
|
||||
|
||||
mbedtls_des3_init(&des3);
|
||||
if (mbedtls_des3_set3key_enc(&des3, tmp) != 0) {
|
||||
mbedtls_exit(1);
|
||||
@ -690,6 +691,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (todo.des) {
|
||||
mbedtls_des_context des;
|
||||
|
||||
mbedtls_des_init(&des);
|
||||
if (mbedtls_des_setkey_enc(&des, tmp) != 0) {
|
||||
mbedtls_exit(1);
|
||||
@ -722,6 +724,7 @@ int main(int argc, char *argv[])
|
||||
if (todo.aes_cbc) {
|
||||
int keysize;
|
||||
mbedtls_aes_context aes;
|
||||
|
||||
mbedtls_aes_init(&aes);
|
||||
for (keysize = 128; keysize <= 256; keysize += 64) {
|
||||
mbedtls_snprintf(title, sizeof(title), "AES-CBC-%d", keysize);
|
||||
@ -741,6 +744,7 @@ int main(int argc, char *argv[])
|
||||
int keysize;
|
||||
size_t iv_off = 0;
|
||||
mbedtls_aes_context aes;
|
||||
|
||||
mbedtls_aes_init(&aes);
|
||||
for (keysize = 128; keysize <= 256; keysize += 64) {
|
||||
mbedtls_snprintf(title, sizeof(title), "AES-CFB128-%d", keysize);
|
||||
@ -758,6 +762,7 @@ int main(int argc, char *argv[])
|
||||
if (todo.aes_cfb8) {
|
||||
int keysize;
|
||||
mbedtls_aes_context aes;
|
||||
|
||||
mbedtls_aes_init(&aes);
|
||||
for (keysize = 128; keysize <= 256; keysize += 64) {
|
||||
mbedtls_snprintf(title, sizeof(title), "AES-CFB8-%d", keysize);
|
||||
@ -889,6 +894,7 @@ int main(int argc, char *argv[])
|
||||
if (todo.aria) {
|
||||
int keysize;
|
||||
mbedtls_aria_context aria;
|
||||
|
||||
mbedtls_aria_init(&aria);
|
||||
for (keysize = 128; keysize <= 256; keysize += 64) {
|
||||
mbedtls_snprintf(title, sizeof(title), "ARIA-CBC-%d", keysize);
|
||||
@ -909,6 +915,7 @@ int main(int argc, char *argv[])
|
||||
if (todo.camellia) {
|
||||
int keysize;
|
||||
mbedtls_camellia_context camellia;
|
||||
|
||||
mbedtls_camellia_init(&camellia);
|
||||
for (keysize = 128; keysize <= 256; keysize += 64) {
|
||||
mbedtls_snprintf(title, sizeof(title), "CAMELLIA-CBC-%d", keysize);
|
||||
@ -1015,6 +1022,7 @@ int main(int argc, char *argv[])
|
||||
if (todo.rsa) {
|
||||
int keysize;
|
||||
mbedtls_rsa_context rsa;
|
||||
|
||||
for (keysize = 2048; keysize <= 4096; keysize *= 2) {
|
||||
mbedtls_snprintf(title, sizeof(title), "RSA-%d", keysize);
|
||||
|
||||
@ -1057,6 +1065,7 @@ int main(int argc, char *argv[])
|
||||
mbedtls_dhm_context dhm;
|
||||
size_t olen;
|
||||
size_t n;
|
||||
|
||||
for (i = 0; (size_t) i < sizeof(dhm_sizes) / sizeof(dhm_sizes[0]); i++) {
|
||||
mbedtls_dhm_init(&dhm);
|
||||
|
||||
@ -1170,6 +1179,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (curve_list == (const mbedtls_ecp_curve_info *) &single_curve) {
|
||||
mbedtls_ecp_group grp;
|
||||
|
||||
mbedtls_ecp_group_init(&grp);
|
||||
if (mbedtls_ecp_group_load(&grp, curve_list->grp_id) != 0) {
|
||||
mbedtls_exit(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user