From 391005cb3b2b195636570108dba30cf71894a7d6 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Sun, 27 Nov 2022 21:32:37 +0100 Subject: [PATCH] Fix structures initialized too late in tests Signed-off-by: Gilles Peskine --- tests/suites/test_suite_pkcs7.function | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/suites/test_suite_pkcs7.function b/tests/suites/test_suite_pkcs7.function index f938f42373..3d7dec6864 100644 --- a/tests/suites/test_suite_pkcs7.function +++ b/tests/suites/test_suite_pkcs7.function @@ -54,11 +54,11 @@ void pkcs7_verify( char *pkcs7_file, char *crt, char *filetobesigned, int do_has mbedtls_pkcs7 pkcs7; mbedtls_x509_crt x509; - USE_PSA_INIT(); - mbedtls_pkcs7_init( &pkcs7 ); mbedtls_x509_crt_init( &x509 ); + USE_PSA_INIT(); + res = mbedtls_x509_crt_parse_file( &x509, crt ); TEST_EQUAL( res, 0 ); @@ -127,12 +127,12 @@ void pkcs7_verify_multiple_signers( char *pkcs7_file, char *crt1, char *crt2, ch mbedtls_x509_crt x509_1; mbedtls_x509_crt x509_2; - USE_PSA_INIT(); - mbedtls_pkcs7_init( &pkcs7 ); mbedtls_x509_crt_init( &x509_1 ); mbedtls_x509_crt_init( &x509_2 ); + USE_PSA_INIT(); + res = mbedtls_pk_load_file( pkcs7_file, &pkcs7_buf, &buflen ); TEST_EQUAL( res, 0 );