Skip to content

Conversation

@gojimmypi
Copy link
Contributor

@gojimmypi gojimmypi commented Oct 2, 2023

Description

This update adds the certs_test_sm.h file: the SM Cipher specific certs in array format, partially addressing #6681.

Contents were semi-manually generated using gencertbuf.pl. I still need to create a script to automatically refresh it.

I'm in the process of polishing my Espressif examples that support the SM ciphers and need to have this file available not only here, but also in the ESP Registry. See also #6708

git clone https://github.com/wolfSSL/wolfsm.git
cd wolfsm
./install.sh
# or
./install.sh  /path/to/your/wolfssl

Fixes zd# n/a

Testing

Tested with ESP32 embedded apps only.

edit(3): Reminder for sample commandline testing (See wolfsm testing-tls):

./examples/client/client -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 \
                              -c ./certs/sm2/client-sm2.pem \
                              -k ./certs/sm2/client-sm2-priv.pem \
                              -A ./certs/sm2/root-sm2.pem -C

./examples/server/server -v 3 -l ECDHE-ECDSA-SM4-CBC-SM3 \
                              -c ./certs/sm2/server-sm2.pem \
                              -k ./certs/sm2/server-sm2-priv.pem \
                              -A ./certs/sm2/client-sm2.pem -V 

Example listening server on ESP32: (the one not working is the ESP32-H2, which has no built-in WiFi)

image

Checklist

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

@gojimmypi
Copy link
Contributor Author

retest this please

@JacobBarthelmeh
Copy link
Contributor

JacobBarthelmeh commented Oct 3, 2023

retest this please Jenkins

@JacobBarthelmeh
Copy link
Contributor

fails test for special characters found

[check-source-text] [2 of 7] [3980560f00]

weird control chars, hard tabs, CRs, trailing whitespace:

./wolfssl/certs_test_sm.h:7028:»0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
./wolfssl/certs_test_sm.h:7029:»0x65, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x44, 0x61, 0x74,
./wolfssl/certs_test_sm.h:7030:»0x61, 0x3A, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
./wolfssl/certs_test_sm.h:7031:»0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3A, 0x20,
./wolfssl/certs_test_sm.h:7032:»0x33, 0x20, 0x28, 0x30, 0x78, 0x32, 0x29, 0x0A, 0x20, 0x20,
./wolfssl/certs_test_sm.h:7033:»0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x53, 0x65, 0x72, 0x69,
./wolfssl/certs_test_sm.h:7034:»0x61, 0x6C, 0x20, 0x4E, 0x75, 0x6D, 0x62, 0x65, 0x72, 0x3A,
./wolfssl/certs_test_sm.h:7035:»0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
./wolfssl/certs_test_sm.h:7036:»0x20, 0x20, 0x20, 0x36, 0x30, 0x3A, 0x61, 0x30, 0x3A, 0x34,
./wolfssl/certs_test_sm.h:7037:»0x61, 0x3A, 0x30, 0x62, 0x3A, 0x33, 0x36, 0x3A, 0x65, 0x62,
[...and more...]

@gojimmypi
Copy link
Contributor Author

fails test for special characters found

cleaned

Copy link
Contributor

@JacobBarthelmeh JacobBarthelmeh left a comment

Choose a reason for hiding this comment

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

I like the addition of certs_test_sm.h but thinking on it more, should it go into the wolfsm repository and get added to wolfssl with the wolfsm/install.sh script?

@@ -0,0 +1,8400 @@
/* certs_test_sm.h */
/* This file was generated using: ./gencertbuf_sm.pl */
Copy link
Contributor

Choose a reason for hiding this comment

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

was gencertbuf_sm.pl supposed to be in this PR?

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, see #6681 although the correct name is gencert_sm.sh and needs to be cleaned 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.

I've revised the original PR to instead use the existing gencertbuf.pl to generate both files.

@gojimmypi
Copy link
Contributor Author

should it go into the wolfsm repository and get added to wolfssl with the wolfsm/install.sh script?

@JacobBarthelmeh : yes, good catch. I agree the certs should be copied with SM install instead.

I'll be creating a new PR over there in wolfsm this week.

@gojimmypi gojimmypi closed this Nov 12, 2023
@gojimmypi
Copy link
Contributor Author

@JacobBarthelmeh would you like me to also move the certs/sm2 files to wolfSSL/wolfsm as well & include in the respective install.sh?

cc: @SparkiDev

@gojimmypi
Copy link
Contributor Author

I'm planning to instead update existing certs_test.h here as noted in wolfSSL/wolfsm#16 (comment)

@gojimmypi gojimmypi reopened this Nov 22, 2023
@gojimmypi gojimmypi marked this pull request as draft November 22, 2023 20:09
@gojimmypi
Copy link
Contributor Author

Jenkins retest this please.

For Cannot contact wolf-linux-cloud-node-[n]: java.lang.InterruptedException
Unable to create live FilePath for wolf-linux-cloud-node-[n]; wolf-linux-cloud-node-[n]was marked offline: Connection was broken

@gojimmypi gojimmypi marked this pull request as ready for review September 10, 2025 00:48
@gojimmypi gojimmypi requested review from wolfSSL-Bot and removed request for bandi13 September 10, 2025 00:48
@gojimmypi gojimmypi marked this pull request as draft September 10, 2025 02:10
@gojimmypi gojimmypi marked this pull request as ready for review September 10, 2025 04:58
@gojimmypi
Copy link
Contributor Author

Jenkins retest this please.

For org.jenkinsci.plugins.workflow.support.steps.AgentOfflineException: Unable to create live FilePath for wolf-linux-cloud-node-[n]; wolf-linux-cloud-node-[n] was marked offline

@gojimmypi
Copy link
Contributor Author

Heads up the current SM2 certs expire in a couple of months: November 11.

$ openssl x509 -in ./certs/sm2/ca-sm2.der -inform DER -noout -dates
notBefore=Feb 15 06:23:07 2023 GMT
notAfter=Nov 11 06:23:07 2025 GMT

I can put up a separate PR to refresh them sooner. See scripts in certs/sm2 :

./gen-sm2-keys.sh
./gen-sm2-certs.sh  

@gojimmypi
Copy link
Contributor Author

The changes in this PR were merged in #9218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants