Skip to content

Add benchmarks and memory tracking feature to Signature Examples #467

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

miyazakh
Copy link
Contributor

Based on Japan Intern Morimoto san's work
Fix compile and some clean up

Original PR#352

@miyazakh
Copy link
Contributor Author

Hi @cconlon
I remove unnecessary files. There are still around 4000 lines to be added. But, half of that number comes from folder refactoring.
embedded/tls <-- Be moved from embedded/*. Around 2600 lines(C and Header)
embedded/signature <-- Be added newly. Around 2100 lines(C and Header)

Copy link
Member

@cconlon cconlon left a comment

Choose a reason for hiding this comment

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

See minor comments. @miyazakh, did you also verify all examples run as expected against current master wolfssl?

@@ -0,0 +1,92 @@
# Signature Examples for Embedded Systems
This directory includes the following examples under the sub-directories.Each has a Makefile and source files to build and execute the example and a README to show how to build and Example output.
Copy link
Member

Choose a reason for hiding this comment

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

I suggest we adjust this to read:

This directory includes the following examples. Each subdirectory has a Makefile, source files, and a README to show how to build the example, along with expected example output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.Thanks

||ecc_vfy_only_nonblock|verify signature with non-blocking|


You can specify a target function of Simple example, Benchemark or Memory track program.It also has options for optimized code for MCU architectures such as Intel x86, ARM64 or a generic code by default, as well as Math library of Single Precision or TFM.
Copy link
Member

Choose a reason for hiding this comment

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

I suggest we adjust this to read:

When building each example, you can specify arguments to control the build.  Specify a target function to run either a simple example, benchmark, or memory tracking example. Specify an "arch" option to build optimized code for MCU architectures such as Intel x86, ARM64 or a generic code by default.  And specify a "math" option to choose an underlying wolfCrypt math library to use, between Single Precision or TFM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

|math|Description|
|---|---|
|Default|Generic architecture by pure C language source code|
|sp| SP for generic or specified archtecture|
Copy link
Member

Choose a reason for hiding this comment

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

Spelling - "archtecture" should be "architecture"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

|x64|SP for x86 64bit|


The Makefile is self-contained without libwolfssl. Put your wolfSSL source filesin parallel with wolfssl-examples directory. It is defined by WOLFROOT in Makefile.It compiles only needed files for the target. OBJ and OBJ_xxx macro in Makefiledefine object files for the common and specific target.
Copy link
Member

Choose a reason for hiding this comment

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

This paragraph needs some spacing adjustments and rework. I suggest we change it to read:

Each Makefile is self-contained to statically link wolfCrypt source files (without using a shared libwolfssl.so). Put your wolfSSL source files in parallel with the wolfssl-examples directory. The location of the primary wolfSSL source directory is defined by WOLFROOT in each Makefile. Each build compiles only the needed files for the target. OBJ and OBJ_xxx macros in each Makefile define object files for the common and specific 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.

Thanks. Fixed.


The Makefile is self-contained without libwolfssl. Put your wolfSSL source filesin parallel with wolfssl-examples directory. It is defined by WOLFROOT in Makefile.It compiles only needed files for the target. OBJ and OBJ_xxx macro in Makefiledefine object files for the common and specific target.
Example programs are hard coded for a hash algorithm or signature scheme.Sha256 is for the hash by default. PKCS #1 v1.5 or ECDSA for the signature scheme.You can refer to the following API tables for modifying the examples for other algorithms or schemes.
Copy link
Member

Choose a reason for hiding this comment

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

Some spacing adjustments needed here. I suggest changing this to read:

Example programs are hard coded to use a specific hash algorithm or signature scheme. Sha256 is used for the hash by default. PKCS#1 v1.5 or ECDSA is used for the signature scheme. You can refer to the following API tables for modifying the examples for other algorithms or schemes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

*/

#include <stdio.h>
#include<wolfssl/wolfcrypt/settings.h>
Copy link
Member

Choose a reason for hiding this comment

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

Need a space after "#include" for settings.h

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

#include<wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/rsa.h>
#include <wolfssl/wolfcrypt/sha256.h>
#include<wolfssl/ssl.h>
Copy link
Member

Choose a reason for hiding this comment

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

Please add a space after #include for ssl.h and test.h.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

if ((int)decSigLen < 0)
ret = (int)decSigLen;
}

Copy link
Member

Choose a reason for hiding this comment

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

Remove extra blank lines 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.

Removed the line

*/

#include <stdio.h>
#include<wolfssl/wolfcrypt/settings.h>
Copy link
Member

Choose a reason for hiding this comment

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

Add space after #include for settings.h, ssl.h, test.h

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

printf("Verified\n");

printf("Non-blocking:\n");
printf(" Total time : %.2f micro sec, Bloking count: %d \n",1000*1000*total_blk_time, blk_count);
Copy link
Member

Choose a reason for hiding this comment

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

Check this line against our 80 character limit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@cconlon cconlon removed their assignment Aug 18, 2025
Shingo Morimoto and others added 8 commits August 20, 2025 04:53
Add becnmark and memory tranking to the following program:
signature/rsa_vfy_only/verify
signature/rsa_buffer/verify
signature/ecc-sign-verify/ecc_sign_verify
-modified Makefile to execute clean target before building.
-modified Makefile to add CFLAGS for sp_x86_64.
-fixed BENCH_TIME_SEC possible to be defined by compiler flags.
-add -lpthread to be given to compiler.
* Add non-blocking mode for ECC Signature Example

* Add non-blocking mode for RSA with TFM

* Add ecc_vfy_only and ecc_vfy_only_nonblock

- Add ecc_vfy_only to separate the function  Verifying only from the ecc_sign_verify that signing and verifying the signatures.
- Rename rsa_buffer to rsa_sign_verify
- Add rsa_vfy_only_nonblock

* Revise the README

---------

Co-authored-by: Shingo Morimoto <shingo@wolfssl.com>
add Makefile to make all
remove unnecessary files
remove trailing spaces
add file header

fix wc_RsaSSL_Verify
@miyazakh miyazakh force-pushed the sig_verify_morimoto branch from b6328e5 to 51b3eff Compare August 19, 2025 21:25
@miyazakh
Copy link
Contributor Author

Hi @cconlon

did you also verify all examples run as expected against current master wolfssl?

Yes, I did. I ran all examples again under the latest master wolfssl. It needed tweaking user_settings.h for wc_RsaSSL_Verify()

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