Commit Graph

168 Commits (master)

Author SHA1 Message Date
David Garske f112ced76f
Merge pull request #72 from kareem-wolfssl/gplv3
Update license from GPLv2 to GPLv3.
2026-07-31 16:24:13 -07:00
Kareem 2cbf28d9e3 Use GPLv3 rather than GPLv3+. 2026-07-20 13:28:19 -07:00
Kareem a69521afa4 Update license from GPLv2 to GPLv3. 2026-07-20 10:37:26 -07:00
JacobBarthelmeh 29fc3ca101
Merge pull request #71 from kareem-wolfssl/v592
Prepare for v5.9.2 release
2026-07-16 10:19:41 -06:00
Kareem cf2455e95e Prepare for v5.9.2 release 2026-07-15 15:43:54 -07:00
JacobBarthelmeh 2e77f306c2
Merge pull request #70 from julek-wolfssl/fenrir/20260623
Fenrir fixes (2026-06-23)
2026-07-14 16:07:27 -06:00
Juliusz Sosinowicz 406cceb7ba Keep end-to-end example test compatible with Python 2.7
subprocess.run() is Python 3.5+. Use Popen with communicate() and a
threading.Timer watchdog in place of the communicate() timeout, which
is 3.3+.
2026-07-13 17:53:14 +00:00
Juliusz Sosinowicz 89f038ab7c Use getaddrinfo to detect IP literals in client example
socket.inet_pton() is missing on some supported platforms (Python 2.7
on Windows). getaddrinfo() with AI_NUMERICHOST parses without
resolving and is available everywhere. It also handles scoped IPv6
literals.
2026-07-13 17:53:14 +00:00
Juliusz Sosinowicz 0446e8c73f Harden WolfSSLX509 constructor type discrimination
Compare interned cffi type objects instead of rendered type name
strings and raise TypeError for anything that is not a WOLFSSL* or
WOLFSSL_X509*.
2026-07-13 17:35:04 +00:00
Juliusz Sosinowicz d55a68d4ab Keep test_write_bytes.py source 7-bit ASCII
Use the \u00e9 escape instead of a literal e-acute. The test still
exercises multi-byte UTF-8 encoding.
2026-07-13 17:35:04 +00:00
Juliusz Sosinowicz 56e3297edd Skip hostname check for IP literal hosts in client example
Review follow-up for F-5621. wolfSSL_check_domain_name() only matches
DNS names: on this path CheckForAltNames() is called with isIP=0, so
iPAddress SANs are always skipped (verified on v5.8.4-stable and
master). The default invocation (host 127.0.0.1) therefore failed the
handshake with DOMAIN_NAME_MISMATCH (-322) once hostname verification
was enabled by default.

Skip the hostname check for IP literal hosts and say so, keeping
CERT_REQUIRED verification. This also stops offering an IP literal in
SNI, which RFC 6066 forbids. Connecting by DNS name still enables the
hostname check.

Add unit tests for the IP literal paths and an end-to-end test that
runs server.py and client.py with default arguments.
2026-07-13 17:35:04 +00:00
Juliusz Sosinowicz d91cc48734 Update expired test CRL
The bundled CRL expired 2024-11-11, so the client example's default
CRL load (enabled unless -C) fails. Take the current CRL from wolfSSL
v5.8.4-stable certs/crl/crl.pem: same Sawtooth CA and key, revokes
only serial 02, valid until 2028-08-09.

