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

wolfCrypt CSharp Wrapper #3166

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

Conversation

dgarske
Copy link
Contributor

@dgarske dgarske commented Jul 27, 2020

Description

  • Adds RNG, ECC(ECIES and ECDHE), RSA, ED25519/Curve25519, AES-GCM, and Hashing to the CSharp wrapper.
  • Adds GitHub action for building the CSharp wrapper solution and running wolfCrypt test and a TLS server/client example.
  • Adds "new" API's for wolfCrypt for platforms that cannot tolerate the structs directly.
  • Fixes for several scan-build warnings.

@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

@dgarske
Copy link
Contributor Author

dgarske commented Aug 12, 2024

Retest this please

Failed "PRB-single-flag.txt_140" -> FAIL: scripts/openssl.test

Verification: OK
---
New, TLSv1.2, Cipher is DHE-RSA-AES128-SHA256
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : DHE-RSA-AES128-SHA256
    Session-ID: 603095B7951650878661715FD3F8986C9AA55554190CF76174CE4EF8A4621486
    Session-ID-ctx: 
    Master-Key: 10EEBC6975E0DF1DE3B1DDA67AC867EFCAE0C677AE8CD4C6F693E89FF39F038427CCE6F0C5EF2D52B992430B161FE6F9
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1723481638
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: yes
---
client failed! Suite = DHE-RSA-AES128-SHA256 version = 3
in cleanup
killing server: OpenSSL_RSA (51839)
killing server: wolfSSL_RSA (58911)
killing server: OpenSSL_ECDH[E]-ECDSA (64612)
killing server: wolfSSL_ECDH[E]-ECDSA (58911)
FAIL scripts/openssl.test (exit status: 1)

@dgarske dgarske requested review from JacobBarthelmeh and removed request for JacobBarthelmeh August 22, 2024 23:31
@dgarske dgarske force-pushed the csharp_wolfcrypt branch 4 times, most recently from a5e7c91 to 315cc9c Compare August 23, 2024 19:08
@dgarske
Copy link
Contributor Author

dgarske commented Aug 26, 2024

@wolfSSL-Bot , this work is at a good checkpoint to review. More work is planned for the wolfCrypt CSharp wrapper, but the ECC, ED25519/Curve25519 and RSA should be ready/done.

@dgarske dgarske force-pushed the csharp_wolfcrypt branch 2 times, most recently from 840bfdc to 0b0cd76 Compare September 3, 2024 16:55
@dgarske
Copy link
Contributor Author

dgarske commented Sep 4, 2024

Retest this please. Multi-test failure, but history not retained long enough

@dgarske dgarske requested a review from douzzer September 5, 2024 19:41
@dgarske dgarske assigned wolfSSL-Bot and douzzer and unassigned dgarske and aidangarske Sep 5, 2024
wrapper/CSharp/wolfCrypt-Test/wolfCrypt-Test.cs Outdated Show resolved Hide resolved
wrapper/CSharp/wolfCrypt-Test/wolfCrypt-Test.cs Outdated Show resolved Hide resolved
wrapper/CSharp/wolfSSL_CSharp/wolfCrypt.cs Outdated Show resolved Hide resolved
@dgarske
Copy link
Contributor Author

dgarske commented Sep 11, 2024

@aidangarske PR has merge conflicts and needs rebase / force-push.

wrapper/CSharp/README.md Outdated Show resolved Hide resolved
wrapper/CSharp/wolfCrypt-Test/wolfCrypt-Test.cs Outdated Show resolved Hide resolved
@dgarske dgarske requested review from JacobBarthelmeh and removed request for douzzer September 18, 2024 21:44
@gasbytes gasbytes assigned aidangarske and unassigned gasbytes Sep 20, 2024
@dgarske
Copy link
Contributor Author

dgarske commented Sep 24, 2024

@aidangarske please review and fix these warnings. Also the memory leak in aes_test. Check when the new/free are called.

make[2]: warning: -j4 forced in submake: resetting jobserver mode.
wolfcrypt/test/test.c:33711:34: warning: 'XMEMSET' call operates on objects of type 'byte' (aka 'unsigned char') while the size is based on a different type 'byte *' (aka 'unsigned char *') [-Wsizeof-pointer-memaccess]
    XMEMSET(plaintext, 0, sizeof(plaintext));
            ~~~~~~~~~            ^~~~~~~~~
wolfcrypt/test/test.c:33711:34: note: did you mean to provide an explicit length?
    XMEMSET(plaintext, 0, sizeof(plaintext));
                                 ^~~~~~~~~
wolfcrypt/test/test.c:33711:34: warning: 'XMEMSET' call operates on objects of type 'byte' (aka 'unsigned char') while the size is based on a different type 'byte *' (aka 'unsigned char *') [-Wsizeof-pointer-memaccess]
    XMEMSET(plaintext, 0, sizeof(plaintext));
            ~~~~~~~~~            ^~~~~~~~~
wolfcrypt/test/test.c:33711:34: note: did you mean to provide an explicit length?
    XMEMSET(plaintext, 0, sizeof(plaintext));
                                 ^~~~~~~~~
1 warning generated.
1 warning generated.```

==87146==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1024 byte(s) in 1 object(s) allocated from:
#0 0x55f8bcd2c47e in __interceptor_malloc (/tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/testsuite/.libs/testsuite.test+0x13547e) (BuildId: 13c35a83200b732a78737f27851e791d826dce10)
#1 0x55f8bcd85de1 in aes_test /tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/wolfcrypt/test/test.c:13679:23
#2 0x55f8bcd6823a in wolfcrypt_test /tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/wolfcrypt/test/test.c:1878:17
#3 0x7fdcfca29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
Direct leak of 1024 byte(s) in 1 object(s) allocated from:
#0 0x55f8bcd2c47e in __interceptor_malloc (/tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/testsuite/.libs/testsuite.test+0x13547e) (BuildId: 13c35a83200b732a78737f27851e791d826dce10)
#1 0x55f8bcd85df6 in aes_test /tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/wolfcrypt/test/test.c:13687:23
#2 0x55f8bcd6823a in wolfcrypt_test /tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/wolfcrypt/test/test.c:1878:17
#3 0x7fdcfca29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16


==62623==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 848 byte(s) in 1 object(s) allocated from:
#0 0x55bf1024f79e in __interceptor_malloc (/tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/testsuite/.libs/testsuite.test+0xd379e) (BuildId: 1f797b810164a3f230806b46f6a1924cba65f62b)
#1 0x55bf1029cbfc in aes_test /tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/wolfcrypt/test/test.c:13679:23
#2 0x55bf1028ad99 in wolfcrypt_test /tmp/workspace/PRB-fsanitize-addr-v3/wolfssl/wolfcrypt/test/test.c:1878:17
#3 0x7fa962229d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

* Adds RNG, ECC(ECIES and ECDHE), RSA, ED25519/Curve25519, AES-GCM, and Hashing to the CSharp wrapper.
* Adds GitHub action for building the CSharp wrapper solution and running wolfCrypt test and a TLS server/client example.
* Adds "new" API's for wolfCrypt for platforms that cannot tolerate the structs directly.
* Fixes for several scan-build warnings.
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.

6 participants