implement ShowExtendedSystemInfo() in version.c#6149
implement ShowExtendedSystemInfo() in version.c#6149gojimmypi wants to merge 1 commit intowolfSSL:masterfrom
Conversation
bandi13
left a comment
There was a problem hiding this comment.
This is a great start. It'd be better if this would be a bit more generic so that other platforms (ARM, x86, etc.) would make use of this function as well. Perhaps adding in a call to this for our binaries used in the examples would help when the support team receives a log.
src/version.c
Outdated
There was a problem hiding this comment.
Can you put this outside of the defined(WOLFSSL_ESPIDF)? That way other platforms could use it as well.
There was a problem hiding this comment.
Might want to call the function ShowExtendedSystemInfo since you're printing out clock speeds and capabilities of the part as well.
There was a problem hiding this comment.
Both good suggestions. Function is now ShowExtendedSystemInfo() and a bit more friendly to other platforms.
src/version.c
Outdated
There was a problem hiding this comment.
You should use a macro to print the lines. Then have a section above like so:
#if defined(WOLFSSL_ESPIDF)
#define VERSION_PRINTF(...) ESP_LOGI(TAG, ...)
#else
#define VERSION_PRINTF(...)
// or #warn "No printing capability
#endif
There was a problem hiding this comment.
I wouldn't be surprised if we already have a macro like this somewhere
There was a problem hiding this comment.
We may, but I put in a local VERSION_PRINTF
src/version.c
Outdated
There was a problem hiding this comment.
This stuff would be great in a general use case, for example if we compile with '--enable-debug' it would be nice to see this printed
There was a problem hiding this comment.
Putting this stuff in a separate function like 'gitVersionInfo' might be better organized.
There was a problem hiding this comment.
I think the end user can choose the --enable-debug option in their code around their call to ShowExtendedSystemInfo() .
I did however put things into separate functions for readability. (e.g. ShowExtendedSystemInfo_git())
src/version.c
Outdated
There was a problem hiding this comment.
Maybe then you could put the ESP32 stuff in a separate function that is guarded by WOLFSSL_ESPIDF?
There was a problem hiding this comment.
Yup: see ShowExtendedSystemInfo_platform_espressif()
wolfssl/version.h.in
Outdated
There was a problem hiding this comment.
Shouldn't the definition of this come from configure.ac (i.e.: WOLFSSL_LIBRARY_VERSION)?
There was a problem hiding this comment.
oh yes, good catch.
9b2e1b4 to
fb77459
Compare
|
@bandi13 all good suggestions. See latest update. |
bandi13
left a comment
There was a problem hiding this comment.
There are some minor changes requested.
src/version.c
Outdated
There was a problem hiding this comment.
This needs "{}" for instance if we have in code:
if(false) WOLFSSL_VERSION_PRINTF("stuff");
then, that would always print a newline.
There was a problem hiding this comment.
ah yes, good catch.
There was a problem hiding this comment.
This has been implemented. Let me know if any other changes are needed.
src/version.c
Outdated
There was a problem hiding this comment.
This seems error prone when new parts come out we would have to be aware and add it to the list (not to mention propagate to customers). Instead, you should have an IF block on parts that do support ESP32WROOM32_CRYPT.
There was a problem hiding this comment.
agreed. changed logic to known supported targets, everything else is an error
src/version.c
Outdated
There was a problem hiding this comment.
Don't put in unnecessary conditions. When we add support we can add those targets.
There was a problem hiding this comment.
agreed. changed logic to known supported targets, everything else is an error
src/version.c
Outdated
There was a problem hiding this comment.
Negate this condition around so there is no empty block
There was a problem hiding this comment.
well, no... it was actually a TODO. I instead put in a HWM from stack allocation address.
src/version.c
Outdated
src/version.c
Outdated
src/version.c
Outdated
src/version.c
Outdated
src/version.c
Outdated
There was a problem hiding this comment.
agreed. changed logic to known supported targets, everything else is an error
fb77459 to
eb736fd
Compare
|
This is currently only for CMake projects, such as Espressif. For makefiles, I tried adding this to configure.ac at line 8519: and this in src/include.am at line 23: and this at line 29: and tried this at line 56 But the linker still fails with I tried adding a but then multiple definition error: If I then remove the above if I tried these steps from @kaleb-himes
As there's not much interesting for other platforms, perhaps makefile support can be added in a future PR. Here's the updated output for Espressif |
|
There has to be a way for this to go in our regular build flow. Especially the 'git' information is super useful for all platforms. As we've discussed before, it would help at the minimum the support team whereby they have the exact version information as part of the logs. Not having this be part of |
We can always add that later in a separate PR. Just because I've not yet been successful does not mean I've given up.
Good suggestion. I've tried that as well. Clearly I'm missing something.
I completely agree. Otherwise, any objection to merging this PR? I'd like to remove all the duplicate code from the Espressif examples soon. |
|
Jenkins retest this please |
eb736fd to
3103a88
Compare
d745786 to
e44abef
Compare
|
I have some proposed changes, not yet applied here as related to #6123 introspection. |
6e3eb61 to
7991c06
Compare
|
Jenkins retest this please |
1 similar comment
|
Jenkins retest this please |
|
Jenkins retest this please |
1297153 to
736e30f
Compare
8d7e91c to
98bfc9c
Compare
|
I believe I have all build issue resolved. The last problematic one was needing to add the I'm still getting a *edit: here's a script to check the previously problematic build: make clean
make distclean
./autogen.sh
./configure --enable-aesgcm=table --enable-all-crypto --enable-cryptonly --enable-crypttests --disable-asm --disable-fastmath && make && ./wolfcrypt/test/testwolfcrypt |
b6ec6d3 to
afb7b8d
Compare
afb7b8d to
aeebb9f
Compare
dgarske
left a comment
There was a problem hiding this comment.
I like what you are trying to do here, but I don't like the solution. This is very ESP centric and should not be in the library. It should be in the ESP specific code or even the ESP port code. Why not extend the existing HAVE_WC_INTROSPECTION?
| EXTRA_DIST += src/ssl_asn1.c | ||
| EXTRA_DIST += src/ssl_bn.c | ||
| EXTRA_DIST += src/ssl_misc.c | ||
| EXTRA_DIST += src/version.c |
There was a problem hiding this comment.
Adding a new files requires updating all the other build platforms like CMake, Visual Studio projects, etc. Please don't do this action unless a new file is absolutely required.
There was a problem hiding this comment.
This shouldn't be a reason not to separate out functionality into smaller files. Our files are too big as it is. Instead, maybe update the other build platforms.
There was a problem hiding this comment.
This is very ESP centric
Indeed this is very ESP centric at the moment, as I've been doing mostly Espressif development. My plan is to have an infrastructure in place to allow others to add their own platform-specific details as needed & desired. When doing so, and only as needed, the respective build & make platforms could be updated.
Although Espressif-specific now, I do see there being significant value in having a template of common system information for all platforms and all products. That would seem to be a valuable resource for customers to provide when asking for support.
It should be in the ESP specific code or even the ESP port code
I see your point here on the Espressif-specific details. I envisioned all of the "hardware / configuration overview" details being in a single file. As hardware typically has a version as well, that's another reason I was thinking of the version.c as a home. for this information.
If instead we had something way down in the ./port/expressif, what structure would you use? Perhaps a hardware specific ShowHardwareConfiguration() that is implemented for each platform, then called as appropriate from a single function elsewhere?
don't [add version.c] unless a new file is absolutely required
It was quite a learning curve to tease that file into the builds, so I definitely respect that comment. Still, iIntuitively for me, it seems to make sense to have this information in the version.c file. That seems to be a universal file & the most global across all wolfSSL libraries.
Why not extend the existing
HAVE_WC_INTROSPECTION?
This is an excellent question. Although similar in concept, some of the information is mutually exclusive from introspection. @douzzer pointed out that: "HAVE_WC_INTROSPECTION requires that the configuration and build time artifacts, particularly the date/time of build and git parameters, be excluded from the build". For example: some of the information such as git hash & date may be updated, but the binary build itself should not actually change.
Given this, if you still feel strongly that I should not add the version.c, I'm happy to implement this functionality elsewhere. Any preference? Perhaps wolfcrypt/logging.c would be a appropriate? I certainly agree with @bandi13 about the big files. I'm in favor of more specific, smaller files when possible.
| extern "C" { | ||
| #endif | ||
|
|
||
| #ifdef HAVE_CONFIG_H |
There was a problem hiding this comment.
These config.h and settings.h go in the .c, not the .h.
There was a problem hiding this comment.
I added the config.h and settings.h using the model from ssl.h; in particular I needed to include visibility.h in order to use the WOLFSSL_API macro, without which, the linker could not find ShowExtendedSystemInfo(). Is there a preferred way of doing this?
|
|
||
| #endif /* NO_VERSION_EXTENDED_INFO */ | ||
|
|
||
| #ifdef __cplusplus |
There was a problem hiding this comment.
The __cplusplus logic only goes in the .h. It is already there, just remove in .c.
|
This PR will be mothballed for the time being. I've moved the The functionality can still be used in main.c Espressif code like this: There's a new PR coming soon from my WIP ED25519_SHA2_fix branch. See also #6234 Espressif Imporvements summary. |
|
|
||
| if test "$VERSION_EXTENDED_INFO" = "no" | ||
| then | ||
| AM_CFLAGS="$AM_CFLAGS -DNO_VERSION_EXTENDED_INFO" |
There was a problem hiding this comment.
You probably don't need this as I don't think you use NO_VERSION_EXTENDED_INFO anywhere. Better to have the affirmative form of options, so that we can avoid things like #ifndef NO_VERSION_ to check that the extended info exists.
|
We decided not to implement the extended version information in There is however some extended information in the esp32_util.c for the Espressif embedded target. Closing this lingering draft PR.... |
Description
Adds a platform-specific
ShowExtendedSystemInfo()function.This code is otherwise duplicated among many examples, cluttering up
mainin each.The version details are expected to be generated from CMake tasks, such as the benchmark example.
I plan to add additional "interesting" application information as appropriate.
Allows displaying of build-time info like this at runtime:
Fixes zd#
Testing
Tested in Espressif ESP-IDF. Linux apps will compile, but the
version.cis not yet included in the makefiles and otherwise has no additional information for that platform. Future PRs are expected to add platform and environment-specific details.Edit 3/14/23:
A script to fully test:
Now includes the options
--disable-version-extended-infoor--enable-version-extended-infofor non-embedded builds.Disabled
Commandline version will look like this for
testwolfcryptoutput with--disable-version-extended-infoEnabled
Commandline version will look like this for
testwolfcryptoutput with--enable-version-extended-infoand the usual:
Checklist