From d84adce608512e9b0b7f3214e29c3644cb5ba907 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Mon, 10 Jul 2023 17:12:12 -0500 Subject: [PATCH] Fix Micrium config and new examples with NO_FILESYSTEM --- examples/README.md | 6 ++++++ examples/asn1/asn1.c | 9 +++++---- examples/pem/pem.c | 9 +++++---- wolfssl/wolfcrypt/settings.h | 1 + 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/examples/README.md b/examples/README.md index 068be8fd1e..bea7295347 100644 --- a/examples/README.md +++ b/examples/README.md @@ -84,3 +84,9 @@ and This directory contains example wolfSSL configuration file templates for use when autoconf is not available, such as building with a custom IDE. See [configs/README.md](configs/README.md) for more details. + +## asn1 +This directory contains an example that prints the ASN.1 data of a BER/DER or PEM encoded file. Configure wolfSSL with `--enable-asn-print`. + +## pem +This directory contains an example of converting to/from PEM and DER. Configure wolfSSL with `--enable-coding` diff --git a/examples/asn1/asn1.c b/examples/asn1/asn1.c index 7ca79f23a7..4d8d0c30e8 100644 --- a/examples/asn1/asn1.c +++ b/examples/asn1/asn1.c @@ -30,8 +30,9 @@ #include #include #include +#include -#ifdef WOLFSSL_ASN_PRINT +#if defined(WOLFSSL_ASN_PRINT) && !defined(NO_FILESYSTEM) /* Increment allocated data by this much. */ #define DATA_INC_LEN 256 @@ -485,9 +486,9 @@ int main(int argc, char* argv[]) { (void)argc; (void)argv; - fprintf(stderr, "ASN.1 Parsing and Printing not compiled in.\n"); + fprintf(stderr, "ASN.1 Parsing and Printing or file system not compiled" + " in.\n"); return 0; } -#endif /* WOLFSSL_ASN_PRINT */ - +#endif /* WOLFSSL_ASN_PRINT && !defined(NO_FILESYSTEM)*/ diff --git a/examples/pem/pem.c b/examples/pem/pem.c index 5cb15aa3a8..0929cdfb53 100644 --- a/examples/pem/pem.c +++ b/examples/pem/pem.c @@ -35,8 +35,9 @@ #ifdef DEBUG_WOLFSSL #include #endif +#include -#ifdef WOLFSSL_PEM_TO_DER +#if defined(WOLFSSL_PEM_TO_DER) && !defined(NO_FILESYSTEM) /* Increment allocated data by this much. */ #define DATA_INC_LEN 256 @@ -1034,9 +1035,9 @@ int main(int argc, char* argv[]) { (void)argc; (void)argv; - fprintf(stderr, "PEM to DER conversion not compiled in.\n"); + fprintf(stderr, "PEM to DER conversion of file system support not compiled" + " in.\n"); return 0; } -#endif /* WOLFSSL_PEM_TO_DER */ - +#endif /* WOLFSSL_PEM_TO_DER && !NO_FILESYSTEM */ diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index a14364d4d1..6e34ebca85 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -1528,6 +1528,7 @@ extern void uITRON4_free(void *p) ; #ifdef MICRIUM #include #include + #include #if defined(RTOS_MODULE_NET_AVAIL) || (APP_CFG_TCPIP_EN == DEF_ENABLED) #include #include