Skip to content

Commit

Permalink
Updated aws-lc to v1.16.0, regenerated aws-lc-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail committed Oct 5, 2023
1 parent 08106bf commit b4eebd3
Show file tree
Hide file tree
Showing 29 changed files with 21,783 additions and 21,743 deletions.
2 changes: 1 addition & 1 deletion aws-lc-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fips = ["dep:aws-lc-fips-sys"]

[dependencies]
untrusted = { version = "0.7.1", optional = true }
aws-lc-sys = { version = "0.10.0", path = "../aws-lc-sys", optional = true }
aws-lc-sys = { version = "0.11.0", path = "../aws-lc-sys", optional = true }
aws-lc-fips-sys = { version = "0.10.0", path = "../aws-lc-fips-sys", optional = true }
zeroize = "1"
mirai-annotations = "1.12.0"
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "aws-lc-sys"
description = "AWS-LC is a general-purpose cryptographic library maintained by the AWS Cryptography team for AWS and their customers. It іs based on code from the Google BoringSSL project and the OpenSSL project."
version = "0.10.1"
version = "0.11.0"
authors = ["AWS-LC"]
edition = "2021"
repository = "https://github.com/aws/aws-lc-rs"
Expand Down
2 changes: 1 addition & 1 deletion aws-lc-sys/aws-lc
Submodule aws-lc updated 308 files
56 changes: 30 additions & 26 deletions aws-lc-sys/builder/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,46 @@ impl ParseCallbacks for StripPrefixCallback {
}
}

fn prepare_clang_args(manifest_dir: &Path, build_prefix: Option<&str>) -> Vec<String> {
let mut clang_args: Vec<String> = vec![
"-I".to_string(),
fn add_header_include_path(args: &mut Vec<String>, path: String) {
args.push("-I".to_string());
args.push(path);
}

fn prepare_clang_args(manifest_dir: &Path) -> Vec<String> {
let mut clang_args: Vec<String> = Vec::new();

add_header_include_path(
&mut clang_args,
get_rust_include_path(manifest_dir).display().to_string(),
"-I".to_string(),
);

add_header_include_path(
&mut clang_args,
get_generated_include_path(manifest_dir)
.display()
.to_string(),
);

add_header_include_path(
&mut clang_args,
get_aws_lc_include_path(manifest_dir).display().to_string(),
];
);

if let Some(include_paths) = get_aws_lc_sys_includes_path() {
for path in include_paths {
clang_args.push("-I".to_string());
clang_args.push(path.display().to_string());
add_header_include_path(&mut clang_args, path.display().to_string());
}
}

if let Some(prefix) = build_prefix {
clang_args.push(format!("-DBORINGSSL_PREFIX={prefix}"));
clang_args.push("-I".to_string());
clang_args.push(
get_generated_include_path(manifest_dir)
.display()
.to_string(),
);
}

clang_args
}

const COPYRIGHT: &str = r#"
const COPYRIGHT: &str = r"
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC
"#;
";

const PRELUDE: &str = r#"
const PRELUDE: &str = r"
#![allow(
unused_imports,
non_camel_case_types,
Expand All @@ -86,17 +92,17 @@ const PRELUDE: &str = r#"
clippy::used_underscore_binding,
clippy::useless_transmute
)]
"#;
";

#[derive(Default)]
pub(crate) struct BindingOptions<'a> {
pub build_prefix: Option<&'a str>,
pub build_prefix: &'a str,
pub include_ssl: bool,
pub disable_prelude: bool,
}

fn prepare_bindings_builder(manifest_dir: &Path, options: &BindingOptions<'_>) -> bindgen::Builder {
let clang_args = prepare_clang_args(manifest_dir, options.build_prefix);
let clang_args = prepare_clang_args(manifest_dir);

let mut builder = bindgen::Builder::default()
.derive_copy(true)
Expand Down Expand Up @@ -130,9 +136,7 @@ fn prepare_bindings_builder(manifest_dir: &Path, options: &BindingOptions<'_>) -
builder = builder.clang_arg("-DAWS_LC_RUST_INCLUDE_SSL");
}

if let Some(ps) = &options.build_prefix {
builder = builder.parse_callbacks(Box::new(StripPrefixCallback::new(ps)));
}
builder = builder.parse_callbacks(Box::new(StripPrefixCallback::new(options.build_prefix)));

builder
}
Expand Down
24 changes: 11 additions & 13 deletions aws-lc-sys/builder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn get_cmake_config(manifest_dir: &PathBuf) -> cmake::Config {
cmake::Config::new(manifest_dir)
}

