-
Notifications
You must be signed in to change notification settings - Fork 897
SM2/SM3/SM4: Chinese cipher support #6537
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
Conversation
8e577b0
to
2eb4e6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, great work on this.
wolfcrypt/src/ecc.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alignment in comment off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
7ba0b72
to
3626221
Compare
src/internal.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make[3]: warning: -j3 forced in submake: resetting jobserver mode.
make[3]: warning: -j3 forced in submake: resetting jobserver mode.
make[4]: warning: -j3 forced in submake: resetting jobserver mode.
In file included from ./wolfssl/internal.h:27,
from src/internal.c:102:
src/internal.c: In function ‘FreeCiphers’:
src/internal.c:2755:23: error: ‘Ciphers’ has no member named ‘additional’
2755 | XFREE(ssl->decrypt.additional, ssl->heap, DYNAMIC_TYPE_SM4_BUFFER);
| ^
./wolfssl/wolfcrypt/types.h:560:63: note: in definition of macro ‘XFREE’
560 | #define XFREE(p, h, t) {void* xp = (p); if (xp) wolfSSL_Free(xp);}
| ^
src/internal.c:2756:23: error: ‘Ciphers’ has no member named ‘additional’
2756 | XFREE(ssl->encrypt.additional, ssl->heap, DYNAMIC_TYPE_SM4_BUFFER);
| ^
./wolfssl/wolfcrypt/types.h:560:63: note: in definition of macro ‘XFREE’
560 | #define XFREE(p, h, t) {void* xp = (p); if (xp) wolfSSL_Free(xp);}
| ^
make[2]: *** [Makefile:6808: src/libwolfssl_la-internal.lo] Error 1
make[2]: *** Waiting for unfinished jobs....```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
wolfssl/wolfcrypt/types.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can/should we avoid changing these numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed - restored numbering and added it to the end
Ping me when the PR is ready please; I'll test it. |
6158f5e
to
f8cdd5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI reports (PRB-aes.txt_10):
wolfcrypt/src/aes.c: In function ‘GHASH_UPDATE’:
wolfcrypt/src/aes.c:5427:32: error: ‘Aes’ has no member named ‘M0’
5427 | GMULT(AES_TAG(aes), aes->M0); \
| ^~
wolfcrypt/src/aes.c:6359:17: note: in expansion of macro ‘GHASH_ONE_BLOCK’
6359 | GHASH_ONE_BLOCK(aes, AES_LASTGBLOCK(aes));
| ^~~~~~~~~~~~~~~
wolfcrypt/src/aes.c:5427:32: error: ‘Aes’ has no member named ‘M0’
5427 | GMULT(AES_TAG(aes), aes->M0); \
| ^~
wolfcrypt/src/aes.c:6373:13: note: in expansion of macro ‘GHASH_ONE_BLOCK’
6373 | GHASH_ONE_BLOCK(aes, a);
| ^~~~~~~~~~~~~~~
wolfcrypt/src/aes.c:5427:32: error: ‘Aes’ has no member named ‘M0’
5427 | GMULT(AES_TAG(aes), aes->M0); \
| ^~
wolfcrypt/src/aes.c:6388:9: note: in expansion of macro ‘GHASH_ONE_BLOCK’
6388 | GHASH_ONE_BLOCK(aes, AES_LASTGBLOCK(aes));
| ^~~~~~~~~~~~~~~
wolfcrypt/src/aes.c:5427:32: error: ‘Aes’ has no member named ‘M0’
5427 | GMULT(AES_TAG(aes), aes->M0); \
| ^~
wolfcrypt/src/aes.c:6408:17: note: in expansion of macro ‘GHASH_ONE_BLOCK’
6408 | GHASH_ONE_BLOCK(aes, AES_LASTGBLOCK(aes));
| ^~~~~~~~~~~~~~~
wolfcrypt/src/aes.c:5427:32: error: ‘Aes’ has no member named ‘M0’
5427 | GMULT(AES_TAG(aes), aes->M0); \
| ^~
wolfcrypt/src/aes.c:6422:13: note: in expansion of macro ‘GHASH_ONE_BLOCK’
6422 | GHASH_ONE_BLOCK(aes, c);
| ^~~~~~~~~~~~~~~
wolfcrypt/src/aes.c: In function ‘GHASH_FINAL’:
wolfcrypt/src/aes.c:5427:32: error: ‘Aes’ has no member named ‘M0’
5427 | GMULT(AES_TAG(aes), aes->M0); \
| ^~
wolfcrypt/src/aes.c:6454:9: note: in expansion of macro ‘GHASH_ONE_BLOCK’
6454 | GHASH_ONE_BLOCK(aes, AES_LASTGBLOCK(aes));
| ^~~~~~~~~~~~~~~
wolfcrypt/src/aes.c:5427:32: error: ‘Aes’ has no member named ‘M0’
5427 | GMULT(AES_TAG(aes), aes->M0); \
| ^~
wolfcrypt/src/aes.c:6310:9: note: in expansion of macro ‘GHASH_ONE_BLOCK’
6310 | GHASH_ONE_BLOCK(aes, scratch); \
| ^~~~~~~~~~~~~~~
wolfcrypt/src/aes.c:6457:5: note: in expansion of macro ‘GHASH_LEN_BLOCK’
6457 | GHASH_LEN_BLOCK(aes);
| ^~~~~~~~~~~~~~~
make[2]: *** [Makefile:6122: wolfcrypt/src/src_libwolfssl_la-aes.lo] Error 1
4f5488f
to
248fd64
Compare
Add support for: - SM2 elliptic curve and SM2 sign/verify - SM3 digest - SM4 cipher with modes ECB/CBC/CTR/GCM/CCM Add APIs for SM3 and SM4. Add SM2 sign and verify APIs. Add support for SM3 in wc_Hash and wc_Hmac API. Add support for SM3 and SM4 through EVP layer. Add support for SM2-SM3 certificates. Support key ID and name hash being with SHA-1/256 or SM3. Add support for TLS 1.3 cipher suites: TLS-SM4-GCM-SM3, TLS-SM4-CCM-SM3 Add support for TLS 1.2 SM cipher suite: ECDHE-ECDSA-SM4-CBC-SM3 Add support for SM3 in wc_PRF_TLS. Add SM2-SM3 certificates and keys. Generated with GmSSL-3.0.0 and OpenSSL.
Description
Add support for:
Add APIs for SM3 and SM4.
Add SM2 sign and verify APIs.
Add support for SM3 in wc_Hash and wc_Hmac API.
Add support for SM3 and SM4 through EVP layer.
Add support for SM2-SM3 certificates. Support key ID and name hash being with SHA-1/256 or SM3.
Add support for TLS 1.3 cipher suites: TLS-SM4-GCM-SM3, TLS-SM4-CCM-SM3 Add support for TLS 1.2 SM cipher suite: ECDHE-ECDSA-SM4-CBC-SM3 Add support for SM3 in wc_PRF_TLS.
Add SM2-SM3 certificates and keys. Generated with GmSSL-3.0.0 and OpenSSL.
Testing
Tested using private implementation of SM algorithms.
Checklist