Note: the bundled ca/server/client certs expire 2026-09-08 and will
need a refresh of their own before then.
2026-07-13 17:35:04 +00:00
Juliusz Sosinowicz 93954c9430 Return None from getpeercert when peer has no certificate (F-5623)
get_peer_x509() checked only whether the session was NULL and then built
a WolfSSLX509, whose __init__ called wolfSSL_get_peer_certificate() and
raised SSLError on NULL. On a valid connection where the peer presented
no certificate (e.g. a server not requesting a client cert), this raised
instead of returning None as the stdlib ssl getpeercert() contract
requires. Fetch the certificate in get_peer_x509(), return None when it
is NULL, and have WolfSSLX509 wrap the already-obtained pointer.
2026-06-24 12:27:57 +00:00
Juliusz Sosinowicz 3dd1b902e1 Send bytes-like data verbatim in SSLSocket.write (F-5622)
write() converted data with t2b(), which str()-encodes anything that is
not already bytes. Valid bytes-like inputs such as bytearray and
memoryview were transmitted as their Python repr ("bytearray(b'...')",
"<memory at ...>") instead of their contents, corrupting the stream.
Convert via the buffer protocol (bytes(memoryview(data))) and raise
TypeError for objects that are not bytes-like, matching the stdlib ssl
module.
2026-06-24 12:27:28 +00:00
Juliusz Sosinowicz 9c26572a41 Enable hostname verification in client example (F-5621)
The client example set CERT_REQUIRED and loaded CA roots but never set
check_hostname or passed server_hostname to wrap_socket, so wolfSSL
validated the chain to a trusted CA without binding the certificate to
the requested host. A peer presenting any CA-trusted certificate for a
different hostname would be accepted by anyone reusing this as a secure
client template. Make verification configure hostname checking by
default (via a new configure_verification helper) and add a -n flag to
opt out explicitly for IP literals or test certificates.
2026-06-24 12:26:37 +00:00
Juliusz Sosinowicz 99a4416771 Drive DTLS handshake only until complete in I/O methods (F-4136)
For DTLS, write()/read()/recv_into() called do_handshake() on every
call. do_handshake() runs wolfSSL_accept/connect, which on a
non-blocking socket can raise SSLWantReadError and abort an I/O long
after the handshake finished, and made DTLS write-side behaviour
inconsistent with TCP. Track completion with a _handshake_complete
flag set on a successful do_handshake(), and only drive the handshake
from I/O methods while that flag is False.
2026-06-23 11:33:22 +00:00
Juliusz Sosinowicz 65aaef9750 Map WANT_WRITE from SSLSocket.recv_into() to SSLWantWriteError (F-3907)
recv_into() shares read()'s error-mapping pattern and inherited the
same omission: wolfSSL_read returning WOLFSSL_ERROR_WANT_WRITE (during
a renegotiation needing a write) was reported as a generic SSLError
instead of SSLWantWriteError, breaking non-blocking callers that
distinguish readiness directions. Add the WANT_WRITE branch.
2026-06-23 11:25:08 +00:00
Juliusz Sosinowicz d0bb56e6f9 Map WANT_WRITE from SSLSocket.read() to SSLWantWriteError (F-3906)
wolfSSL_read can return WOLFSSL_ERROR_WANT_WRITE when the SSL layer
must flush a handshake record (e.g. renegotiation) before returning
data. read() only handled WANT_READ, raising a generic SSLError
otherwise, which stops non-blocking callers from select()-ing on
writability. Add a WANT_WRITE branch raising SSLWantWriteError.
2026-06-23 11:24:40 +00:00
Juliusz Sosinowicz 41561e7ba6 Map WANT_READ from SSLSocket.write() to SSLWantReadError (F-3905)
wolfSSL_write can return WOLFSSL_ERROR_WANT_READ (e.g. during a
renegotiation that must read a record before progressing; secure
renegotiation is enabled by default). write() only handled WANT_WRITE,
so WANT_READ fell through to a generic SSLError and non-blocking
callers tore the session down. Add a WANT_READ branch raising
SSLWantReadError, matching do_handshake().
2026-06-23 11:24:10 +00:00
Juliusz Sosinowicz c29eb6760b Fix DTLS server example consuming the ClientHello before handshake (F-3481)
The DTLS branch called bind_socket.recvfrom(1) before creating the
context. On UDP that removes the entire first datagram (the client's
ClientHello) from the queue and discards everything past the first
byte, so wolfSSL_accept() had nothing to consume and the handshake
only recovered after the client's retransmit timer. The captured
from_addr was also reused for every iteration of the -i loop.

