Skip to content

Commit cc16063

Browse files
committed
Merge remote-tracking branch 'upstream/master' into support-xof-squeeze
2 parents 769f0b2 + 538a5cb commit cc16063

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+549
-319
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
# Remember to also update `--rust-target` in `openssl-sys/build/run_bindgen.rs`
6363
- uses: sfackler/actions/rustup@master
6464
with:
65-
version: 1.56.0
65+
version: 1.63.0
6666
- run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT
6767
id: rust-version
6868
- uses: actions/cache@v4
@@ -72,8 +72,6 @@ jobs:
7272
restore-keys: |
7373
index-${{ runner.os }}-
7474
- run: cargo generate-lockfile
75-
- run: |
76-
cargo update -p cc --precise 1.0.94
7775
- uses: actions/cache@v4
7876
with:
7977
path: ~/.cargo/registry/cache
@@ -155,22 +153,26 @@ jobs:
155153
version: e23fe9b6eecc10e4f9ea1f0027fea5eaee7bd6b6
156154
- name: openssl
157155
version: vendored
156+
- name: openssl
157+
version: 3.4.0-beta1
158158
- name: openssl
159159
version: 3.3.0
160160
- name: openssl
161161
version: 3.2.0
162-
dl-path: /
163162
- name: openssl
163+
old: true
164164
version: 1.1.1w
165-
dl-path: /
166165
- name: openssl
167166
version: 1.1.0l
167+
old: true
168168
dl-path: /old/1.1.0
169169
- name: openssl
170170
version: 1.0.2u
171+
old: true
171172
dl-path: /old/1.0.2
172173
- name: openssl
173174
version: 1.0.1u
175+
old: true
174176
dl-path: /old/1.0.1
175177
include:
176178
- target: x86_64-unknown-linux-gnu
@@ -182,17 +184,17 @@ jobs:
182184
bindgen: true
183185
library:
184186
name: libressl
185-
version: 3.7.3
187+
version: 3.8.4
186188
- target: x86_64-unknown-linux-gnu
187189
bindgen: true
188190
library:
189191
name: libressl
190-
version: 3.8.3
192+
version: 3.9.2
191193
- target: x86_64-unknown-linux-gnu
192194
bindgen: true
193195
library:
194196
name: libressl
195-
version: 3.9.1
197+
version: 4.0.0
196198
- target: x86_64-unknown-linux-gnu
197199
bindgen: false
198200
library:
@@ -202,17 +204,17 @@ jobs:
202204
bindgen: false
203205
library:
204206
name: libressl
205-
version: 3.7.3
207+
version: 3.8.4
206208
- target: x86_64-unknown-linux-gnu
207209
bindgen: false
208210
library:
209211
name: libressl
210-
version: 3.8.3
212+
version: 3.9.2
211213
- target: x86_64-unknown-linux-gnu
212214
bindgen: false
213215
library:
214216
name: libressl
215-
version: 3.9.1
217+
version: 4.0.0
216218
name: ${{ matrix.target }}-${{ matrix.library.name }}-${{ matrix.library.version }}-${{ matrix.bindgen }}
217219
runs-on: ubuntu-latest
218220
env:
@@ -257,7 +259,11 @@ jobs:
257259
run: |
258260
case "${{ matrix.library.name }}" in
259261
"openssl")
260-
url="https://www.openssl.org/source${{ matrix.library.dl-path }}/openssl-${{ matrix.library.version }}.tar.gz"
262+
if [[ "${{ matrix.library.old }}" == "true" ]]; then
263+
url="https://www.openssl.org/source${{ matrix.library.dl-path }}/openssl-${{ matrix.library.version }}.tar.gz"
264+
else
265+
url="https://github.com/openssl/openssl/releases/download/openssl-${{ matrix.library.version }}/openssl-${{ matrix.library.version }}.tar.gz"
266+
fi
261267
tar_flags="--strip-components=1"
262268
;;
263269
"libressl")

.rustfmt.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# this project uses the default rustfmt settings

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[workspace]
2+
resolver = "2"
23
members = [
34
"openssl",
45
"openssl-errors",

openssl-errors/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
name = "openssl-errors"
33
version = "0.2.0"
44
authors = ["Steven Fackler <sfackler@gmail.com>"]
5-
edition = "2018"
5+
edition = "2021"
66
license = "MIT OR Apache-2.0"
77
description = "Custom error library support for the openssl crate."
88
repository = "https://github.com/sfackler/rust-openssl"
99
readme = "README.md"
1010
categories = ["api-bindings"]
11+
rust-version = "1.63.0"
1112

1213
[dependencies]
1314
cfg-if = "1.0"

openssl-macros/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[package]
22
name = "openssl-macros"
33
version = "0.1.1"
4-
edition = "2018"
4+
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
description = "Internal macros used by the openssl crate."
77
repository = "https://github.com/sfackler/rust-openssl"
8+
rust-version = "1.63.0"
89

910
[lib]
1011
proc-macro = true

openssl-sys/CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
## [Unreleased]
44

5+
## [v0.9.104] - 2024-10-15
6+
7+
### Added
8+
9+
* Added support for LibreSSL 4.0.x.
10+
* Added `EVP_KDF_*` and `EVP_KDF_CTX_*` bindings.
11+
* Added `EVP_DigestSqueeze`.
12+
* Added `OSSL_PARAM_construct_octet_string`.
13+
* Added `OSSL_set_max_threads` and `OSSL_get_max_threads`.
14+
15+
### Changed
16+
17+
* `openssl-sys` is now a 2021 edition crate
18+
* Explicitly specify the MSRV in `Cargo.toml`
19+
* Raised the `bindgen` (optional) dependency from 0.65 to 0.69
20+
521
## [v0.9.103] - 2024-07-20
622

723
### Added
@@ -607,7 +623,8 @@ Fixed builds against OpenSSL built with `no-cast`.
607623
* Added `X509_verify` and `X509_REQ_verify`.
608624
* Added `EVP_MD_type` and `EVP_GROUP_get_curve_name`.
609625

610-
[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.103..master
626+
[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.104..master
627+
[v0.9.104]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.103...openssl-sys-v0.9.104
611628
[v0.9.103]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.102...openssl-sys-v0.9.103
612629
[v0.9.102]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.101...openssl-sys-v0.9.102
613630
[v0.9.101]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.100...openssl-sys-v0.9.101

openssl-sys/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "openssl-sys"
3-
version = "0.9.103"
3+
version = "0.9.104"
44
authors = [
55
"Alex Crichton <alex@alexcrichton.com>",
66
"Steven Fackler <sfackler@gmail.com>",
@@ -12,7 +12,8 @@ readme = "README.md"
1212
categories = ["cryptography", "external-ffi-bindings"]
1313
links = "openssl"
1414
build = "build/main.rs"
15-
edition = "2018"
15+
edition = "2021"
16+
rust-version = "1.63.0"
1617

1718
[features]
1819
vendored = ['openssl-src']
@@ -23,7 +24,7 @@ libc = "0.2"
2324
bssl-sys = { version = "0.1.0", optional = true }
2425

2526
[build-dependencies]
26-
bindgen = { version = "0.65.0", optional = true, features = ["experimental"] }
27+
bindgen = { version = "0.69.0", optional = true, features = ["experimental"] }
2728
cc = "1.0.61"
2829
openssl-src = { version = "300.2.0", optional = true, features = ["legacy"] }
2930
pkg-config = "0.3.9"

openssl-sys/build/cfgs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
7171
} else {
7272
let openssl_version = openssl_version.unwrap();
7373

74+
if openssl_version >= 0x3_04_00_00_0 {
75+
cfgs.push("ossl340");
76+
}
7477
if openssl_version >= 0x3_03_00_00_0 {
7578
cfgs.push("ossl330");
7679
}

openssl-sys/build/find_normal.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,21 @@ fn find_openssl_dir(target: &str) -> OsString {
102102
return OsString::from("/usr/local");
103103
}
104104

105+
let msg_header =
106+
"Could not find directory of OpenSSL installation, and this `-sys` crate cannot
107+
proceed without this knowledge. If OpenSSL is installed and this crate had
108+
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
109+
compilation process.";
110+
111+
println!(
112+
"cargo:warning={} See stderr section below for further information.",
113+
msg_header.replace('\n', " ")
114+
);
115+
105116
let mut msg = format!(
106117
"
107118
108-
Could not find directory of OpenSSL installation, and this `-sys` crate cannot
109-
proceed without this knowledge. If OpenSSL is installed and this crate had
110-
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
111-
compilation process.
119+
{}
112120
113121
Make sure you also have the development packages of openssl installed.
114122
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
@@ -122,6 +130,7 @@ $TARGET = {}
122130
openssl-sys = {}
123131
124132
",
133+
msg_header,
125134
host,
126135
target,
127136
env!("CARGO_PKG_VERSION")
@@ -187,7 +196,8 @@ https://github.com/sfackler/rust-openssl#windows
187196
);
188197
}
189198

190-
panic!("{}", msg);
199+
eprintln!("{}", msg);
200+
std::process::exit(101); // same as panic previously
191201
}
192202

193203
/// Attempt to find OpenSSL through pkg-config.
@@ -212,7 +222,7 @@ fn try_pkg_config() {
212222
{
213223
Ok(lib) => lib,
214224
Err(e) => {
215-
println!("run pkg_config fail: {:?}", e);
225+
println!("\n\nCould not find openssl via pkg-config:\n{}\n", e);
216226
return;
217227
}
218228
};

openssl-sys/build/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ fn main() {
120120
println!("cargo:rustc-check-cfg=cfg(ossl310)");
121121
println!("cargo:rustc-check-cfg=cfg(ossl320)");
122122
println!("cargo:rustc-check-cfg=cfg(ossl330)");
123+
println!("cargo:rustc-check-cfg=cfg(ossl340)");
123124

124125
check_ssl_kind();
125126

@@ -379,6 +380,8 @@ See rust-openssl documentation for more information:
379380
(3, 8, _) => ('3', '8', 'x'),
380381
(3, 9, 0) => ('3', '9', '0'),
381382
(3, 9, _) => ('3', '9', 'x'),
383+
(4, 0, 0) => ('4', '0', '0'),
384+
(4, 0, _) => ('4', '0', 'x'),
382385
_ => version_error(),
383386
};
384387

@@ -421,7 +424,7 @@ fn version_error() -> ! {
421424
"
422425
423426
This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3), or LibreSSL 2.5
424-
through 3.9.x, but a different version of OpenSSL was found. The build is now aborting
427+
through 4.0.x, but a different version of OpenSSL was found. The build is now aborting
425428
due to this version mismatch.
426429
427430
"

openssl-sys/build/run_bindgen.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ const INCLUDES: &str = "
6363
#if defined(LIBRESSL_VERSION_NUMBER) || defined(OPENSSL_IS_BORINGSSL)
6464
#include <openssl/poly1305.h>
6565
#endif
66+
67+
#if OPENSSL_VERSION_NUMBER >= 0x30200000
68+
#include <openssl/thread.h>
69+
#endif
6670
";
6771

6872
#[cfg(feature = "bindgen")]

openssl-sys/src/evp.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,28 @@ cfg_if! {
184184
pub const EVP_PKEY_OP_DERIVE: c_int = 1 << 10;
185185
}
186186
}
187+
#[cfg(ossl340)]
188+
pub const EVP_PKEY_OP_SIGNMSG: c_int = 1 << 14;
189+
#[cfg(ossl340)]
190+
pub const EVP_PKEY_OP_VERIFYMSG: c_int = 1 << 15;
187191

188-
pub const EVP_PKEY_OP_TYPE_SIG: c_int = EVP_PKEY_OP_SIGN
189-
| EVP_PKEY_OP_VERIFY
190-
| EVP_PKEY_OP_VERIFYRECOVER
191-
| EVP_PKEY_OP_SIGNCTX
192-
| EVP_PKEY_OP_VERIFYCTX;
192+
cfg_if! {
193+
if #[cfg(ossl340)] {
194+
pub const EVP_PKEY_OP_TYPE_SIG: c_int = EVP_PKEY_OP_SIGN
195+
| EVP_PKEY_OP_SIGNMSG
196+
| EVP_PKEY_OP_VERIFY
197+
| EVP_PKEY_OP_VERIFYMSG
198+
| EVP_PKEY_OP_VERIFYRECOVER
199+
| EVP_PKEY_OP_SIGNCTX
200+
| EVP_PKEY_OP_VERIFYCTX;
201+
} else {
202+
pub const EVP_PKEY_OP_TYPE_SIG: c_int = EVP_PKEY_OP_SIGN
203+
| EVP_PKEY_OP_VERIFY
204+
| EVP_PKEY_OP_VERIFYRECOVER
205+
| EVP_PKEY_OP_SIGNCTX
206+
| EVP_PKEY_OP_VERIFYCTX;
207+
}
208+
}
193209

194210
pub const EVP_PKEY_OP_TYPE_CRYPT: c_int = EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT;
195211

openssl-sys/src/handwritten/conf.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
use super::super::*;
22

3+
const_ptr_api! {
4+
extern "C" {
5+
pub fn NCONF_new(meth: #[const_ptr_if(libressl400)] CONF_METHOD) -> *mut CONF;
6+
}
7+
}
8+
39
extern "C" {
4-
pub fn NCONF_new(meth: *mut CONF_METHOD) -> *mut CONF;
10+
#[cfg(not(libressl400))]
511
pub fn NCONF_default() -> *mut CONF_METHOD;
612
pub fn NCONF_free(conf: *mut CONF);
713
}

openssl-sys/src/handwritten/kdf.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ cfg_if! {
2121
info: *const u8,
2222
infolen: c_int,
2323
) -> c_int;
24+
pub fn EVP_KDF_CTX_new(kdf: *mut EVP_KDF) -> *mut EVP_KDF_CTX;
25+
pub fn EVP_KDF_CTX_free(ctx: *mut EVP_KDF_CTX);
26+
pub fn EVP_KDF_CTX_reset(ctx: *mut EVP_KDF_CTX);
27+
pub fn EVP_KDF_CTX_get_kdf_size(ctx: *mut EVP_KDF_CTX) -> size_t;
28+
pub fn EVP_KDF_derive(ctx: *mut EVP_KDF_CTX, key: *mut u8, keylen: size_t, params: *const OSSL_PARAM) -> c_int;
29+
pub fn EVP_KDF_fetch(ctx: *mut OSSL_LIB_CTX, algorithm: *const c_char, properties: *const c_char) -> *mut EVP_KDF;
30+
pub fn EVP_KDF_free(kdf: *mut EVP_KDF);
2431
}
32+
2533
}
2634
}

openssl-sys/src/handwritten/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pub use self::sha::*;
2929
pub use self::srtp::*;
3030
pub use self::ssl::*;
3131
pub use self::stack::*;
32+
#[cfg(ossl320)]
33+
pub use self::thread::*;
3234
pub use self::tls1::*;
3335
pub use self::types::*;
3436
pub use self::x509::*;
@@ -66,6 +68,8 @@ mod sha;
6668
mod srtp;
6769
mod ssl;
6870
mod stack;
71+
#[cfg(ossl320)]
72+
mod thread;
6973
mod tls1;
7074
mod types;
7175
mod x509;

openssl-sys/src/handwritten/params.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,11 @@ extern "C" {
66
pub fn OSSL_PARAM_construct_uint(key: *const c_char, buf: *mut c_uint) -> OSSL_PARAM;
77
#[cfg(ossl300)]
88
pub fn OSSL_PARAM_construct_end() -> OSSL_PARAM;
9+
#[cfg(ossl300)]
10+
pub fn OSSL_PARAM_construct_octet_string(
11+
key: *const c_char,
12+
buf: *mut c_void,
13+
bsize: size_t,
14+
) -> OSSL_PARAM;
15+
916
}

openssl-sys/src/handwritten/thread.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use super::super::*;
2+
use libc::*;
3+
4+
extern "C" {
5+
pub fn OSSL_set_max_threads(ctx: *mut OSSL_LIB_CTX, max_threads: u64) -> c_int;
6+
pub fn OSSL_get_max_threads(ctx: *mut OSSL_LIB_CTX) -> u64;
7+
}

0 commit comments

Comments
 (0)