Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update aws-lc-sys, align w/ AWS-LC v1.34.2 #509

Merged
merged 36 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
762461f
Use C11; Align with AWS-LC v1.34.2
justsmth Aug 27, 2024
5610e72
Symbols from ubuntu-latest
Aug 28, 2024
6d5f053
Symbols from macos-13-xlarge
Aug 28, 2024
01e0b7b
Symbols from x86_64-pc-windows-gnu
Aug 28, 2024
b214573
Symbols from macos-12
Aug 28, 2024
4d34581
Symbols for powerpc-unknown-linux-gnu
Aug 28, 2024
149e09e
Symbols for aarch64-unknown-linux-gnu
Aug 28, 2024
6607ef8
Symbols for i686-unknown-linux-gnu
Aug 28, 2024
3141a0f
Symbols from x86_64-pc-windows-msvc
Aug 28, 2024
20453d9
Symbols for arm-unknown-linux-gnueabi
Aug 28, 2024
8a120e6
Symbols for aarch64-unknown-linux-musl
Aug 28, 2024
05d9803
Symbols from i686-pc-windows-msvc
Aug 28, 2024
97197be
Symbols for powerpc64le-unknown-linux-gnu
Aug 28, 2024
389e213
Symbols for x86_64-unknown-linux-musl
Aug 28, 2024
f8be186
Symbols for armv7-unknown-linux-gnueabihf
Aug 28, 2024
387f351
Symbols from aarch64-pc-windows-msvc
Aug 28, 2024
5b3412d
Generated headers
Aug 28, 2024
d22275b
Generated bindings from macos-13-xlarge
Aug 28, 2024
e29de62
Generated bindings from ubuntu-latest
Aug 28, 2024
eaffacd
Generated bindings for x86_64-pc-windows-gnu
Aug 28, 2024
a61e35b
Generated bindings from macos-12
Aug 28, 2024
068e3ec
Generated bindings for aarch64-unknown-linux-musl
Aug 28, 2024
0f81e16
Generated bindings for x86_64-unknown-linux-musl
Aug 28, 2024
d97e5b8
Generated bindings for i686-unknown-linux-gnu
Aug 28, 2024
d7bf059
Generated bindings for x86_64-pc-windows-msvc
Aug 28, 2024
a27d999
Generated bindings for aarch64-pc-windows-msvc
Aug 28, 2024
29619fb
Generated bindings for i686-pc-windows-msvc
Aug 28, 2024
b8d7033
Generated bindings for aarch64-unknown-linux-gnu
Aug 28, 2024
d4b985c
Collected source files from macos-13-xlarge
Aug 28, 2024
3f8971d
Collected source files from ubuntu-latest
Aug 28, 2024
7665df6
Collected source files from macos-12
Aug 28, 2024
1c526bf
Collected source files for x86_64-unknown-linux-musl
Aug 28, 2024
d9368be
Collected source files for i686-unknown-linux-gnu
Aug 28, 2024
f30919d
Collected source files for aarch64-unknown-linux-gnu
Aug 28, 2024
b58fb89
Collected source files for aarch64-unknown-linux-musl
Aug 28, 2024
99c6931
Collected NASM files
Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/sys-bindings-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
- name: No-prefix build for ${{ matrix.os }}
env:
AWS_LC_SYS_NO_PREFIX: "1"
# Ensure that we collect symbols unique to C99 builds
AWS_LC_SYS_C_STD: "99"
run: |
cargo test -p aws-lc-sys --features bindgen
- name: Collect symbols
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ libc = "0.2.121"
paste = "1.0.11"

[package.metadata.aws-lc-sys]
commit-hash = "05747780676652f41d0b9c570a495e4bb6608560"
commit-hash = "2f1879759b2e0fc70592665bdf10087b64f44b7d"
2 changes: 1 addition & 1 deletion aws-lc-sys/aws-lc
Submodule aws-lc updated 123 files
13 changes: 10 additions & 3 deletions aws-lc-sys/builder/cc_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ mod x86_64_unknown_linux_gnu;
mod x86_64_unknown_linux_musl;

use crate::{
cargo_env, env_var_to_bool, execute_command, out_dir, target, target_arch, target_os,
target_vendor, OutputLibType,
cargo_env, env_var_to_bool, execute_command, out_dir, requested_c_std, target, target_arch,
target_os, target_vendor, CStdRequested, OutputLibType,
};
use std::path::PathBuf;

