Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Espressif common CONFIG_WOLFSSL_EXAMPLE_NAME, Kconfig #7866

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

gojimmypi
Copy link
Contributor

Description

This PR introduces common KConfig and user setting files for the Espressif template app as it is the most basic example and least intrusive to change.

The intent is that all wolfSSL examples in all repos will have common user_settings.h , CMakeLists.txt and KConfig files, with only the sdkconfig.defaults varying. Rather than propose all changes to all examples at once, this PR for only the template example is for simplified code review.

Note that new configuration settings specific to ESP-IDF versions integrating wolfSSL are also included here. There's likely little to no effect on ESP-IDF versions that do not support the new features. As of the date of this PR, many features are only available on my ESP-IDF v5.2.2 fork.

The objective is to not only simplify the configuration of the user_settings.h file by utilizing the menuconfig capabilities, but in doing so will also prevent changes from being needed when using the wolfSSL Managed Component. Recall that making changes, such as to the user_settings.h file, causes the component manager to complain about changes. This forces the user to convert the Managed Component to a regular component, defeating the purpose and value of having a managed component in the first place.

Here's the new idf.py menuconfig as viewed in VisualGDB. Note the dropdown also increases end-user awareness to the other examples available:

image

Fixes zd#: Not "fixing" but related to 18228.

Testing

How did you test?

Tested only on Espressif targets.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@dgarske dgarske requested review from douzzer and removed request for ejohnstown, dgarske, bandi13 and embhorn August 15, 2024 16:13
@dgarske dgarske removed their assignment Aug 15, 2024
Copy link
Contributor

@douzzer douzzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive work!

Little stuff: I Found 3 whitespace infractions, and left several question-comments. In particular, I think you left on some debug gates in the user_config.h inadvertently.

Comment on lines 989 to 990
#define USE_CERT_BUFFERS_256
/* Be sure to include in app when using example certs: */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix hard tabs in the indentation here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, interesting. Visual Studio usually converts to spaces at save time. Good catch. Fixed

Comment on lines 1011 to 1012
#define USE_CERT_BUFFERS_256
/* Be sure to include in app when using example certs: */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more hard tabs to fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also fixed

@@ -208,7 +538,7 @@
#define USE_FAST_MATH

/***** Use SP_MATH *****/
/* #undef USE_FAST_MATH */
/* #undef USE_FAST_MATH */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest you either snip out the added space after #undef, or snip out a space afterwards to get the */ to line up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely!

bool "Enable RSA in my project"
default "n"
help
RSA is disabled by default. Select this option to enable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is RSA default-disabled just as a space-saving measure, due to the small target?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, good question. Having the default for "works on more systems" is desirable, particularly something like the C2 or Arduino Nano with limited memory.

The sdkconfig.defaults can be used to set defaults, as well as sdkconfig.defaults.[target] (see example).

I've been reluctant to include all the sdkconfig.defaults.[target] files in all the examples without a compelling reason, but in the future it might be better to enable RSA by default, and then include a sdkconfig.defaults.esp32c2 file that disables it.

Comment on lines 839 to 841
#define WOLFSSL_ESP32_HW_LOCK_DEBUG
#define WOLFSSL_DEBUG_MUTEX
#define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to enable debug gates in the example config? Maybe so. Just wondering if you considered the overhead.

Edit: There's actually another #define WOLFSSL_ESP32_HW_LOCK_DEBUG below, commented out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to enable debug gates in the example config? Maybe so.

Maybe, but not much interesting in this template example. I'll review with the other examples & see if any make sense without being too verbose. There's already some informative "always on" messages. See the ESP_LOGI() in the TLS Client Example. I'll definitely be adding more settings to control these from Kconfig / menuconfig.

Another #define WOLFSSL_ESP32_HW_LOCK_DEBUG below, commented out.

Good catch. I've removed the extra one.

@gojimmypi
Copy link
Contributor Author

Thanks, @douzzer for the code review and attention to detail. I believe I've tidied things up.

@douzzer
Copy link
Contributor

douzzer commented Aug 23, 2024

retest this please

@douzzer douzzer merged commit c454a42 into wolfSSL:master Aug 24, 2024
125 checks passed
@gojimmypi gojimmypi deleted the pr-espressif-config branch October 9, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants