Skip to content

Commit c7fbca9

Browse files
zlukwinsjyao1
authored andcommitted
Bump ring library version to 0.17.14
Following items included: * ring library bumping up from 0.17.6 to 0.17.14 * dropping patch for NFC: Address Clippy unused import warning introduced with confidential-containers/td-shim#760 * dropping SSE and SSE2 checks Signed-off-by: Zbigniew Lukwinski <zbigniew.lukwinski@intel.com>
1 parent 984ae13 commit c7fbca9

10 files changed

Lines changed: 96 additions & 70 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

external/patches/ring/0001-NFC-Address-Clippy-unused-import-warning.patch

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,52 @@
1+
From 022337ecdb430a2e536db8dbd3199b9d3e3cf58e Mon Sep 17 00:00:00 2001
2+
From: Zbigniew Lukwinski <zbigniew.lukwinski@intel.com>
3+
Date: Thu, 13 Mar 2025 15:18:16 +0100
4+
Subject: [PATCH] Support x86_64_unknown target
5+
6+
Signed-off-by: Zbigniew Lukwinski <zbigniew.lukwinski@intel.com>
7+
---
8+
Cargo.toml | 2 +-
9+
build.rs | 18 +++++++++++++++++-
10+
2 files changed, 18 insertions(+), 2 deletions(-)
11+
112
diff --git a/Cargo.toml b/Cargo.toml
2-
index 2c8ba6964..209c3d4a1 100644
13+
index 8f8da17da..a45ec829d 100644
314
--- a/Cargo.toml
415
+++ b/Cargo.toml
5-
@@ -171,7 +171,7 @@ all-features = true
6-
name = "ring"
16+
@@ -159,7 +159,7 @@ name = "ring"
717

818
[dependencies]
19+
cfg-if = { version = "1.0.0", default-features = false }
920
-getrandom = { version = "0.2.10" }
1021
+getrandom = { version = "0.2.10", features = ["rdrand"] }
1122
untrusted = { version = "0.9" }
1223

