Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
wolfcrypt-tls-futures-io
Async TLS for smol, async-std,
and any runtime using futures::io, backed by
wolfSSL.
TlsStream<IO> implements futures::io::AsyncRead + AsyncWrite.
For tokio, use wolfcrypt-tls-tokio instead.
Why
The same reasons to choose wolfcrypt-tls for blocking I/O apply here — FIPS
140-3 validation, small footprint, no OpenSSL — but for async Rust with
futures::io:
- FIPS 140-3 — the only
futures::ioTLS crate backed by a FIPS-validated crypto module (commercial license; contact wolfSSL) - futures-rustls-compatible API —
TlsConnector/TlsAcceptor/TlsStream<IO>have the same shapes; swap the import and adjust the config builder - No
spawn_blocking— wolfSSL runs inline in the async task over in-memory buffers; one connection does not consume one OS thread
Usage
[]
= "0.1"
= "2" # or async-std, async-executor, etc.
TLS client
use Arc;
use Async;
use TcpStream;
use ;
let mut roots = new;
roots.add_pem;
let config = new;
let stream = connect.await?;
let mut tls = from.connect?.await?;
tls.write_all.await?;
connect() returns Result<Connect<IO>>; the ? checks for config errors and
the .await? drives the handshake to completion.
TLS server
use Arc;
use Async;
use ;
use ;
let config = new;
let acceptor = from;
let listener = bind?;
loop
Mutual TLS (mTLS)
// Server — require a client certificate
let config = builder
.with_certificate_chain
.with_client_auth
.build?;
// Client — present a certificate
let config = builder
.with_root_certificates
.with_client_auth
.build?;
How it works
wolfssl-src Compiles wolfSSL C source
│
wolfcrypt-sys bindgen FFI bindings
│
wolfcrypt-tls Config types, cert/key loading (lib.name = "wolfssl")
│
wolfcrypt-tls-futures-io TlsConnector / TlsAcceptor / TlsStream ← this crate
│
futures-io AsyncRead, AsyncWrite
Instead of wolfSSL_set_fd, the crate drives wolfSSL through custom IO
callbacks over two in-memory byte buffers (net_in / net_out):
┌───────────────────────────────────┐
│ TlsStream<IO> │
poll_read ◄───────┤ read_buf (decrypted plaintext) │
poll_write ───────►│ wolfSSL session │
│ recv_cb ◄── net_in │
│ send_cb ──► net_out │
network IO ◄───────┤ flush net_out / fill net_in ─────►│ network IO
(cipher) └───────────────────────────────────┘ (cipher)
The callbacks are synchronous and never block. All real async network I/O
happens in poll_read / poll_write around the wolfSSL calls — the same
architecture as futures-rustls.
Config types (TlsClientConfig, TlsServerConfig, Certificate,
PrivateKey, RootCertStore, ProtocolVersion) are re-exported from
wolfcrypt-tls. The session logic and buffer architecture are identical to
wolfcrypt-tls-tokio; only the IO trait family differs.
| Feature | Description |
|---|---|
vendored |
Compile wolfSSL from source (passes through to wolfcrypt-tls) |
fips |
Enable the wolfSSL FIPS 140-3 code path (commercial license required) |
References
- wolfSSL documentation
- wolfcrypt-tls — blocking API and config types
- wolfcrypt-tls-tokio — tokio variant
- workspace README
Copyright
Copyright (C) 2006-2026 wolfSSL Inc.
License
GPL-3.0-only OR LicenseRef-wolfSSL-commercial.
The underlying wolfSSL C library is licensed under GPL-3.0-or-later with a commercial option available from wolfSSL Inc.