Expand Down Expand Up @@ -96,15 +96,22 @@ impl CcBuilder {
}
}

fn apply_c_std(cc_build: &mut cc::Build) {
match requested_c_std() {
CStdRequested::C99 => cc_build.std("c99"),
_ => cc_build.std("c11"),
};
}

fn create_builder(&self) -> cc::Build {
let mut cc_build = cc::Build::default();
cc_build
.out_dir(&self.out_dir)
.flag("-std=c99")
.flag("-Wno-unused-parameter")
.cpp(false)
.shared_flag(false)
.static_flag(true);
CcBuilder::apply_c_std(&mut cc_build);
if target_os() == "linux" {
cc_build.define("_XOPEN_SOURCE", "700").flag("-lpthread");
}
Expand Down
4 changes: 2 additions & 2 deletions aws-lc-sys/builder/cc_builder/aarch64_apple_darwin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 22:12:32 UTC 2024
// Wed Aug 28 14:44:16 UTC 2024

use crate::cc_builder::Library;

Expand Down Expand Up @@ -164,7 +164,7 @@ pub(super) const CRYPTO_LIBRARY: Library = Library {
"crypto/rand_extra/pq_custom_randombytes.c",
"crypto/rand_extra/rand_extra.c",
"crypto/rc4/rc4.c",
"crypto/refcount_lock.c",
"crypto/refcount_c11.c",
"crypto/rsa_extra/rsa_asn1.c",
"crypto/rsa_extra/rsa_crypt.c",
"crypto/rsa_extra/rsa_print.c",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 22:18:30 UTC 2024
// Wed Aug 28 14:49:41 UTC 2024

use crate::cc_builder::Library;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 22:18:54 UTC 2024
// Wed Aug 28 14:50:47 UTC 2024

use crate::cc_builder::Library;

Expand Down
2 changes: 1 addition & 1 deletion aws-lc-sys/builder/cc_builder/i686_unknown_linux_gnu.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 22:19:08 UTC 2024
// Wed Aug 28 14:50:40 UTC 2024

use crate::cc_builder::Library;

Expand Down
4 changes: 2 additions & 2 deletions aws-lc-sys/builder/cc_builder/x86_64_apple_darwin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 22:13:39 UTC 2024
// Wed Aug 28 14:45:46 UTC 2024

use crate::cc_builder::Library;

Expand Down Expand Up @@ -164,7 +164,7 @@ pub(super) const CRYPTO_LIBRARY: Library = Library {
"crypto/rand_extra/pq_custom_randombytes.c",
"crypto/rand_extra/rand_extra.c",
"crypto/rc4/rc4.c",
"crypto/refcount_lock.c",
"crypto/refcount_c11.c",
"crypto/rsa_extra/rsa_asn1.c",
"crypto/rsa_extra/rsa_crypt.c",
"crypto/rsa_extra/rsa_print.c",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 22:12:14 UTC 2024
// Wed Aug 28 14:45:50 UTC 2024

use crate::cc_builder::Library;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
// Wed Aug 21 22:18:39 UTC 2024
// Wed Aug 28 14:49:39 UTC 2024

use crate::cc_builder::Library;

Expand Down
13 changes: 11 additions & 2 deletions aws-lc-sys/builder/cmake_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
use crate::OutputLib::{Crypto, RustWrapper, Ssl};
use crate::{
allow_prebuilt_nasm, cargo_env, emit_warning, execute_command, is_crt_static, is_no_asm,
option_env, target, target_arch, target_env, target_family, target_os, target_underscored,
target_vendor, test_nasm_command, OutputLibType,
option_env, requested_c_std, target, target_arch, target_env, target_family, target_os,
target_underscored, target_vendor, test_nasm_command, CStdRequested, OutputLibType,
};
use std::env;
use std::ffi::OsString;
Expand Down Expand Up @@ -135,6 +135,15 @@ impl CmakeBuilder {

cmake_cfg.define("ASAN", "1");
}
match requested_c_std() {
CStdRequested::C99 => {
cmake_cfg.define("CMAKE_C_STANDARD", "99");
}
CStdRequested::C11 => {
cmake_cfg.define("CMAKE_C_STANDARD", "11");
}
CStdRequested::None => {}
}
justsmth marked this conversation as resolved.
Show resolved Hide resolved

// Allow environment to specify CMake toolchain.
if let Some(toolchain) = option_env("CMAKE_TOOLCHAIN_FILE").or(option_env(format!(
Expand Down
31 changes: 31 additions & 0 deletions aws-lc-sys/builder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,39 @@ trait Builder {
fn build(&self) -> Result<(), String>;
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum CStdRequested {
C99,
C11,
None,
}

impl CStdRequested {
fn from_env() -> Self {
if let Some(val) = option_env("AWS_LC_SYS_C_STD") {
let cstd = match val.as_str() {
"99" => CStdRequested::C99,
"11" => CStdRequested::C11,
_ => CStdRequested::None,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's something we can't parse should this be a hard error? If someone set AWS_LC_SYS_C_STD=c11 it would hit none here, and then could they actually get c99, or vice versa.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought about matching against a RegExp here to add more flexibility, but I'm not sure it's worth the trouble.

I see this environment variable as something that will rarely be needed. We will default to C11 for most consumers (which should work for any build host that's been setup sometime in the last decade).

};
emit_warning(&format!(
"AWS_LC_SYS_C_STD environment variable set: {cstd:?}"
));
return cstd;
}
CStdRequested::None
}
}

static mut PREGENERATED: bool = false;
static mut AWS_LC_SYS_NO_PREFIX: bool = false;
static mut AWS_LC_SYS_INTERNAL_BINDGEN: bool = false;
static mut AWS_LC_SYS_EXTERNAL_BINDGEN: bool = false;
static mut AWS_LC_SYS_NO_ASM: bool = false;
static mut AWS_LC_SYS_PREBUILT_NASM: Option<bool> = None;

static mut AWS_LC_SYS_C_STD: CStdRequested = CStdRequested::None;

fn initialize() {
unsafe {
AWS_LC_SYS_NO_PREFIX = env_var_to_bool("AWS_LC_SYS_NO_PREFIX").unwrap_or(false);
Expand All @@ -330,6 +356,7 @@ fn initialize() {
env_var_to_bool("AWS_LC_SYS_EXTERNAL_BINDGEN").unwrap_or(false);
AWS_LC_SYS_NO_ASM = env_var_to_bool("AWS_LC_SYS_NO_ASM").unwrap_or(false);
AWS_LC_SYS_PREBUILT_NASM = env_var_to_bool("AWS_LC_SYS_PREBUILT_NASM");
AWS_LC_SYS_C_STD = CStdRequested::from_env();
}

if !is_external_bindgen() && (is_internal_bindgen() || !has_bindgen_feature()) {
Expand Down Expand Up @@ -392,6 +419,10 @@ fn allow_prebuilt_nasm() -> Option<bool> {
unsafe { AWS_LC_SYS_PREBUILT_NASM }
}

fn requested_c_std() -> CStdRequested {
unsafe { AWS_LC_SYS_C_STD }
}

fn has_bindgen_feature() -> bool {
cfg!(feature = "bindgen")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Microsoft (R) COFF/PE Dumper Version 14.40.33813.0
Copyright (C) Microsoft Corporation. All rights reserved.


Expand Down
Binary file modified aws-lc-sys/builder/prebuilt-nasm/aes128gcmsiv-x86_64.obj
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Microsoft (R) COFF/PE Dumper Version 14.40.33813.0
Copyright (C) Microsoft Corporation. All rights reserved.


Expand Down
Binary file modified aws-lc-sys/builder/prebuilt-nasm/aesni-gcm-avx512.obj
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Microsoft (R) COFF/PE Dumper Version 14.40.33813.0
Copyright (C) Microsoft Corporation. All rights reserved.


Expand Down
Binary file modified aws-lc-sys/builder/prebuilt-nasm/aesni-gcm-x86_64.obj
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Microsoft (R) COFF/PE Dumper Version 14.40.33813.0
Copyright (C) Microsoft Corporation. All rights reserved.


Expand Down
Binary file modified aws-lc-sys/builder/prebuilt-nasm/aesni-sha1-x86_64.obj
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Microsoft (R) COFF/PE Dumper Version 14.40.33813.0
Copyright (C) Microsoft Corporation. All rights reserved.


Expand Down
Binary file modified aws-lc-sys/builder/prebuilt-nasm/aesni-sha256-x86_64.obj
Binary file not shown.
Loading
Loading