fn prepare_cmake_build(manifest_dir: &PathBuf, build_prefix: Option<&str>) -> cmake::Config {
fn prepare_cmake_build(manifest_dir: &PathBuf, build_prefix: String) -> cmake::Config {
let mut cmake_cfg = get_cmake_config(manifest_dir);

if OutputLibType::default() == OutputLibType::Dynamic {
Expand All @@ -158,14 +158,12 @@ fn prepare_cmake_build(manifest_dir: &PathBuf, build_prefix: Option<&str>) -> cm
}
}

if let Some(symbol_prefix) = build_prefix {
cmake_cfg.define("BORINGSSL_PREFIX", symbol_prefix);
let include_path = manifest_dir.join("generated-include");
cmake_cfg.define(
"BORINGSSL_PREFIX_HEADERS",
include_path.display().to_string(),
);
}
cmake_cfg.define("BORINGSSL_PREFIX", build_prefix);
let include_path = manifest_dir.join("generated-include");
cmake_cfg.define(
"BORINGSSL_PREFIX_HEADERS",
include_path.display().to_string(),
);

// Build flags that minimize our crate size.
cmake_cfg.define("BUILD_TESTING", "OFF");
Expand Down Expand Up @@ -202,7 +200,7 @@ fn prepare_cmake_build(manifest_dir: &PathBuf, build_prefix: Option<&str>) -> cm
}

