From b29fa9bd33723093a3dd034bcaa2e4f9ff7a28f3 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Thu, 17 Jun 2021 08:11:40 -0600 Subject: [PATCH 1/2] Changes to support Android app with wolfCrypt module v4.5.4 --- wolfcrypt/benchmark/benchmark.c | 2 +- wolfcrypt/test/test.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index c93836e92..0a2ec17e2 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -110,7 +110,7 @@ #undef NO_FILESYSTEM #define NO_FILESYSTEM -#elif defined(ANDROID) +#elif defined(ANDROID) && !defined(ANDROID_v454) #ifdef XMALLOC_USER #include /* we're using malloc / free direct here */ #endif diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 515c33a35..5259673cc 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -172,10 +172,16 @@ _Pragma("GCC diagnostic ignored \"-Wunused-function\"") #endif #include + #ifndef ANDROID_v454 /* See fips/android/wolfCrypt_v454_android */ #define printf(...) \ __android_log_print(ANDROID_LOG_DEBUG, "TAG", __VA_ARGS__) #define fprintf(fp, ...) \ __android_log_print(ANDROID_LOG_DEBUG, "TAG", __VA_ARGS__) + #else + #ifndef NO_FILESYSTEM + #define NO_FILESYSTEM /* Turn off tests that want to call SaveDerAndPem() */ + #endif + #endif #elif defined(WOLFSSL_DEOS) #include #undef printf From f408eeb5bb921750cc40c619a3704837f65be8fb Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 16 Jul 2021 09:57:11 -0600 Subject: [PATCH 2/2] Implement peer review suggestions --- wolfcrypt/benchmark/benchmark.c | 5 ++++- wolfcrypt/test/test.c | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 0a2ec17e2..57e6415ba 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -110,7 +110,10 @@ #undef NO_FILESYSTEM #define NO_FILESYSTEM -#elif defined(ANDROID) && !defined(ANDROID_v454) +/* ANDROID_V454 (for android studio) displays information in a textview + * and redirects printf to the textview output instead of using + * __android_log_print() */ +#elif defined(ANDROID) && !defined(ANDROID_V454) #ifdef XMALLOC_USER #include /* we're using malloc / free direct here */ #endif diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 5259673cc..60bb174d3 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -172,15 +172,15 @@ _Pragma("GCC diagnostic ignored \"-Wunused-function\"") #endif #include - #ifndef ANDROID_v454 /* See fips/android/wolfCrypt_v454_android */ - #define printf(...) \ - __android_log_print(ANDROID_LOG_DEBUG, "TAG", __VA_ARGS__) - #define fprintf(fp, ...) \ - __android_log_print(ANDROID_LOG_DEBUG, "TAG", __VA_ARGS__) - #else + #ifdef ANDROID_V454 /* See fips/android/wolfCrypt_v454_android */ #ifndef NO_FILESYSTEM #define NO_FILESYSTEM /* Turn off tests that want to call SaveDerAndPem() */ #endif + #else + #define printf(...) \ + __android_log_print(ANDROID_LOG_DEBUG, "TAG", __VA_ARGS__) + #define fprintf(fp, ...) \ + __android_log_print(ANDROID_LOG_DEBUG, "TAG", __VA_ARGS__) #endif #elif defined(WOLFSSL_DEOS) #include