Skip to content

Commit d1a12e2

Browse files
committed
Fixed two UAFs and bumped versions for release
1 parent 7c7b2e6 commit d1a12e2

File tree

7 files changed

+53
-11
lines changed

7 files changed

+53
-11
lines changed

openssl-sys/CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [Unreleased]
44

5+
## [v0.9.107] - 2025-04-04
6+
7+
### Added
8+
9+
* Support for building with AWS-LC.
10+
511
## [v0.9.106] - 2025-02-15
612

713
### Added
@@ -636,7 +642,8 @@ Fixed builds against OpenSSL built with `no-cast`.
636642
* Added `X509_verify` and `X509_REQ_verify`.
637643
* Added `EVP_MD_type` and `EVP_GROUP_get_curve_name`.
638644

639-
[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.106..master
645+
[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.107..master
646+
[v0.9.107]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.106...openssl-sys-v0.9.107
640647
[v0.9.106]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.105...openssl-sys-v0.9.106
641648
[v0.9.105]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.104...openssl-sys-v0.9.105
642649
[v0.9.104]: https://github.com/sfackler/rust-openssl/compare/openssl-sys-v0.9.103...openssl-sys-v0.9.104

openssl-sys/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "openssl-sys"
3-
version = "0.9.106"
3+
version = "0.9.107"
44
authors = [
55
"Alex Crichton <[email protected]>",
66
"Steven Fackler <[email protected]>",

openssl/CHANGELOG.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
## [Unreleased]
44

5+
## [v0.10.72] - 2025-04-04
6+
7+
### Fixed
8+
9+
* Fixed use-after-free in `Md::fetch` and `Cipher::fetch` when `properties` is `Some(...)`. In practice this use-after-free most likely resulted in OpenSSL treating the `properties` as `b""`.
10+
11+
### Added
12+
13+
* Support for building with AWS-LC.
14+
515
## [v0.10.71] - 2025-02-15
616

717
### Added
@@ -959,7 +969,8 @@
959969

960970
Look at the [release tags] for information about older releases.
961971

962-
[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.71...master
972+
[Unreleased]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.72...master
973+
[v0.10.72]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.71...openssl-v0.10.72
963974
[v0.10.71]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.70...openssl-v0.10.71
964975
[v0.10.70]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.69...openssl-v0.10.70
965976
[v0.10.69]: https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.68...openssl-v0.10.69

openssl/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "openssl"
3-
version = "0.10.71"
3+
version = "0.10.72"
44
authors = ["Steven Fackler <[email protected]>"]
55
license = "Apache-2.0"
66
description = "OpenSSL bindings"
@@ -32,7 +32,7 @@ libc = "0.2"
3232
once_cell = "1.5.2"
3333

3434
openssl-macros = { version = "0.1.1", path = "../openssl-macros" }
35-
ffi = { package = "openssl-sys", version = "0.9.106", path = "../openssl-sys" }
35+
ffi = { package = "openssl-sys", version = "0.9.107", path = "../openssl-sys" }
3636

3737
[dev-dependencies]
3838
hex = "0.4"

openssl/src/cipher.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl Cipher {
146146
let ptr = cvt_p(ffi::EVP_CIPHER_fetch(
147147
ctx.map_or(ptr::null_mut(), ForeignTypeRef::as_ptr),
148148
algorithm.as_ptr(),
149-
properties.map_or(ptr::null_mut(), |s| s.as_ptr()),
149+
properties.as_ref().map_or(ptr::null_mut(), |s| s.as_ptr()),
150150
))?;
151151

152152
Ok(Cipher::from_ptr(ptr))
@@ -595,3 +595,15 @@ impl CipherRef {
595595
unsafe { EVP_CIPHER_block_size(self.as_ptr()) as usize }
596596
}
597597
}
598+
599+
#[cfg(test)]
600+
mod test {
601+
#[cfg(ossl300)]
602+
use super::Cipher;
603+
604+
#[test]
605+
#[cfg(ossl300)]
606+
fn test_cipher_fetch_properties() {
607+
assert!(Cipher::fetch(None, "AES-128-GCM", Some("provider=gibberish")).is_err());
608+
}
609+
}

openssl/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@
6060
//! override the automatic detection logic.
6161
//!
6262
//! * `OPENSSL_DIR` - If specified, the directory of an OpenSSL installation. The directory should contain `lib` and
63-
//! `include` subdirectories containing the libraries and headers respectively.
63+
//! `include` subdirectories containing the libraries and headers respectively.
6464
//! * `OPENSSL_LIB_DIR` and `OPENSSL_INCLUDE_DIR` - If specified, the directories containing the OpenSSL libraries and
65-
//! headers respectively. This can be used if the OpenSSL installation is split in a nonstandard directory layout.
65+
//! headers respectively. This can be used if the OpenSSL installation is split in a nonstandard directory layout.
6666
//! * `OPENSSL_STATIC` - If set, the crate will statically link to OpenSSL rather than dynamically link.
6767
//! * `OPENSSL_LIBS` - If set, a `:`-separated list of library names to link to (e.g. `ssl:crypto`). This can be used
68-
//! if nonstandard library names were used for whatever reason.
68+
//! if nonstandard library names were used for whatever reason.
6969
//! * `OPENSSL_NO_VENDOR` - If set, always find OpenSSL in the system, even if the `vendored` feature is enabled.
7070
//!
7171
//! If the `vendored` Cargo feature is enabled, the following environment variable can also be used to further configure
7272
//! the OpenSSL build.
7373
//!
7474
//! * `OPENSSL_CONFIG_DIR` - If set, the copy of OpenSSL built by the `openssl-src` crate will be configured to look for
75-
//! configuration files and root certificates in this directory.
75+
//! configuration files and root certificates in this directory.
7676
//!
7777
//! Additionally, these variables can be prefixed with the upper-cased target architecture (e.g.
7878
//! `X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR`), which can be useful when cross compiling.

openssl/src/md.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl Md {
109109
let ptr = cvt_p(ffi::EVP_MD_fetch(
110110
ctx.map_or(ptr::null_mut(), ForeignTypeRef::as_ptr),
111111
algorithm.as_ptr(),
112-
properties.map_or(ptr::null_mut(), |s| s.as_ptr()),
112+
properties.as_ref().map_or(ptr::null_mut(), |s| s.as_ptr()),
113113
))?;
114114

115115
Ok(Md::from_ptr(ptr))
@@ -233,3 +233,15 @@ impl MdRef {
233233
unsafe { Nid::from_raw(ffi::EVP_MD_type(self.as_ptr())) }
234234
}
235235
}
236+
237+
#[cfg(test)]
238+
mod test {
239+
#[cfg(ossl300)]
240+
use super::Md;
241+
242+
#[test]
243+
#[cfg(ossl300)]
244+
fn test_md_fetch_properties() {
245+
assert!(Md::fetch(None, "SHA-256", Some("provider=gibberish")).is_err());
246+
}
247+
}

0 commit comments

Comments
 (0)