2024-09-14 16:07:45 -07:00
# LibreSSL
This is [LibreSSL Portable ](https://github.com/libressl/portable ), packaged for [Zig ](https://ziglang.org/ ).
2024-09-15 12:43:52 -07:00
## Status
This project currently builds the three main LibreSSL libraries as static libraries:
- `libcrypto` : core cryptographic routines
- `libssl` : OpenSSL 1.1 compatibility layer
- `libtls` : LibreSSL's new cryptography API
2024-11-24 17:34:34 -07:00
Operating systems and hardware architectures are supported on a best-effort basis, and patches to add additional OS/arch support are welcome. Building for Linux (`x86_64` ), macOS (`aarch64` ), and Windows (`x86_64` via `mingw64` ) is directly tested by CI.
2024-09-15 12:43:52 -07:00
2024-09-15 17:57:41 -07:00
The command-line programs `nc` , `ocspcheck` , and `openssl` are not built by default, and building them when targeting Windows is not supported. Building the command-line programs may be enabled by specifing the `-Dbuild-apps` option to `zig build`
2024-09-15 12:43:52 -07:00
## Usage
2024-09-14 16:07:45 -07:00
First, update your `build.zig.zon` :
2024-09-15 12:43:52 -07:00
```sh
2024-09-14 16:07:45 -07:00
# Initialize a `zig build` project if you haven't already
zig init
2024-11-24 17:34:34 -07:00
# replace <refname> with the version you want to use, e.g. 4.0.0
2024-09-15 12:43:52 -07:00
zig fetch --save git+https://github.com/allyourcodebase/libressl#< refname >
2024-09-14 16:07:45 -07:00
```
2024-09-15 12:43:52 -07:00
You can then use `libressl` in your `build.zig` as follows:
2024-09-14 16:07:45 -07:00
```zig
const libressl_dependency = b.dependency("libressl", .{
.target = target,
.optimize = optimize,
2024-09-15 12:43:52 -07:00
.@"enable-asm" = true, // enable assembly routines on supported platforms
2024-09-14 16:07:45 -07:00
});
2024-09-15 12:43:52 -07:00
your_exe.linkLibrary(libressl_dependency.artifact("tls")); // or "ssl", or "crypto"
2024-09-14 16:07:45 -07:00
```
2024-09-15 12:43:52 -07:00
2024-11-24 17:34:34 -07:00
## Zig Version Support Matrix
2024-09-15 12:43:52 -07:00
| Refname | LibreSSL Version | Zig `0.12.x` | Zig `0.13.x` | Zig `0.14.0-dev` |
|----------|------------------|--------------|--------------|------------------|
2024-10-03 16:14:48 -07:00
| `3.9.2+1` | `3.9.2+1` | ✅ | ✅ | ✅ |
2024-11-24 17:34:34 -07:00
| `4.0.0` | `4.0.0` | ✅ | ✅ | ✅ |