-
Notifications
You must be signed in to change notification settings - Fork 34
Fenrir fixes (2026-06-23) #70
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
Merged
JacobBarthelmeh
merged 14 commits into
wolfSSL:master
from
julek-wolfssl:fenrir/20260623
Jul 14, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c29eb67
Fix DTLS server example consuming the ClientHello before handshake (F…
julek-wolfssl 41561e7
Map WANT_READ from SSLSocket.write() to SSLWantReadError (F-3905)
julek-wolfssl d0bb56e
Map WANT_WRITE from SSLSocket.read() to SSLWantWriteError (F-3906)
julek-wolfssl 65aaef9
Map WANT_WRITE from SSLSocket.recv_into() to SSLWantWriteError (F-3907)
julek-wolfssl 99a4416
Drive DTLS handshake only until complete in I/O methods (F-4136)
julek-wolfssl 9c26572
Enable hostname verification in client example (F-5621)
julek-wolfssl 3dd1b90
Send bytes-like data verbatim in SSLSocket.write (F-5622)
julek-wolfssl 93954c9
Return None from getpeercert when peer has no certificate (F-5623)
julek-wolfssl d91cc48
Update expired test CRL
julek-wolfssl 56e3297
Skip hostname check for IP literal hosts in client example
julek-wolfssl d55a68d
Keep test_write_bytes.py source 7-bit ASCII
julek-wolfssl 0446e8c
Harden WolfSSLX509 constructor type discrimination
julek-wolfssl 89f038a
Use getaddrinfo to detect IP literals in client example
julek-wolfssl 406cceb
Keep end-to-end example test compatible with Python 2.7
julek-wolfssl 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
Some comments aren't visible on the classic Files Changed page.
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 |
|---|---|---|
| @@ -1,41 +1,42 @@ | ||
| Certificate Revocation List (CRL): | ||
| Version 2 (0x1) | ||
| Signature Algorithm: sha256WithRSAEncryption | ||
| Issuer: C = US, ST = Montana, L = Bozeman, O = Sawtooth, OU = Consulting, CN = www.wolfssl.com, emailAddress = info@wolfssl.com | ||
| Last Update: Feb 15 12:50:27 2022 GMT | ||
| Next Update: Nov 11 12:50:27 2024 GMT | ||
| Issuer: C=US, ST=Montana, L=Bozeman, O=Sawtooth, OU=Consulting, CN=www.wolfssl.com, emailAddress=info@wolfssl.com | ||
| Last Update: Nov 13 20:41:50 2025 GMT | ||
| Next Update: Aug 9 20:41:50 2028 GMT | ||
| CRL extensions: | ||
| X509v3 CRL Number: | ||
| 2 | ||
| Revoked Certificates: | ||
| Serial Number: 02 | ||
| Revocation Date: Feb 15 12:50:27 2022 GMT | ||
| Revocation Date: Nov 13 20:41:50 2025 GMT | ||
| Signature Algorithm: sha256WithRSAEncryption | ||
| 43:e6:3b:30:0e:32:53:32:a4:08:3c:e5:d5:2e:f1:ce:e9:95: | ||
| ff:ba:d6:fe:2e:59:80:f8:0a:2f:cf:1e:e0:37:fe:ca:cc:33: | ||
| 66:8b:ed:65:50:7d:44:92:d3:5c:52:9a:95:a5:9d:a5:4e:77: | ||
| 8b:b4:7f:59:c8:7a:e0:eb:34:32:ae:a1:03:99:d2:3c:c0:f4: | ||
| 7e:1c:87:4c:6c:5a:ba:0a:95:e8:a1:44:01:7b:8f:3e:a4:e3: | ||
| e8:1e:07:19:f0:09:7a:85:8f:f3:82:62:f8:1e:08:51:a3:60: | ||
| 30:5b:06:c8:a2:b3:ff:aa:28:66:ad:fe:4b:81:49:30:ef:5f: | ||
| 5d:ac:d9:ad:17:9f:2a:b6:22:d6:35:cc:9f:d9:11:26:dd:7a: | ||
| 06:35:d0:d5:c7:41:6c:52:97:8c:aa:82:5a:e5:a8:58:d4:b7: | ||
| 2b:31:84:34:15:bd:08:e4:9e:71:9e:c5:40:f8:02:a3:a0:1e: | ||
| 4f:98:72:2b:eb:9e:8a:4e:01:83:88:e5:cb:6e:3b:52:e3:a9: | ||
| 34:a1:7c:e4:79:2c:d1:e0:0b:74:22:ba:6d:cb:c3:a1:56:f9: | ||
| c9:f4:20:bf:00:49:df:6b:59:49:18:c7:75:27:8e:a1:5a:a6: | ||
| ff:f2:be:34:4a:c9:6d:6e:24:a3:1f:15:7e:34:90:b6:81:bf: | ||
| 15:80:c3:ac | ||
| Signature Value: | ||
| b7:0d:1c:78:99:1c:e8:0b:d9:33:a2:95:01:ad:cf:35:e9:86: | ||
| 28:7f:49:6b:93:76:c1:70:08:61:aa:77:57:34:af:45:82:78: | ||
| 5d:3b:7b:67:ca:b4:fb:d1:68:13:be:34:94:84:2d:65:ad:97: | ||
| 52:69:1d:67:ea:8e:a7:ff:21:0f:21:6c:8c:75:7f:c7:50:c5: | ||
| 6b:a5:fd:cd:3f:91:64:7b:5e:0f:4a:9c:c8:cd:39:a0:30:ad: | ||
| 80:27:50:e0:a7:bf:19:68:cf:6b:26:75:51:14:77:5a:62:6d: | ||
| bc:66:1a:90:f7:00:09:34:c7:d0:9d:81:f3:b5:9f:90:40:02: | ||
| 8d:3f:68:7f:0d:1d:c5:00:32:e5:cf:42:35:1c:b6:eb:02:a8: | ||
| d7:2a:a7:f3:f1:10:e2:d5:9e:41:de:2f:78:7d:7f:ad:68:06: | ||
| a0:6d:40:96:dd:35:59:4d:a0:d3:bd:2e:ba:b6:75:f8:1c:43: | ||
| b9:c0:b7:75:c4:38:59:46:00:71:ab:5a:df:f5:62:e9:ac:2b: | ||
| 76:11:4f:1b:42:2c:dd:b2:38:6e:57:cf:c5:75:67:4c:3e:27: | ||
| bb:4c:d5:09:2c:4a:13:3d:8b:9c:89:76:b7:bd:73:1b:64:50: | ||
| ea:d5:13:0e:51:48:d8:43:08:93:00:85:8f:2f:08:ad:0d:aa: | ||
| d6:6c:f8:3d | ||
| -----BEGIN X509 CRL----- | ||
| MIICBDCB7QIBATANBgkqhkiG9w0BAQsFADCBlDELMAkGA1UEB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xQAy5c9CNRy26wKo1yqn8/EQ4tWeQd4veH1/rWgGoG1Alt01 | ||
| WU2g070uurZ1+BxDucC3dcQ4WUYAcata3/Vi6awrdhFPG0Is3bI4blfPxXVnTD4n | ||
| u0zVCSxKEz2LnIl2t71zG2RQ6tUTDlFI2EMIkwCFjy8IrQ2q1mz4PQ== | ||
| -----END X509 CRL----- |
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,171 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # | ||
| # test_client_example.py | ||
| # | ||
| # Copyright (C) 2006-2020 wolfSSL Inc. | ||
| # | ||
| # This file is part of wolfSSL. (formerly known as CyaSSL) | ||
| # | ||
| # wolfSSL is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # wolfSSL is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | ||
|
|
||
| # pylint: disable=missing-docstring, invalid-name, import-error | ||
|
|
||
| import os | ||
| import socket | ||
| import subprocess | ||
| import sys | ||
| import threading | ||
|
|
||
| import wolfssl | ||
|
|
||
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "examples")) | ||
| import client as client_example # noqa: E402 | ||
|
|
||
|
|
||
| def _args(argv): | ||
| return client_example.build_arg_parser().parse_args(argv) | ||
|
|
||
|
|
||
| def _ctx(): | ||
| return wolfssl.SSLContext(wolfssl.PROTOCOL_TLSv1_2) | ||
|
|
||
|
|
||
| def test_verification_enables_hostname_check_by_default(): | ||
| """ | ||
| F-5621: with cert verification on (the default), the client must also | ||
| verify the peer's hostname and pass server_hostname to wrap_socket. | ||
| """ | ||
| args = _args(["-h", "example.com"]) | ||
| ctx = _ctx() | ||
|
|
||
| server_hostname = client_example.configure_verification(ctx, args) | ||
|
|
||
| assert ctx.verify_mode == wolfssl.CERT_REQUIRED | ||
| assert ctx.check_hostname is True | ||
| assert server_hostname == "example.com" | ||
|
|
||
|
|
||
| def test_disable_cert_check_skips_hostname(): | ||
| args = _args(["-d"]) | ||
| ctx = _ctx() | ||
| # Simulate a reused context that previously had hostname checking on: | ||
| # -d must clear it, not leave it dangling against CERT_NONE. | ||
| ctx.verify_mode = wolfssl.CERT_REQUIRED | ||
| ctx.check_hostname = True | ||
|
|
||
| server_hostname = client_example.configure_verification(ctx, args) | ||
|
|
||
| assert ctx.verify_mode == wolfssl.CERT_NONE | ||
| assert ctx.check_hostname is False | ||
| assert server_hostname is None | ||
|
|
||
|
|
||
| def test_hostname_check_can_be_opted_out(): | ||
| """An explicit opt-out is provided for test certificates.""" | ||
| args = _args(["-n"]) | ||
| ctx = _ctx() | ||
| # Reused context with hostname checking previously enabled: -n must | ||
| # actively turn it back off. | ||
| ctx.verify_mode = wolfssl.CERT_REQUIRED | ||
| ctx.check_hostname = True | ||
|
|
||
| server_hostname = client_example.configure_verification(ctx, args) | ||
|
|
||
| assert ctx.verify_mode == wolfssl.CERT_REQUIRED | ||
| assert ctx.check_hostname is False | ||
| assert server_hostname is None | ||
|
|
||
|
|
||
| def test_ip_literal_host_skips_hostname_check(): | ||
| """ | ||
| The default host (127.0.0.1) is an IP literal. wolfSSL's | ||
| check_domain_name() never matches iPAddress SANs, so the example must | ||
| not hostname-check IP literals; certificate verification stays on. | ||
| """ | ||
| args = _args([]) | ||
| ctx = _ctx() | ||
| ctx.verify_mode = wolfssl.CERT_REQUIRED | ||
| ctx.check_hostname = True | ||
|
|
||
| server_hostname = client_example.configure_verification(ctx, args) | ||
|
|
||
| assert args.h == "127.0.0.1" | ||
| assert ctx.verify_mode == wolfssl.CERT_REQUIRED | ||
| assert ctx.check_hostname is False | ||
| assert server_hostname is None | ||
|
|
||
|
|
||
| def test_ipv6_literal_host_skips_hostname_check(): | ||
| args = _args(["-h", "::1"]) | ||
| ctx = _ctx() | ||
|
|
||
| server_hostname = client_example.configure_verification(ctx, args) | ||
|
|
||
| assert ctx.verify_mode == wolfssl.CERT_REQUIRED | ||
| assert ctx.check_hostname is False | ||
| assert server_hostname is None | ||
|
|
||
|
|
||
| def _free_port(): | ||
| sock = socket.socket() | ||
| sock.bind(("localhost", 0)) | ||
| port = sock.getsockname()[1] | ||
| sock.close() | ||
| return port | ||
|
|
||
|
|
||
| def test_default_invocation_end_to_end(): | ||
| """ | ||
| `python client.py` with the default host must complete a connection to | ||
| `python server.py` using the bundled certificates: verification is on | ||
| by default and the IP literal host must not trip the hostname check. | ||
| """ | ||
| root = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) | ||
| port = _free_port() | ||
|
|
||
| # The examples must import the same wolfssl as this test process, even | ||
| # when the package is not installed (source-tree runs). | ||
| env = dict(os.environ) | ||
| pkg_root = os.path.dirname(os.path.dirname(os.path.abspath( | ||
| wolfssl.__file__))) | ||
| env["PYTHONPATH"] = os.pathsep.join( | ||
| [pkg_root] + ([env["PYTHONPATH"]] if env.get("PYTHONPATH") else [])) | ||
|
|
||
| server = subprocess.Popen( | ||
| [sys.executable, "-u", os.path.join("examples", "server.py"), | ||
| "-p", str(port)], | ||
| cwd=root, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
| try: | ||
| line = server.stdout.readline().decode() | ||
| assert "Server listening" in line, line | ||
|
|
||
| client = subprocess.Popen( | ||
| [sys.executable, "-u", os.path.join("examples", "client.py"), | ||
| "-p", str(port)], | ||
| cwd=root, env=env, stdout=subprocess.PIPE, | ||
| stderr=subprocess.STDOUT) | ||
| # Watchdog instead of communicate(timeout=...), which is 3.3+. | ||
| watchdog = threading.Timer(60, client.kill) | ||
| watchdog.start() | ||
| try: | ||
| out, _ = client.communicate() | ||
| finally: | ||
| watchdog.cancel() | ||
|
|
||
| assert client.returncode == 0, out.decode() | ||
| assert b"I hear you fa shizzle" in out | ||
| finally: | ||
| server.kill() | ||
| server.wait() |
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.
Uh oh!
There was an error while loading. Please reload this page.