-
Notifications
You must be signed in to change notification settings - Fork 921
Add X25519 non-blocking support and async example improvements #9721
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
dgarske
wants to merge
4
commits into
wolfSSL:master
Choose a base branch
from
dgarske:x25519_nb
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,621
−541
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4d3925d
Add X25519 non-blocking support for key gen and shared secret
dgarske e9b711e
Tests for mutual authentication
dgarske 8c30cfb
Add tests for async with static memory. Fix issue with mixed-declarat…
dgarske 78bba7e
Fix for TLS with `WOLFSSL_SMALL_CERT_VERIFY`
dgarske File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| name: Async Examples | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ 'master', 'main', 'release/**' ] | ||
| pull_request: | ||
| branches: [ '*' ] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| async_examples: | ||
| if: github.repository_owner == 'wolfssl' | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 10 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| extra_cflags: | ||
| - '' | ||
| - '-DWOLFSSL_SMALL_CERT_VERIFY' | ||
| - '-DWOLFSSL_STATIC_MEMORY' | ||
| name: Async Examples (${{ matrix.extra_cflags || 'default' }}) | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| name: Checkout wolfSSL | ||
|
|
||
| - name: Build async examples (no configure) | ||
| run: | | ||
| make -C examples/async clean | ||
| make -C examples/async EXTRA_CFLAGS="${{ matrix.extra_cflags }}" | ||
|
|
||
| - name: Run async examples | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| MIN_PENDING=100 | ||
|
|
||
| run_pair() { | ||
| local label="$1" | ||
| shift | ||
| local args="$*" | ||
| local ready="/tmp/wolfssl_async_ready_${label}" | ||
| rm -f "$ready" | ||
|
|
||
| WOLFSSL_ASYNC_READYFILE="$ready" \ | ||
| ./examples/async/async_server $args \ | ||
| > "/tmp/async_server_${label}.log" 2>&1 & | ||
| local pid=$! | ||
|
|
||
| WOLFSSL_ASYNC_READYFILE="$ready" \ | ||
| ./examples/async/async_client $args 127.0.0.1 11111 \ | ||
| > "/tmp/async_client_${label}.log" 2>&1 | ||
| local rc=$? | ||
|
|
||
| kill "$pid" >/dev/null 2>&1 || true | ||
| wait "$pid" >/dev/null 2>&1 || true | ||
|
|
||
| if [ "$rc" -ne 0 ]; then | ||
| echo "FAIL: $label (exit=$rc)" | ||
| return 1 | ||
| fi | ||
|
|
||
| # Validate WC_PENDING_E count is a proper value | ||
| local count | ||
| count=$(awk '/WC_PENDING_E count:/ {print $NF}' \ | ||
| "/tmp/async_client_${label}.log") | ||
| if [ -z "$count" ] || [ "$count" -lt "$MIN_PENDING" ]; then | ||
| echo "FAIL: $label - WC_PENDING_E count too low:" \ | ||
| "${count:-missing} (expected >= $MIN_PENDING)" | ||
| return 1 | ||
| fi | ||
| echo "PASS: $label (WC_PENDING_E: $count)" | ||
| return 0 | ||
| } | ||
|
|
||
| # TLS 1.3 | ||
| run_pair ecc_tls13 --ecc | ||
| run_pair x25519_tls13 --x25519 | ||
|
|
||
| # TLS 1.2 | ||
| run_pair ecc_tls12 --tls12 --ecc | ||
| run_pair x25519_tls12 --tls12 --x25519 | ||
|
|
||
| # TLS 1.3 mutual auth | ||
| run_pair ecc_tls13_mutual --mutual --ecc | ||
| run_pair x25519_tls13_mutual --mutual --x25519 | ||
|
|
||
| # TLS 1.2 mutual auth | ||
| run_pair ecc_tls12_mutual --mutual --tls12 --ecc | ||
| run_pair x25519_tls12_mutual --mutual --tls12 --x25519 | ||
|
|
||
|
|
||
| - name: Print async logs | ||
| if: ${{ failure() }} | ||
| run: | | ||
| for f in /tmp/async_server_*.log /tmp/async_client_*.log; do | ||
| if [ -f "$f" ]; then | ||
| echo "==> $f" | ||
| cat "$f" | ||
| fi | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| CC ?= gcc | ||
| AR ?= ar | ||
| RM ?= rm -f | ||
|
|
||
| WOLFSSL_TOP ?= $(abspath ../..) | ||
| OBJDIR ?= build | ||
|
|
||
| CFLAGS ?= -O0 -g | ||
| CFLAGS += -I. | ||
| CFLAGS += -I$(WOLFSSL_TOP) | ||
| CFLAGS += -I$(WOLFSSL_TOP)/wolfssl | ||
| CFLAGS += -I$(WOLFSSL_TOP)/wolfssl/wolfcrypt | ||
| CFLAGS += -Wall -Wextra -Wpedantic -Werror | ||
| CFLAGS += -DWOLFSSL_USER_SETTINGS | ||
| CFLAGS += -DHAVE_SYS_TIME_H | ||
| CFLAGS += -DUSE_CERT_BUFFERS_256 | ||
| CFLAGS += $(EXTRA_CFLAGS) | ||
|
|
||
| LDFLAGS ?= | ||
| LDLIBS ?= | ||
|
|
||
| TARGETS = async_client async_server | ||
|
|
||
| WOLFSSL_SRC := $(wildcard $(WOLFSSL_TOP)/src/*.c) | ||
| WOLFCRYPT_SRC := $(wildcard $(WOLFSSL_TOP)/wolfcrypt/src/*.c) | ||
| LOCAL_SRC := async_client.c async_server.c async_tls.c | ||
|
|
||
| WOLFSSL_OBJS := $(patsubst $(WOLFSSL_TOP)/%, $(OBJDIR)/%, $(WOLFSSL_SRC:.c=.o)) | ||
| WOLFCRYPT_OBJS := $(patsubst $(WOLFSSL_TOP)/%, $(OBJDIR)/%, $(WOLFCRYPT_SRC:.c=.o)) | ||
| LOCAL_OBJS := $(patsubst %.c, $(OBJDIR)/%.o, $(LOCAL_SRC)) | ||
|
|
||
| ASYNC_CLIENT_OBJS := $(OBJDIR)/async_client.o $(OBJDIR)/async_tls.o | ||
| ASYNC_SERVER_OBJS := $(OBJDIR)/async_server.o $(OBJDIR)/async_tls.o | ||
|
|
||
| all: $(TARGETS) | ||
|
|
||
| async_client: $(ASYNC_CLIENT_OBJS) $(WOLFSSL_OBJS) $(WOLFCRYPT_OBJS) | ||
| $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) | ||
|
|
||
| async_server: $(ASYNC_SERVER_OBJS) $(WOLFSSL_OBJS) $(WOLFCRYPT_OBJS) | ||
| $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) | ||
|
|
||
| $(OBJDIR)/%.o: %.c user_settings.h | ||
| @mkdir -p $(dir $@) | ||
| $(CC) $(CFLAGS) -c $< -o $@ | ||
|
|
||
| $(OBJDIR)/%.o: $(WOLFSSL_TOP)/%.c | ||
| @mkdir -p $(dir $@) | ||
| $(CC) $(CFLAGS) -c $< -o $@ | ||
|
|
||
| # Possibly empty files (avoids "warning: ISO C forbids an empty translation unit") | ||
| $(OBJDIR)/wolfcrypt/src/ecc_fp.o: CFLAGS += -Wno-pedantic | ||
| $(OBJDIR)/wolfcrypt/src/fips.o: CFLAGS += -Wno-pedantic | ||
| $(OBJDIR)/wolfcrypt/src/fips_test.o: CFLAGS += -Wno-pedantic | ||
| $(OBJDIR)/wolfcrypt/src/fipsv2.o: CFLAGS += -Wno-pedantic | ||
| $(OBJDIR)/wolfcrypt/src/selftest.o: CFLAGS += -Wno-pedantic | ||
| $(OBJDIR)/wolfcrypt/src/wolfcrypt_first.o: CFLAGS += -Wno-pedantic | ||
| $(OBJDIR)/wolfcrypt/src/wolfcrypt_last.o: CFLAGS += -Wno-pedantic | ||
|
|
||
| clean: | ||
| $(RM) -r $(OBJDIR) $(TARGETS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The macro
WC_ECC_NONBLOCK_ONLYwas removed from the known macros list, but it is still actively used in the codebase (wolfcrypt/src/ecc.c and examples/async/user_settings.h). This appears to be an accidental removal and should be restored to prevent issues with macro checking tools.