fn build_rust_wrapper(manifest_dir: &PathBuf) -> PathBuf {
prepare_cmake_build(manifest_dir, Some(&prefix_string()))
prepare_cmake_build(manifest_dir, prefix_string())
.configure_arg("--no-warn-unused-cli")
.build()
}
Expand All @@ -218,7 +216,7 @@ fn build_rust_wrapper(manifest_dir: &PathBuf) -> PathBuf {
))]
fn generate_bindings(manifest_dir: &Path, prefix: &str, bindings_path: &PathBuf) {
let options = bindgen::BindingOptions {
build_prefix: Some(prefix),
build_prefix: prefix,
include_ssl: cfg!(feature = "ssl"),
disable_prelude: true,
};
Expand All @@ -235,7 +233,7 @@ fn generate_src_bindings(manifest_dir: &Path, prefix: &str, src_bindings_path: &
bindgen::generate_bindings(
manifest_dir,
&bindgen::BindingOptions {
build_prefix: Some(prefix),
build_prefix: prefix,
include_ssl: false,
..Default::default()
},
Expand All @@ -246,7 +244,7 @@ fn generate_src_bindings(manifest_dir: &Path, prefix: &str, src_bindings_path: &
bindgen::generate_bindings(
manifest_dir,
&bindgen::BindingOptions {
build_prefix: Some(prefix),
build_prefix: prefix,
include_ssl: true,
..Default::default()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

#ifndef BORINGSSL_PREFIX
#define BORINGSSL_PREFIX aws_lc_0_11_0
#endif

// BORINGSSL_ADD_PREFIX pastes two identifiers into one. It performs one
// iteration of macro expansion on its arguments before pasting.
#define BORINGSSL_ADD_PREFIX(a, b) BORINGSSL_ADD_PREFIX_INNER(a, b)
Expand Down Expand Up @@ -348,6 +352,7 @@
#define BN_CTX_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BN_CTX_free)
#define BN_CTX_get BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BN_CTX_get)
#define BN_CTX_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BN_CTX_new)
#define BN_CTX_secure_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BN_CTX_secure_new)
#define BN_CTX_start BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BN_CTX_start)
#define BN_GENCB_call BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BN_GENCB_call)
#define BN_GENCB_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, BN_GENCB_free)
Expand Down Expand Up @@ -1772,6 +1777,7 @@
#define RAND_keep_random_devices_open BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RAND_keep_random_devices_open)
#define RAND_load_file BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RAND_load_file)
#define RAND_poll BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RAND_poll)
#define RAND_priv_bytes BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RAND_priv_bytes)
#define RAND_pseudo_bytes BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RAND_pseudo_bytes)
#define RAND_seed BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RAND_seed)
#define RAND_set_rand_method BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, RAND_set_rand_method)
Expand Down Expand Up @@ -1932,7 +1938,6 @@
#define SSL_CIPHER_get_name BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CIPHER_get_name)
#define SSL_CIPHER_get_prf_nid BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CIPHER_get_prf_nid)
#define SSL_CIPHER_get_protocol_id BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CIPHER_get_protocol_id)
#define SSL_CIPHER_get_value BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CIPHER_get_value)
#define SSL_CIPHER_get_version BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CIPHER_get_version)
#define SSL_CIPHER_is_aead BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CIPHER_is_aead)
#define SSL_CIPHER_is_block_cipher BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CIPHER_is_block_cipher)
Expand Down Expand Up @@ -2022,8 +2027,6 @@
#define SSL_CTX_set0_client_CAs BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CTX_set0_client_CAs)
#define SSL_CTX_set0_verify_cert_store BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CTX_set0_verify_cert_store)
#define SSL_CTX_set1_chain BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CTX_set1_chain)
#define SSL_CTX_set1_curves BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CTX_set1_curves)
#define SSL_CTX_set1_curves_list BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CTX_set1_curves_list)
#define SSL_CTX_set1_ech_keys BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CTX_set1_ech_keys)
#define SSL_CTX_set1_groups BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CTX_set1_groups)
#define SSL_CTX_set1_groups_list BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_CTX_set1_groups_list)
Expand Down Expand Up @@ -2219,7 +2222,7 @@
#define SSL_get1_session BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get1_session)
#define SSL_get_SSL_CTX BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_SSL_CTX)
#define SSL_get_all_cipher_names BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_all_cipher_names)
#define SSL_get_all_curve_names BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_all_curve_names)
#define SSL_get_all_group_names BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_all_group_names)
#define SSL_get_all_signature_algorithm_names BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_all_signature_algorithm_names)
#define SSL_get_all_standard_cipher_names BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_all_standard_cipher_names)
#define SSL_get_all_version_names BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_all_version_names)
Expand All @@ -2232,8 +2235,6 @@
#define SSL_get_current_cipher BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_current_cipher)
#define SSL_get_current_compression BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_current_compression)
#define SSL_get_current_expansion BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_current_expansion)
#define SSL_get_curve_id BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_curve_id)
#define SSL_get_curve_name BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_curve_name)
#define SSL_get_default_timeout BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_default_timeout)
#define SSL_get_early_data_reason BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_early_data_reason)
#define SSL_get_error BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_error)
Expand All @@ -2243,6 +2244,8 @@
#define SSL_get_extms_support BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_extms_support)
#define SSL_get_fd BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_fd)
#define SSL_get_finished BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_finished)
#define SSL_get_group_id BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_group_id)
#define SSL_get_group_name BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_group_name)
#define SSL_get_info_callback BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_info_callback)
#define SSL_get_ivs BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_ivs)
#define SSL_get_key_block_len BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get_key_block_len)
Expand Down Expand Up @@ -2339,8 +2342,6 @@
#define SSL_set0_verify_cert_store BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_set0_verify_cert_store)
#define SSL_set0_wbio BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_set0_wbio)
#define SSL_set1_chain BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_set1_chain)
#define SSL_set1_curves BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_set1_curves)
#define SSL_set1_curves_list BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_set1_curves_list)
#define SSL_set1_delegated_credential BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_set1_delegated_credential)
#define SSL_set1_ech_config_list BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_set1_ech_config_list)
#define SSL_set1_groups BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_set1_groups)
Expand Down Expand Up @@ -3197,6 +3198,7 @@
#define bio_socket_nbio BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bio_socket_nbio)
#define bn_abs_sub_consttime BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_abs_sub_consttime)
#define bn_add_words BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_add_words)
#define bn_big_endian_to_words BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_big_endian_to_words)
#define bn_copy_words BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_copy_words)
#define bn_div_consttime BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_div_consttime)
#define bn_div_words BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_div_words)
Expand Down Expand Up @@ -3265,6 +3267,7 @@
#define bn_uadd_consttime BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_uadd_consttime)
#define bn_usub_consttime BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_usub_consttime)
#define bn_wexpand BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_wexpand)
#define bn_words_to_big_endian BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, bn_words_to_big_endian)
#define boringssl_self_test_hmac_sha256 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, boringssl_self_test_hmac_sha256)
#define boringssl_self_test_sha256 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, boringssl_self_test_sha256)
#define c2i_ASN1_BIT_STRING BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, c2i_ASN1_BIT_STRING)
Expand Down
Loading

0 comments on commit b4eebd3

Please sign in to comment.