From db399a9b7a7987e31e83b6860e20b28b3c256986 Mon Sep 17 00:00:00 2001 From: kegilbert Date: Tue, 12 Mar 2019 17:57:47 -0500 Subject: [PATCH 1/2] Small astyle and whitespace refactor Produce compiler error if MBEDTLS_PSA_CRYPTO_C is not defined rather than redefine main --- main.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/main.cpp b/main.cpp index f5ffa34..916d9c0 100755 --- a/main.cpp +++ b/main.cpp @@ -39,7 +39,7 @@ if((actual) != (expected)) \ { \ mbedtls_printf( "\tassertion failed at %s:%d - " \ - "actual:%" PRId32 "expected:%" PRId32 "\n", \ + "actual:%" PRId32 "expected:%" PRId32 "\n", \ __FILE__, __LINE__, \ (psa_status_t) actual, (psa_status_t) expected ); \ goto exit; \ @@ -47,12 +47,7 @@ } while (0) #if !defined(MBEDTLS_PSA_CRYPTO_C) -int main(void) -{ - mbedtls_printf("Not all of the required options are defined:\n" - " - MBEDTLS_PSA_CRYPTO_C\n"); - return 0; -} + #error "Not all of the required options are defined: Missing MBEDTLS_PSA_CRYPTO_C" #else #define PSA_ATTESTATION_PRIVATE_KEY_ID 17 @@ -120,8 +115,9 @@ static psa_status_t check_initial_attestation_get_token() ASSERT_STATUS(attest_err, PSA_ATTEST_ERR_SUCCESS); exit: - if(attest_err != PSA_ATTEST_ERR_SUCCESS) + if (attest_err != PSA_ATTEST_ERR_SUCCESS) { return attest_err; + } return status; } @@ -170,7 +166,7 @@ int main(void) psa_key_handle_t handle = 0; fake_set_initial_nvseed(); - + attestation_example(); psa_open_key(PSA_KEY_LIFETIME_PERSISTENT, key_id, &handle); From 1cfc0595e324440059577fa279d77e0ec022f28a Mon Sep 17 00:00:00 2001 From: Guy Wild Date: Wed, 13 Mar 2019 07:57:50 -0500 Subject: [PATCH 2/2] Updated error string Co-Authored-By: kegilbert --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 916d9c0..f994932 100755 --- a/main.cpp +++ b/main.cpp @@ -47,7 +47,7 @@ } while (0) #if !defined(MBEDTLS_PSA_CRYPTO_C) - #error "Not all of the required options are defined: Missing MBEDTLS_PSA_CRYPTO_C" + #error "Not all of the required options are defined: Missing MBEDTLS_PSA_CRYPTO_C." #else #define PSA_ATTESTATION_PRIVATE_KEY_ID 17