13-
[target.'cfg(any(target_arch = "x86",target_arch = "x86_64", all(any(target_arch = "aarch64", target_arch = "arm"), any(target_os = "android", target_os = "fuchsia", target_os = "linux", target_os = "windows"))))'.dependencies]
24+
[target.'cfg(all(any(all(target_arch = "aarch64", target_endian = "little"), all(target_arch = "arm", target_endian = "little")), any(target_os = "android", target_os = "linux")))'.dependencies]
1425
diff --git a/build.rs b/build.rs
15-
index f7b94108b..3bdc8cd29 100644
26+
index 9843ad8aa..494d8cfc7 100644
1627
--- a/build.rs
1728
+++ b/build.rs
18-
@@ -121,7 +121,9 @@ fn cpp_flags(compiler: &cc::Tool) -> &'static [&'static str] {
19-
"-Wenum-compare",
20-
"-Wfloat-equal",
21-
"-Wformat=2",
22-
- "-Winline",
23-
+ // Clear the `-Winline` because warnings will be treated as errors
24-
+ // when `ring` is used as git submodules.
25-
+ // "-Winline",
26-
"-Winvalid-pch",
27-
"-Wmissing-field-initializers",
28-
"-Wmissing-include-dirs",
29-
@@ -260,6 +262,8 @@ const LINUX_ABI: &[&str] = &[
29+
@@ -254,6 +254,8 @@ const LINUX_ABI: &[&str] = &[
3030
"linux",
3131
"redox",
3232
"solaris",
3333
+ // For `x86_64-unknown-none` target
3434
+ "none",
3535
];
3636

37-
/// Operating systems that have the same ABI as macOS on every architecture
38-
@@ -604,16 +608,29 @@ fn configure_cc(c: &mut cc::Build, target: &Target, include_dir: &Path) {
39-
// poly1305_vec.c requires <emmintrin.h> which requires <stdlib.h>.
40-
if (target.arch == "wasm32")
41-
|| (target.os == "linux" && target.is_musl && target.arch != "x86_64")
37+
const WIN32N: &str = "win32n";
38+
@@ -594,14 +596,28 @@ fn configure_cc(c: &mut cc::Build, target: &Target, c_root_dir: &Path, include_d
39+
// Allow cross-compiling without a target sysroot for these targets.
40+
if (target.arch == WASM32)
41+
|| (target.os == "linux" && target.env == "musl" && target.arch != X86_64)
4242
+ || (target.os == "none")
4343
{
44-
if let Ok(compiler) = c.try_get_compiler() {
45-
// TODO: Expand this to non-clang compilers in 0.17.0 if practical.
46-
if compiler.is_like_clang() {
47-
let _ = c.flag("-nostdlibinc");
48-
+ // Required on windows for cross compilation to `x86_64-unknown-none`
49-
+ let _ = c.flag("-ffreestanding");
50-
let _ = c.define("RING_CORE_NOSTDLIBINC", "1");
51-
}
44+
// TODO: Expand this to non-clang compilers in 0.17.0 if practical.
45+
if compiler.is_like_clang() {
46+
let _ = c.flag("-nostdlibinc");
47+
+ // Required on windows for cross compilation to `x86_64-unknown-none`
48+
+ let _ = c.flag("-ffreestanding");
49+
let _ = c.define("RING_CORE_NOSTDLIBINC", "1");
5250
}
5351
}
5452

@@ -58,19 +56,22 @@ index f7b94108b..3bdc8cd29 100644
5856
+ if let Ok(compiler) = c.try_get_compiler() {
5957
+ if compiler.is_like_clang() {
6058
+ let _ = c.define("__ELF__", None);
59+
+ let _ = c.flag("-fPIC");
6160
+ }
6261
+ }
6362
+ }
6463
+
6564
if target.force_warnings_into_errors {
6665
c.warnings_into_errors(true);
6766
}
68-
@@ -645,7 +662,7 @@ fn nasm(file: &Path, arch: &str, include_dir: &Path, out_file: &Path) -> Command
69-
std::path::MAIN_SEPARATOR,
70-
)));
67+
@@ -619,7 +635,7 @@ fn nasm(file: &Path, arch: &str, include_dir: &Path, out_dir: &Path, c_root_dir:
68+
let mut include_dir = include_dir.as_os_str().to_os_string();
69+
include_dir.push(OsString::from(String::from(std::path::MAIN_SEPARATOR)));
7170

7271
- let mut c = Command::new("./target/tools/windows/nasm/nasm");
7372
+ let mut c = Command::new("nasm");
7473
let _ = c
7574
.arg("-o")
7675
.arg(out_file.to_str().expect("Invalid path"))
76+
--
77+
2.34.1
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From e6dd2c965fb14b3ca3c20005f16d727ee12b589f Mon Sep 17 00:00:00 2001
2+
From: Zbigniew Lukwinski <zbigniew.lukwinski@intel.com>
3+
Date: Fri, 14 Mar 2025 11:07:55 +0100
4+
Subject: [PATCH] Disable checks for SSE and SSE2
5+
6+
Signed-off-by: Zbigniew Lukwinski <zbigniew.lukwinski@intel.com>
7+
---
8+
src/cpu/intel.rs | 16 ++++++++--------
9+
1 file changed, 8 insertions(+), 8 deletions(-)
10+
11+
diff --git a/src/cpu/intel.rs b/src/cpu/intel.rs
12+
index f45052fe7..9c3ac044e 100644
13+
--- a/src/cpu/intel.rs
14+
+++ b/src/cpu/intel.rs
15+
@@ -22,8 +22,8 @@ mod abi_assumptions {
16+
// https://github.com/briansmith/ring/issues/1793#issuecomment-1793243725,
17+
// https://github.com/briansmith/ring/issues/1832,
18+
// https://github.com/briansmith/ring/issues/1833.
19+
- const _ASSUMES_SSE2: () =
20+
- assert!(cfg!(target_feature = "sse") && cfg!(target_feature = "sse2"));
21+
+ // const _ASSUMES_SSE2: () =
22+
+ // assert!(cfg!(target_feature = "sse") && cfg!(target_feature = "sse2"));
23+
24+
#[cfg(target_arch = "x86_64")]
25+
const _ASSUMED_POINTER_SIZE: usize = 8;
26+
@@ -156,8 +156,8 @@ fn cpuid_to_caps_and_set_c_flags(cpuid: &[u32; 4]) -> u32 {
27+
// CMOV, it is likely that some of our timing side channel prevention does
28+
// not work. Presumably the people who delete these are verifying that it
29+
// all works fine.
30+
- const _SSE_REQUIRED: () = assert!(cfg!(target_feature = "sse"));
31+
- const _SSE2_REQUIRED: () = assert!(cfg!(target_feature = "sse2"));
32+
+ // const _SSE_REQUIRED: () = assert!(cfg!(target_feature = "sse"));
33+
+ // const _SSE2_REQUIRED: () = assert!(cfg!(target_feature = "sse2"));
34+
35+
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]
36+
{
37+
@@ -184,10 +184,10 @@ fn cpuid_to_caps_and_set_c_flags(cpuid: &[u32; 4]) -> u32 {
38+
// assertions in an attempt to support pre-SSE2 32-bit x86 systems. If they
39+
// do, hopefully they won't delete these redundant assertions, so that
40+
// x86_64 isn't affected.
41+
- #[cfg(target_arch = "x86_64")]
42+
- const _SSE2_REQUIRED_X86_64: () = assert!(cfg!(target_feature = "sse2"));
43+
- #[cfg(target_arch = "x86_64")]
44+
- const _SSE_REQUIRED_X86_64: () = assert!(cfg!(target_feature = "sse2"));
45+
+ // #[cfg(target_arch = "x86_64")]
46+
+ // const _SSE2_REQUIRED_X86_64: () = assert!(cfg!(target_feature = "sse2"));
47+
+ // #[cfg(target_arch = "x86_64")]
48+
+ // const _SSE_REQUIRED_X86_64: () = assert!(cfg!(target_feature = "sse2"));
49+
50+
// Intel: "12.7.2 Checking for SSSE3 Support"
51+
// If/when we support dynamic detection of SSE/SSE2, make this conditional
52+
--
53+
2.34.1
54+

external/ring

Submodule ring updated 326 files

fuzz-target/fuzzlib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ afl = { version = "=0.15.12", optional = true }
1111
spdmlib = { path = "../../spdmlib", default-features = false, features=["spdm-ring"] }
1212
simple_logger = "4.2.0"
1313
log = "0.4.13"
14-
ring = { version = "0.17.6" }
14+
ring = { version = "0.17.14" }
1515
flexi_logger = "0.27.2"
1616
spdmlib-test = { path = "../../test/spdmlib-test" }
1717
futures = { version = "0.3", default-features = false }

sh_script/pre-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ process_args() {
1818
patch-ring() {
1919
# apply the patch set for ring
2020
pushd external/ring
21-
git reset --hard 464d367252354418a2c17feb806876d4d89a8508
21+
git reset --hard 2723abbca9e83347d82b056d5b239c6604f786df
2222
git clean -xdf
2323
case "$TARGET_OPTION" in
2424
"x86_64-unknown-none")
2525
git apply ../patches/ring/0001-Support-x86_64-unknown-none-target.patch
26+
git apply ../patches/ring/0002-Disable-checks-for-SSE-and-SSE2.patch
2627
;;
2728
*)
2829
echo "Unsupported target for ring, builds may not work!"
2930
;;
3031
esac
31-
git apply ../patches/ring/0001-NFC-Address-Clippy-unused-import-warning.patch
3232
popd
3333
}
3434

spdmlib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ log = "0.4.13"
1717
bytes = { version="1", default-features=false }
1818
conquer-once = { version = "0.3.2", default-features = false }
1919
lazy_static = { version = "1.0", features = ["spin_no_std"], optional = true }
20-
ring = { version = "0.17.6", default-features = false, features = ["alloc", "less-safe-getrandom-custom-or-rdrand"], optional = true }
20+
ring = { version = "0.17.14", default-features = false, features = ["alloc", "less-safe-getrandom-custom-or-rdrand"], optional = true }
2121
webpki = { version = "0.22.4", default-features = false, features = ["alloc"], optional = true}
2222
untrusted = { version = "0.9.0", optional = true }
2323
zeroize = { version = "1.5.0", features = ["zeroize_derive"]}

test/spdm-emu/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2018"
88

99
[dependencies]
1010
log = "0.4.13"
11-
ring = { version = "0.17.6" }
11+
ring = { version = "0.17.14" }
1212
webpki = { version = "0.22.4", default-features = false, features = ["alloc"]}
1313
untrusted = { version = "0.9.0" }
1414
codec = { path = "../../codec" }

test/spdmlib-test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2021"
99
spdmlib = { path = "../../spdmlib", default-features = false, features=["spdm-ring"] }
1010
codec = { path = "../../codec", features = ["alloc"] }
1111
log = "0.4.13"
12-
ring = { version = "0.17.6" }
12+
ring = { version = "0.17.14" }
1313
bytes = { version="1", default-features=false }
1414
futures = { version = "0.3", default-features = false }
1515
async-trait = "0.1.71"

0 commit comments

Comments
 (0)