mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-21 06:40:50 +00:00
tests_suite_debug: fix psa initialization
Since MD_OR_USE_PSA_INIT() can fail and jump to the "exit" label it should be placed after all initializations has been done. This issue was discovered by Coverity testing. Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
fb2da6fb35
commit
3a994b7dbe
@ -59,10 +59,9 @@ void debug_print_msg_threshold(int threshold, int level, char *file,
|
||||
mbedtls_ssl_config conf;
|
||||
struct buffer_data buffer;
|
||||
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
mbedtls_ssl_init(&ssl);
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
MD_OR_USE_PSA_INIT();
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
@ -98,10 +97,9 @@ void mbedtls_debug_print_ret(char *file, int line, char *text, int value,
|
||||
mbedtls_ssl_config conf;
|
||||
struct buffer_data buffer;
|
||||
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
mbedtls_ssl_init(&ssl);
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
MD_OR_USE_PSA_INIT();
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
@ -134,10 +132,9 @@ void mbedtls_debug_print_buf(char *file, int line, char *text,
|
||||
mbedtls_ssl_config conf;
|
||||
struct buffer_data buffer;
|
||||
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
mbedtls_ssl_init(&ssl);
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
MD_OR_USE_PSA_INIT();
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
@ -211,11 +208,10 @@ void mbedtls_debug_print_mpi(char *value, char *file, int line,
|
||||
struct buffer_data buffer;
|
||||
mbedtls_mpi val;
|
||||
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
mbedtls_ssl_init(&ssl);
|
||||
mbedtls_ssl_config_init(&conf);
|
||||
mbedtls_mpi_init(&val);
|
||||
MD_OR_USE_PSA_INIT();
|
||||
memset(buffer.buf, 0, 2000);
|
||||
buffer.ptr = buffer.buf;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user