Skip to content

Add UDP support to NetX sockets for DTLS sessions#10273

Closed
hmohide wants to merge 2 commits intowolfSSL:masterfrom
hmohide:master
Closed

Add UDP support to NetX sockets for DTLS sessions#10273
hmohide wants to merge 2 commits intowolfSSL:masterfrom
hmohide:master

Conversation

@hmohide
Copy link
Copy Markdown

@hmohide hmohide commented Apr 21, 2026

Description

Add UDP support to NetX sockets for DTLS sessions

Fixes zd#

  1. src/internal.c
  2. src/wolfio.c
  3. wolfssl/internal.h
  4. wolfssl/wolfio.h

Testing

Yes, verified the DTLS communication with multiple session

Checklist

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

@wolfSSL-Bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@kareem-wolfssl
Copy link
Copy Markdown
Contributor

OK to test. Contributor agreement on file.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

MemBrowse Memory Report

gcc-arm-cortex-m4

  • FLASH: .rodata.CSWTCH.1 +40 B, .rodata.str1.1 +491 B, .rodata.wolfSSL_ERR_reason_error_string.str1.1 +29 B, .text +896 B (+0.7%, 196,859 B / 262,144 B, total: 75% used)
  • RAM: .bss +8 B (+1.0%, 828 B / 65,536 B, total: 1% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +768 B (+1.2%, 64,307 B / 262,144 B, total: 25% used)
  • RAM: .bss +4 B (+0.6%, 644 B / 65,536 B, total: 1% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +704 B (+1.2%, 59,893 B / 262,144 B, total: 23% used)
  • RAM: .bss +4 B (+0.6%, 668 B / 65,536 B, total: 1% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +832 B (+0.7%, 120,314 B / 262,144 B, total: 46% used)
  • RAM: .bss +8 B (+1.0%, 808 B / 65,536 B, total: 1% used)

@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

JacobBarthelmeh commented Apr 24, 2026

@hmohide ThreadX/NetX build failure:

In file included from ./wolfssl/ssl.h:277,
                 from ./wolfssl/internal.h:28,
                 from wolfcrypt/src/asn.c:303:
./wolfssl/wolfio.h:796:41: error: unknown type name 'UINT16'; did you mean 'UINT'?
  796 |                                         UINT16* nxport,
      |                                         ^~~~~~
      |                                         UINT
./wolfssl/internal.h:5689:9: error: unknown type name 'UINT16'
 5689 |         UINT16*        nxPort;      /* Port number for udp recv*/
      |         ^~~~~~
  CC       wolfcrypt/src/src_libwolfssl_la-pkcs12.lo

@hmohide
Copy link
Copy Markdown
Author

hmohide commented Apr 27, 2026

@hmohide ThreadX/NetX build failure:

In file included from ./wolfssl/ssl.h:277,
                 from ./wolfssl/internal.h:28,
                 from wolfcrypt/src/asn.c:303:
./wolfssl/wolfio.h:796:41: error: unknown type name 'UINT16'; did you mean 'UINT'?
  796 |                                         UINT16* nxport,
      |                                         ^~~~~~
      |                                         UINT
./wolfssl/internal.h:5689:9: error: unknown type name 'UINT16'
 5689 |         UINT16*        nxPort;      /* Port number for udp recv*/
      |         ^~~~~~
  CC       wolfcrypt/src/src_libwolfssl_la-pkcs12.lo

UINT16 is platform specific definition. Can change to USHORT which is NetX Standard type

@hmohide
Copy link
Copy Markdown
Author

hmohide commented Apr 27, 2026

@hmohide ThreadX/NetX build failure:

In file included from ./wolfssl/ssl.h:277,
                 from ./wolfssl/internal.h:28,
                 from wolfcrypt/src/asn.c:303:
./wolfssl/wolfio.h:796:41: error: unknown type name 'UINT16'; did you mean 'UINT'?
  796 |                                         UINT16* nxport,
      |                                         ^~~~~~
      |                                         UINT
./wolfssl/internal.h:5689:9: error: unknown type name 'UINT16'
 5689 |         UINT16*        nxPort;      /* Port number for udp recv*/
      |         ^~~~~~
  CC       wolfcrypt/src/src_libwolfssl_la-pkcs12.lo

@hmohide ThreadX/NetX build failure:

In file included from ./wolfssl/ssl.h:277,
                 from ./wolfssl/internal.h:28,
                 from wolfcrypt/src/asn.c:303:
./wolfssl/wolfio.h:796:41: error: unknown type name 'UINT16'; did you mean 'UINT'?
  796 |                                         UINT16* nxport,
      |                                         ^~~~~~
      |                                         UINT
./wolfssl/internal.h:5689:9: error: unknown type name 'UINT16'
 5689 |         UINT16*        nxPort;      /* Port number for udp recv*/
      |         ^~~~~~
  CC       wolfcrypt/src/src_libwolfssl_la-pkcs12.lo

UINT16 is platform specific definition. Can change to USHORT which is NetX Standard type

Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

[check-source-text] [1 of 1] [f9b24de017]
    autogen.sh f9b24de017...   real 0m7.640s  user 0m6.265s  sys 0m0.425s
    configure...   real 0m8.328s  user 0m5.160s  sys 0m3.954s
trailing whitespace:
./src/wolfio.c:2655:    if (nxCtx == NULL || nxCtx->nxUdpSocket == NULL·
./src/wolfio.c:2683:        }·
./src/wolfio.c:2691:        }·
./src/wolfio.c:2709:        ssl->nxCtx.nxUdpSocket              = nxsocket;··
./wolfssl/wolfio.h:794:    WOLFSSL_API void wolfSSL_SetIO_NetX_Dtls(WOLFSSL* ssl, NX_UDP_SOCKET* nxsocket,·
./wolfssl/wolfio.h:795:                                        NXD_ADDRESS *nxdip,·
./wolfssl/wolfio.h:796:                                        USHORT* nxport,·
    [skipping "codespell" subtest in check-source-text -- codespell is missing or too old]
overlong lines added:
linuxkm/lkcapi_sha_glue.c:1514             ((struct DRBG_internal *)WC_RNG_BANK_INST_TO_RNG(drbg)->drbg)->V[V_offset++] += ((byte *)buf)[i];
linuxkm/lkcapi_sha_glue.c:1515             if (V_offset == (int)sizeof ((struct DRBG_internal *)WC_RNG_BANK_INST_TO_RNG(drbg)->drbg)->V)
src/wolfio.c:2678         status = nx_udp_socket_send(nxCtx->nxUdpSocket, packet, nxCtx->nxdIp->nxd_ip_address.v4, (UINT)(*nxCtx->nxPort));
src/wolfio.c:2686         status = nxd_udp_socket_send(nxCtx->nxUdpSocket, packet, nxCtx->nxdIp, (UINT)(*nxCtx->nxPort));
src/wolfio.c:2706 void wolfSSL_SetIO_NetX_Dtls(WOLFSSL* ssl, NX_UDP_SOCKET* nxsocket, NXD_ADDRESS *nxdip, USHORT *nxport, ULONG waitoption)
wolfcrypt/src/random.c:443 static int Hash_DRBG_Reseed(DRBG_internal* drbg, const byte* seed, word32 seedSz)
wolfcrypt/src/random.c:757 static int Hash_DRBG_Instantiate(DRBG_internal* drbg, const byte* seed, word32 seedSz,
wolfcrypt/src/random.c:1591         if (Hash_DRBG_Uninstantiate((DRBG_internal *)rng->drbg_scratch) != DRBG_SUCCESS)
wolfcrypt/src/rng_bank.c:485                     (((struct DRBG_internal *)(*rng_inst)->rng.drbg)->reseedCtr >=
wolfssl/wolfio.h:789     WOLFSSL_LOCAL int NetX_ReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *ctx);
[...and more...]

@dgarske
Copy link
Copy Markdown
Member

dgarske commented May 5, 2026

Hi @hmohide you opened this on your local master instead of a different branch, which causes some issues. Would you mind closing this PR and opening a new one against latest upstream master with a better local fork branch name? Thanks

@dgarske dgarske closed this May 5, 2026
@hmohide
Copy link
Copy Markdown
Author

hmohide commented May 6, 2026

@dgarske i am unable to create the fork. Can you guide me.

@hmohide
Copy link
Copy Markdown
Author

hmohide commented May 6, 2026

@dgarske i created the pull request with new fork. #10408

Hope this is sufficient

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.

5 participants