Replace it with a peek_peer_address() helper that uses MSG_PEEK to read
the source address without consuming the datagram, and move the peek
into the accept loop so the address is refreshed per connection.
2026-06-23 11:22:06 +00:00
David Garske 74a340db5e
Merge pull request #66 from JeremiahM37/fenrir-fixes-2
Fenrir fixes
2026-04-14 15:18:50 -07:00
Jeremiah Mackey 7a1c3b0885 Guard shutdowns and clean up code 2026-04-14 17:10:36 +00:00
Jeremiah Mackey 2c4ba3c8d7 Fix low-severity issues 2026-04-02 16:32:27 +00:00
Jeremiah Mackey e1ede238e4 Fix wolfSSL_Init return type and check 2026-04-02 16:00:08 +00:00
Jeremiah Mackey c81c839a24 Free peer address on set_peer failure 2026-04-02 15:59:15 +00:00
Jeremiah Mackey 760cb466a7 Shutdown and free SSL in unwrap 2026-04-02 15:58:52 +00:00
Jeremiah Mackey 89667f9f7a Add null checks to version/pending 2026-04-02 15:53:32 +00:00
Jeremiah Mackey e436664616 Skip close on DTLS loop socket 2026-04-02 15:53:05 +00:00
Jeremiah Mackey 84bd6375a2 Copy DER buffer in get_der 2026-04-02 15:52:47 +00:00
Jeremiah Mackey a406dce6c3 Add DTLS handshake to recv_into 2026-04-02 15:47:36 +00:00
Jeremiah Mackey dc49a5391f Default DTLS version in client example 2026-04-02 15:44:07 +00:00
Jeremiah Mackey ffd86dea5e Add tests for recent fixes 2026-04-02 15:40:04 +00:00
David Garske 3f2cd6eca3
Merge pull request #65 from JeremiahM37/fenrir-fixes
Fenrir fixes
2026-03-19 11:33:30 -07:00
Jeremiah Mackey a86dac7917 Use shlex.split in build call() 2026-03-19 16:24:26 +00:00
Jeremiah Mackey 63b1ee8d17 Enforce CERT_REQUIRED for check_hostname 2026-03-19 16:02:17 +00:00
Jeremiah Mackey e15bf07408 Null native_object after CTX_free 2026-03-19 15:52:11 +00:00
Jeremiah Mackey 5e77b6cbcb Check wolfSSL_write return value 2026-03-19 15:51:03 +00:00
Jeremiah Mackey 40b35a4e36 Free X509 in WolfSSLX509.__del__ 2026-03-19 15:46:53 +00:00
Jeremiah Mackey c5ed261a4e Return None from get_peer_x509 2026-03-19 15:46:06 +00:00
Jeremiah Mackey ad2f7c6046 Fix wrong alert description function 2026-03-19 15:45:34 +00:00
Jeremiah Mackey 9a73852678 Check wolfSSL_check_domain_name return 2026-03-19 15:41:42 +00:00
Jeremiah Mackey 08737fab72 Fix wrap_socket server_side mismatch 2026-03-19 15:40:31 +00:00
David Garske 480f7bc237
Merge pull request #64 from cconlon/ffiFixes
Fix static-only wolfSSL linking, improve FFI import errors, and fix make dist
2026-03-17 12:41:10 -07:00
Chris Conlon 26c0151670 Fix make dist target referencing missing scripts 2026-03-02 15:54:52 -07:00
Chris Conlon a6c28b9183 Fix USE_LOCAL_WOLFSSL with static-only builds and add .dylib support 2026-03-02 15:54:52 -07:00
Chris Conlon 8b3adf3023 Fix silent NameError when CFFI bindings are missing, adds _FFIPlaceholder that raises ImportError with instructions 2026-03-02 15:54:48 -07:00
David Garske 05433e92b6
Merge pull request #63 from kareem-wolfssl/v5.8.4
Prepare for v5.8.4 release
2025-12-29 17:20:39 -08:00
Kareem 0073fec796 Prepare for v5.8.4 release 2025-12-29 16:37:31 -07:00
lealem47 45a4151d02
Merge pull request #62 from kareem-wolfssl/verifyMode
Fix CERT_REQUIRED verify mode not setting SSL_VERIFY_FAIL_IF_NO_PEER_CERT and therefore failing to verify the client cert.
2025-12-17 10:17:21 -07:00
Kareem f4c6d17d7d Add testing to confirm that the server fails as expected if CERT_REQUIRED is set and the client doesn't send a cert. 2025-12-16 14:51:28 -07:00