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 pq branch 01 17 23 #757

Merged
merged 69 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
02cf1c3
Cap Montgomery moduli to 8 KiB.
davidben Nov 19, 2022
6e86657
Tidy up cipher_test.cc slightly
davidben Nov 27, 2022
25486bd
Correct the maximum output size in cipher_test.cc
davidben Nov 27, 2022
c189270
Give cipher tests a common entrypoint.
davidben Nov 27, 2022
3214fe4
Test the most likely point for calling EVP_CIPHER_CTX_copy.
davidben Nov 27, 2022
83b2d11
Add negative tests for the EVP_CIPHER tag check.
davidben Nov 25, 2022
ab03b8f
Test streaming the AAD into EVP_CIPHER_CTX.
davidben Nov 28, 2022
0ed1c72
Test, re-document, and deprecate EVP_Cipher.
davidben Nov 28, 2022
d85a720
Include ctrdrbg.h in the Rust wrapper.
prbprbprb Nov 30, 2022
5e3b92b
Add a copy of ninja from CIPD to util/bot/DEPS
davidben Nov 30, 2022
6e2b028
Never accidentally use SSL_SIGN_RSA_PKCS1_MD5_SHA1 at TLS 1.2.
davidben Nov 29, 2022
bf7e68e
Don't allow the caller to configure invalid signature algorithms.
davidben Nov 29, 2022
6c6b614
Use a sized type for asn1t.h flags.
davidben Nov 22, 2022
2df0c14
Fix up some integer types in crypto/asn1
davidben Aug 31, 2022
43f8a35
Remove unnecessary L suffixes on DES constants.
davidben Nov 23, 2022
9c8b5d8
Finish porting dsa_test.cc to GTest.
davidben Nov 23, 2022
0ccb00c
Switch microsecond and iteration counts in bssl speed to uint64_t.
davidben Nov 23, 2022
a2cd8da
Update build files in generated-src
andrewhop Dec 12, 2022
2d3d6b5
Merge pull request #723 from andrewhop/upstream-merge-2022-12-12
andrewhop Dec 14, 2022
1b48edc
Add go dependencies for aws-lc-fips-sys (#726)
samuel40791765 Dec 14, 2022
9624f32
Fix Jitter time measurement on Apple platforms (#722)
dkostic Dec 14, 2022
4cef45b
Update UBSAN run config and benchmark readme (#733)
andrewhop Dec 20, 2022
1ec0fb6
Add int casts to BIO_ctrl calls where appropriate.
davidben Nov 23, 2022
7db5eba
[Bazel] Support More Platforms
cpsauer Dec 4, 2022
454ec5f
Rewrite i2o_ECPublicKey with CBB_finish_i2d.
davidben Nov 23, 2022
f276acb
Add NO_CHECK_TIME to SSLTest.ECHBuiltinVerifier too
davidben Dec 7, 2022
e55fe7f
Fix -Wshorten-64-to-32 errors in ex_data.c.
davidben Nov 23, 2022
09656f6
delocate: match all the ARM register extension patterns.
agl Dec 8, 2022
3dfc581
Add SSL_was_key_usage_invalid.
davidben Dec 2, 2022
f6f2eb0
Merge pull request #730 from DominicDams/upstream-merge-12-20
nebeid Dec 20, 2022
bb71bb9
remove kas-kdf from ACVP tool (#734)
billbo-yang Dec 21, 2022
344c6e6
Add hkdf_expand() as a KDF in feedback mode to the ACVP tool (#732)
billbo-yang Dec 24, 2022
db00701
Key Encapsulation Mechanism (KEM) API (#708)
dkostic Dec 28, 2022
fc60976
Add back ssl stat counters (#731)
samuel40791765 Jan 4, 2023
9149870
Fully condition all assembly files.
davidben Nov 19, 2022
59c0126
Drop the workaround for the third-party Android CMake toolchain.
davidben Dec 3, 2022
2ff4d9d
Disable blinding for boringssl_self_test_rsa().
Dec 6, 2022
6a5805b
Add a tool to check whether a binary has an executable stack
davidben Dec 8, 2022
405d40b
Replace comment with static assert.
davidben Dec 3, 2022
56c4c6e
Finish porting dh_test.cc and ripemd_test.cc to GTest.
davidben Dec 3, 2022
6955fab
Unexport X509V3_NAME_from_section and fix the type of chtype.
davidben Nov 23, 2022
36161c4
acvptool: factor out uploadResult
Dec 7, 2022
0a35121
Fix some more implicit size_t truncations.
davidben Dec 3, 2022
7739443
Rename and tidy up x509v3_name_cmp.
davidben Nov 23, 2022
cec5339
Update build files in generated-src
nebeid Dec 24, 2022
d8d04ab
Merge pull request #737 from nebeid/upstream-merge-2022-12-27
nebeid Jan 4, 2023
ae9f4e0
Move client-side session reuse counter (#743)
samuel40791765 Jan 4, 2023
fbd0196
OpenSSL Crate Compatibility Support (#729)
skmcgrail Jan 5, 2023
599033c
Model compiler flags better for compiler feature probing (#740)
torben-hansen Jan 5, 2023
59a219a
Add support to delocate.go to parse output from GCC 11 and test with …
andrewhop Jan 6, 2023
df47d26
Add ARM AL2022 CI (#746)
andrewhop Jan 10, 2023
0ce7866
add readme files for sys crates (#728)
samuel40791765 Jan 10, 2023
212cd45
Switch X509 ex_* flags to uint32_t.
davidben Nov 23, 2022
747892c
acvptool: factor out logic for connecting to the server
Dec 7, 2022
5724a44
acvptool: factor out getResultsWithRetry
Dec 7, 2022
912dbb8
Explicitly warn about streaming AEADs with EVP_CIPHER_CTX.
davidben Nov 28, 2022
2e4dd76
Add a basic threading test for X509 verification.
davidben Dec 13, 2022
33832c5
Const-correct and simplify X509_VERIFY_PARAM_set1_policies.
davidben Dec 13, 2022
059695b
Fix return value on malloc failure in tree_calculate_user_set.
davidben Dec 13, 2022
7fc564e
Restore ASN1_TIME_set_string's behavior on NULL.
davidben Dec 15, 2022
867356c
Fix handling of EXFLAG_INVALID_POLICY on the leaf.
davidben Dec 13, 2022
16e4568
Fuzz x509v3_cache_extensions.
davidben Dec 14, 2022
9f9a6c0
Add tests for rejecting duplicate policy OIDs.
davidben Dec 14, 2022
ffd564c
Merge pull request #749 from dkostic/upstream-merge-2023-01-09
dkostic Jan 12, 2023
da245a4
Move sanitizers to AL2022 and update to Clang 14 (#750)
andrewhop Jan 12, 2023
438c880
Fix ACVP Tool Upload Functionality (#753)
billbo-yang Jan 13, 2023
8a4e334
Fix FIPS static release build on ARM for gcc (#744)
samuel40791765 Jan 13, 2023
6412e8c
merge main
jakemas Jan 17, 2023
6206e3e
fix gen-src
jakemas Jan 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ doc/*.html
doc/doc.css
bindings/rust/tmp/*
bindings/rust/generate/target
!bindings/rust/aws-lc-sys-template/build
!bindings/rust/aws-lc-fips-sys-template/build

util/bot/android_ndk
util/bot/android_sdk/public
Expand All @@ -24,6 +26,7 @@ util/bot/libcxx
util/bot/libcxxabi
util/bot/llvm-build
util/bot/nasm-win32.exe
util/bot/ninja
util/bot/perl-win32
util/bot/perl-win32.zip
util/bot/sde-linux64
Expand Down
53 changes: 31 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,17 @@ macro(check_compiler file_to_test flag_to_set)
COMPILE_DEFINITIONS "-Werror"
OUTPUT_VARIABLE ERROR_MESSAGE)
if(RESULT)
set(C_CXX_FLAGS "${C_CXX_FLAGS} -D${flag_to_set}")
message(STATUS "Test ${file_to_test} passed, enabling ${flag_to_set}")
set(COMPILER_CHECK_FLAGS "${COMPILER_CHECK_FLAGS} -D${flag_to_set}")
message(STATUS "${file_to_test} probe is positive, enabling ${flag_to_set}")
else()
message(STATUS "Test ${file_to_test} failed, NOT enabling ${flag_to_set}:")
message(STATUS " ${ERROR_MESSAGE}")
message(STATUS "${file_to_test} probe is negative, NOT enabling ${flag_to_set}:")
# Some build applications use regexes on build output to highlight build
# errors. Below, we modify a compiler error message to avoid that a negative
# probe is considered an error in such build applications.
string(REPLACE ": error:"
": compiler_error:" ERROR_MESSAGE_PROCESSED
${ERROR_MESSAGE})
message(STATUS " ${ERROR_MESSAGE_PROCESSED}")
endif()
endmacro()

Expand Down Expand Up @@ -260,11 +266,6 @@ if (GCC)
endif ()

if(GCC OR CLANG)
check_compiler("stdalign_check.c" AWS_LC_STDALIGN_AVAILABLE)
check_compiler("builtin_swap_check.c" AWS_LC_BUILTIN_SWAP_SUPPORTED)
if(FIPS AND NOT APPLE)
check_compiler("linux_u32.c" AWS_LC_URANDOM_U32)
endif()
# Note clang-cl is odd and sets both CLANG and MSVC. We base our configuration
# primarily on our normal Clang one.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
Expand Down Expand Up @@ -359,6 +360,15 @@ if(GCC OR CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-array-bounds")
endif()

check_compiler("stdalign_check.c" AWS_LC_STDALIGN_AVAILABLE)
check_compiler("builtin_swap_check.c" AWS_LC_BUILTIN_SWAP_SUPPORTED)
if(FIPS AND NOT APPLE)
check_compiler("linux_u32.c" AWS_LC_URANDOM_U32)
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_CHECK_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_CHECK_FLAGS}")

elseif(MSVC)
set(MSVC_DISABLED_WARNINGS_LIST
"C4061" # enumerator 'identifier' in switch of enum 'enumeration' is not
Expand Down Expand Up @@ -692,20 +702,13 @@ else()
set(ARCH "generic")
endif()

if(ANDROID AND NOT ANDROID_NDK_REVISION AND ARCH STREQUAL "arm")
# The third-party Android-NDK CMake files somehow fail to set the -march flag
# for assembly files. Without this flag, the compiler believes that it's
# building for ARMv5.
set(CMAKE_ASM_FLAGS "-march=${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_ASM_FLAGS}")
endif()

if(USE_CUSTOM_LIBCXX)
if(NOT CLANG)
message(FATAL_ERROR "USE_CUSTOM_LIBCXX only supported with Clang")
endif()

# The docker images set an environement variable to the llvm project directory which the sandbox builds will use,
# you can also pass in the llvm project path as a CMake parameter which takes precedance over the environment variable
# The docker images set an environment variable to the llvm project directory which the sandbox builds will use,
# you can also pass in the llvm project path as a CMake parameter which takes precedence over the environment variable
if(DEFINED ENV{LLVM_PROJECT_HOME} AND NOT LLVM_PROJECT_HOME)
set(LLVM_PROJECT_HOME $ENV{LLVM_PROJECT_HOME})
endif()
Expand All @@ -729,7 +732,7 @@ if(USE_CUSTOM_LIBCXX)
# This is patterned after buildtools/third_party/libc++/BUILD.gn and
# buildtools/third_party/libc++abi/BUILD.gn in Chromium.

file(GLOB LIBCXX_SOURCES "${LLVM_PROJECT_HOME}/libcxx/src/*.cpp")
file(GLOB LIBCXX_SOURCES "${LLVM_PROJECT_HOME}/libcxx/src/*.cpp" "${LLVM_PROJECT_HOME}/libcxx/src/ryu/*.cpp")
file(GLOB LIBCXXABI_SOURCES "${LLVM_PROJECT_HOME}/libcxxabi/src/*.cpp")

# This file is meant for exception-less builds.
Expand All @@ -748,9 +751,6 @@ if(USE_CUSTOM_LIBCXX)
libcxxabi PRIVATE
-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
)
set_target_properties(libcxxabi PROPERTIES COMPILE_FLAGS "-Wno-missing-prototypes -Wno-implicit-fallthrough")
# libc++abi depends on libc++ internal headers.
set_property(TARGET libcxxabi APPEND PROPERTY INCLUDE_DIRECTORIES "${LLVM_PROJECT_HOME}/libcxx/src")

add_library(libcxx ${LIBCXX_SOURCES})
if(ASAN OR MSAN OR TSAN)
Expand All @@ -765,6 +765,15 @@ if(USE_CUSTOM_LIBCXX)
-D_LIBCPP_BUILDING_LIBRARY
-DLIBCXX_BUILDING_LIBCXXABI
)
set_target_properties(
libcxx libcxxabi PROPERTIES
COMPILE_FLAGS "-Wno-missing-prototypes -Wno-implicit-fallthrough"
# libc++ and libc++abi must be built in C++20 mode.
CXX_STANDARD 20
CXX_STANDARD_REQUIRED TRUE
)
# libc++abi depends on libc++ internal headers.
set_property(TARGET libcxx libcxxabi APPEND PROPERTY INCLUDE_DIRECTORIES "${LLVM_PROJECT_HOME}/libcxx/src")
target_link_libraries(libcxx libcxxabi)
endif()

Expand Down
7 changes: 6 additions & 1 deletion bindings/rust/aws-lc-fips-sys-template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/awslabs/aws-lc"
license = "Apache-2.0 OR ISC"
rust-version = "1.57.0"
include = [
"build.rs",
"build/**/*.rs",
"Cargo.toml",
"deps/aws-lc/**/*.c",
"deps/aws-lc/**/*.cc",
Expand All @@ -19,13 +19,17 @@ include = [
"deps/aws-lc/**/*.cmake",
"deps/aws-lc/**/*.errordata",
"deps/aws-lc/**/*.go",
"deps/aws-lc/**/*.mod",
"deps/aws-lc/**/*.sum",
"src/**/*.rs",
"tests/**/*.rs",
]
build = "build/main.rs"

[features]
asan = []
internal_generate = ["bindgen"] # Only for internal use, this line is removed prior to publishing.
ssl = []

[build-dependencies]
cmake = "0.1.48"
Expand All @@ -36,3 +40,4 @@ cfg_aliases = "0.1.1"

[dependencies]
libc = "0.2"
paste = "1.0.11"
39 changes: 39 additions & 0 deletions bindings/rust/aws-lc-fips-sys-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# aws-lc-fips-sys

[![crates.io](https://img.shields.io/crates/v/aws-lc-fips-sys.svg)](https://crates.io/crates/aws-lc-fips-sys)

Low level AWS-LC FIPS bindings for the Rust programming language. We do not recommend directly relying on these bindings.

[Documentation](https://github.com/awslabs/aws-lc).

## Release Support

This crate pulls in the source code of the latest AWS-LC FIPS branch to build with it. Bindings for platforms we officially support are pre-generated.
The platforms which `aws-lc-fips-sys` builds on is limited to the platforms where the AWS-LC FIPS static build is supported.

### Pregenerated Bindings Availability

CPU|OS
-------------|-------------
x86-64|Linux
arm-64|Linux

### Tested AWS-LC FIPS Build Environments

`aws-lc-fips-sys` currently relies on the AWS-LC FIPS static build, please see our CI documentation at [AWS-LC](https://github.com/awslabs/aws-lc/tree/main/tests/ci#unit-tests).

## Build Prerequisites

Since this crate builds AWS-LC as a native library, all build tools needed to build AWS-LC are applicable to `aws-lc-fips-sys` as well. This includes Go and Perl, which are hard dependencies for the AWS-LC FIPS build.

[Building AWS-LC](https://github.com/awslabs/aws-lc/blob/main/BUILDING.md)

If you use a different build combination for FIPS and would like us to support it, please open an issue to us at [AWS-LC](https://github.com/awslabs/aws-lc/issues/new?assignees=&labels=&template=build-issue.md&title=).

## Contribution

See contributing file at [AWS-LC](https://github.com/awslabs/aws-lc/blob/main/CONTRIBUTING.md)

## Licensing

See license at [AWS-LC](https://github.com/awslabs/aws-lc/blob/main/LICENSE)
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl ParseCallbacks for StripPrefixCallback {
}
}

fn prepare_clang_args(manifest_dir: &Path, build_prefix: Option<&str>) -> Vec<String> {
fn prepare_clang_args(manifest_dir: &Path, build_prefix: &Option<&str>) -> Vec<String> {
let mut clang_args: Vec<String> = vec![
"-I".to_string(),
get_include_path(manifest_dir).display().to_string(),
Expand All @@ -51,8 +51,15 @@ const PRELUDE: &str = r#"
#![allow(unused_imports, non_camel_case_types, non_snake_case, non_upper_case_globals, improper_ctypes)]
"#;

fn prepare_bindings_builder(manifest_dir: &Path, build_prefix: Option<&str>) -> bindgen::Builder {
let clang_args = prepare_clang_args(manifest_dir, build_prefix);
#[derive(Default)]
pub(crate) struct BindingOptions<'a> {
pub build_prefix: Option<&'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 mut builder = bindgen::Builder::default()
.derive_copy(true)
Expand All @@ -61,10 +68,7 @@ fn prepare_bindings_builder(manifest_dir: &Path, build_prefix: Option<&str>) ->
.derive_eq(true)
.allowlist_file(".*/openssl/[^/]+\\.h")
.allowlist_file(".*/rust_wrapper\\.h")
.default_enum_style(bindgen::EnumVariation::NewType {
is_bitfield: false,
is_global: false,
})
.rustified_enum("point_conversion_form_t")
.default_macro_constant_type(bindgen::MacroTypeVariation::Signed)
.generate_comments(true)
.fit_macro_constants(false)
Expand All @@ -74,15 +78,28 @@ fn prepare_bindings_builder(manifest_dir: &Path, build_prefix: Option<&str>) ->
.rustfmt_bindings(true)
.clang_args(clang_args)
.raw_line(COPYRIGHT)
.raw_line(PRELUDE)
.header(
get_include_path(manifest_dir)
.join("rust_wrapper.h")
.display()
.to_string(),
);

if let Some(ps) = build_prefix {
if !options.disable_prelude {
builder = builder.raw_line(PRELUDE);
}

if options.include_ssl {
builder = builder.header_contents(
"rust_ssl_wrapper.h",
"\
#include <openssl/ssl.h>
#include <openssl/ssl3.h>
",
);
}

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

Expand All @@ -91,13 +108,10 @@ fn prepare_bindings_builder(manifest_dir: &Path, build_prefix: Option<&str>) ->

pub(crate) fn generate_bindings(
manifest_dir: &Path,
build_prefix: Option<&str>,
output_name: &str,
) -> Result<(), &'static str> {
let bindings_file = manifest_dir.join("src").join(&output_name);
let builder = prepare_bindings_builder(&manifest_dir, build_prefix);
let bindings = builder.generate().expect("Unable to generate bindings.");
Ok(bindings
.write_to_file(bindings_file)
.expect("Unable to write bindings to file."))
options: BindingOptions<'_>,
) -> Result<bindgen::Bindings, &'static str> {
let bindings = prepare_bindings_builder(&manifest_dir, options)
.generate()
.expect("Unable to generate bindings.");
Ok(bindings)
}
Loading