Skip to content

Commit 4d99dbb

Browse files
authored
Merge branch 'main' into dgst-cli
2 parents 5faf0b0 + a66b1de commit 4d99dbb

File tree

17 files changed

+449
-187
lines changed

17 files changed

+449
-187
lines changed

.github/workflows/actions-ci.yml

Lines changed: 290 additions & 81 deletions
Large diffs are not rendered by default.

CMakeLists.txt

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cmake_policy(SET CMP0091 NEW)
55
endif()
66

77
set(SOFTWARE_NAME "awslc")
8-
set(SOFTWARE_VERSION "1.60.0")
8+
set(SOFTWARE_VERSION "1.61.0")
99
set(ABI_VERSION 0)
1010
set(CRYPTO_LIB_NAME "crypto")
1111
set(SSL_LIB_NAME "ssl")
@@ -31,6 +31,26 @@ endif()
3131

3232
include(sources.cmake)
3333
include(TestBigEndian)
34+
include(CheckCCompilerFlag)
35+
36+
macro(add_flag_if_supported VARIABLE FLAG)
37+
# Create a safe, unique variable name to cache the result of the check
38+
string(MAKE_C_IDENTIFIER "HAVE_C_FLAG_${FLAG}" _CHECK_VAR_NAME)
39+
40+
# Keep configure output tidy
41+
set(CMAKE_REQUIRED_QUIET ${CMAKE_NOT_VERBOSE})
42+
43+
# Run the check only once to speed up re-configuration
44+
if(NOT DEFINED ${_CHECK_VAR_NAME})
45+
check_c_compiler_flag("${FLAG}" ${_CHECK_VAR_NAME})
46+
endif()
47+
48+
# If the check passed, append the flag to the specified variable
49+
if(${_CHECK_VAR_NAME})
50+
set(${VARIABLE} "${${VARIABLE}} ${FLAG}")
51+
message(STATUS "Compiler supports '${FLAG}', adding to ${VARIABLE}")
52+
endif()
53+
endmacro()
3454

3555
if(POLICY CMP0077)
3656
cmake_policy(SET CMP0077 NEW) #option does nothing when a normal variable of the same name exists.
@@ -474,12 +494,9 @@ if(GCC OR CLANG)
474494
endif()
475495
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings")
476496

477-
if((GCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "8") OR
478-
(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13"))
479-
# GCC 8.x added a warning called -Wcast-function-type to the -Wextra umbrella.
480-
# Also suppress for all clang versions supporting this warning.
481-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-cast-function-type")
482-
endif()
497+
# GCC 8.x added a warning called -Wcast-function-type to the -Wextra umbrella.
498+
# Also suppress for all clang versions supporting this warning.
499+
add_flag_if_supported(CMAKE_C_FLAGS "-Wno-cast-function-type")
483500

484501
if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug" OR CMAKE_BUILD_TYPE_LOWER STREQUAL "relwithdebinfo")
485502
if (MSVC)
@@ -503,31 +520,24 @@ if(GCC OR CLANG)
503520

504521
if(CLANG)
505522
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wnewline-eof -fcolor-diagnostics")
506-
elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.1.3")
523+
else()
507524
# GCC (at least 4.8.4) has a bug where it'll find unreachable free() calls
508525
# and declare that the code is trying to free a stack pointer. GCC 4.1.3 and lower
509526
# doesn't support this flag and can't use it.
510-
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-free-nonheap-object")
527+
add_flag_if_supported(C_CXX_FLAGS "-Wno-free-nonheap-object")
511528
# GCC (from at least 4.8) does not include -Wmissing-braces in -Wall due to Bug 25137.
512529
# This warning is turned on everywhere internally however, so we have to define it here
513530
# to check that our changes don't break the build.
514531
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25137
515-
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wmissing-braces")
532+
add_flag_if_supported(C_CXX_FLAGS "-Wmissing-braces")
516533
endif()
517534

518535
# -Wstring-concatenation was added in Clang 12.0.0, which corresponds to
519536
# AppleClang 13.0.0 per the table in
520537
# https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
521-
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND
522-
NOT(CMAKE_C_COMPILER_VERSION VERSION_LESS "12.0.0")) OR
523-
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND
524-
NOT(CMAKE_C_COMPILER_VERSION VERSION_LESS "13.0.0")))
525-
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wstring-concatenation")
526-
endif()
538+
add_flag_if_supported(C_CXX_FLAGS "-Wstring-concatenation")
527539

528-
if(CLANG OR NOT "7.0.0" VERSION_GREATER CMAKE_C_COMPILER_VERSION)
529-
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wimplicit-fallthrough")
530-
endif()
540+
add_flag_if_supported(C_CXX_FLAGS "-Wimplicit-fallthrough")
531541

532542
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5")
533543
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wformat-signedness")
@@ -674,11 +684,7 @@ if(WIN32)
674684
add_definitions("-D_STL_EXTRA_DISABLED_WARNINGS=4774 4987")
675685
endif()
676686

677-
if((GCC AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.9.99") OR
678-
CLANG)
679-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
680-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
681-
endif()
687+
add_flag_if_supported(C_CXX_FLAGS "-Wshadow")
682688

683689
# pthread_rwlock_t on Linux requires a feature flag. We limit this to Linux
684690
# because, on Apple platforms, it instead disables APIs we use. See compat(5)

crypto/fipsmodule/bcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static void BORINGSSL_maybe_set_module_text_permissions(int permission) {
246246
perror("BoringSSL: mprotect");
247247
}
248248
}
249-
#else
249+
#elif !defined(OPENSSL_WINDOWS)
250250
static void BORINGSSL_maybe_set_module_text_permissions(int _permission) {}
251251
#endif // !ANDROID
252252

crypto/fipsmodule/evp/evp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ int EVP_read_pw_string_min(char *buf, int min_length, int length,
171171
int ret = -1;
172172
char verify_buf[1024];
173173

174-
if (!buf || min_length <= 0 || min_length >= length) {
174+
if (!buf || min_length < 0 || min_length >= length) {
175175
return -1;
176176
}
177177

crypto/fipsmodule/ml_kem/ml_kem_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct MLKEMKeypairTestVector {
4242
};
4343

4444

45-
static constexpr MLKEMKeypairTestVector keypairParameterSet[] = {
45+
static const MLKEMKeypairTestVector keypairParameterSet[] = {
4646
{
4747
MLKEM512_PUBLIC_KEY_BYTES,
4848
MLKEM512_SECRET_KEY_BYTES,
@@ -516,7 +516,7 @@ struct MLKEMEncapsulateTestVector {
516516
int (*encapsulate)(uint8_t *ciphertext, size_t *ciphertext_len, uint8_t *shared_secret, size_t *shared_secret_len, const uint8_t *public_key);
517517
};
518518

519-
static constexpr MLKEMEncapsulateTestVector encapsulateParameterSet[] = {
519+
static const MLKEMEncapsulateTestVector encapsulateParameterSet[] = {
520520
{
521521
MLKEM512_CIPHERTEXT_BYTES,
522522
MLKEM512_SHARED_SECRET_LEN,
@@ -1571,7 +1571,7 @@ struct MLKEMDecapsulateTestVector {
15711571
int (*decapsulate)(uint8_t *shared_secret, size_t *shared_secret_len, const uint8_t *ciphertext, const uint8_t *secret_key);
15721572
};
15731573

1574-
static constexpr MLKEMDecapsulateTestVector decapsulateParameterSet[] = {
1574+
static const MLKEMDecapsulateTestVector decapsulateParameterSet[] = {
15751575
{
15761576
MLKEM512_SHARED_SECRET_LEN,
15771577
ciphertext512,

crypto/pem/pem_pkey.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
109109
cb = PEM_def_callback;
110110
}
111111
int pass_len = cb(psbuf, PEM_BUFSIZE, 0, u);
112-
if (pass_len <= 0) {
112+
if (pass_len < 0) {
113113
OPENSSL_PUT_ERROR(PEM, PEM_R_BAD_PASSWORD_READ);
114114
X509_SIG_free(p8);
115115
goto err;

include/openssl/base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ extern "C" {
122122
// ServiceIndicatorTest.AWSLCVersionString
123123
// Note: there are two versions of this test. Only one test is compiled
124124
// depending on FIPS mode.
125-
#define AWSLC_VERSION_NUMBER_STRING "1.60.0"
125+
#define AWSLC_VERSION_NUMBER_STRING "1.61.0"
126126

127127
#if defined(BORINGSSL_SHARED_LIBRARY)
128128

tests/ci/cdk/cdk/codebuild/github_ci_integration_omnibus.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ batch:
311311
variables:
312312
AWS_LC_CI_TARGET: "tests/ci/integration/run_cyrus_sasl_integration.sh"
313313

314-
- identifier: amazon_corretto_crypto_provider_integration_x86_64
314+
- identifier: amazon_corretto_crypto_provider_nonfips_integration_x86_64
315315
buildspec: tests/ci/codebuild/common/run_simple_target.yml
316316
env:
317317
type: LINUX_CONTAINER
@@ -320,6 +320,18 @@ batch:
320320
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-22.04_gcc-12x_integration_latest
321321
variables:
322322
AWS_LC_CI_TARGET: "tests/ci/integration/run_accp_integration.sh"
323+
ACCP_FIPS: "false"
324+
325+
- identifier: amazon_corretto_crypto_provider_fips_integration_x86_64
326+
buildspec: tests/ci/codebuild/common/run_simple_target.yml
327+
env:
328+
type: LINUX_CONTAINER
329+
privileged-mode: false
330+
compute-type: BUILD_GENERAL1_2XLARGE
331+
image: 620771051181.dkr.ecr.us-west-2.amazonaws.com/aws-lc-docker-images-linux-x86:ubuntu-22.04_gcc-12x_integration_latest
332+
variables:
333+
AWS_LC_CI_TARGET: "tests/ci/integration/run_accp_integration.sh"
334+
ACCP_FIPS: "true"
323335

324336
- identifier: nmap_integration_x86_64
325337
buildspec: tests/ci/codebuild/common/run_simple_target.yml

tests/ci/codebuild/common/run_x509_limbo_reports_target.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ env:
88
GOPROXY: https://proxy.golang.org,direct
99

1010
phases:
11-
install:
12-
commands:
13-
- nohup /usr/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 &
14-
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
1511
build:
1612
commands:
1713
- "./${AWS_LC_CI_TARGET}"

tests/ci/docker_images/linux-x86/amazonlinux-2023_base/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ RUN set -ex && \
3333
valgrind \
3434
# valgrind/memcheck.h is provided by the valgrind-devel package on AL2. see P63119011.
3535
valgrind-devel \
36-
unzip && \
36+
unzip \
37+
patch \
38+
jq && \
3739
wget https://raw.githubusercontent.com/aws/aws-codebuild-docker-images/master/al/x86_64/standard/5.0/amazon-ssm-agent.json -P /etc/amazon/ssm/ && \
3840
# Based on https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html
3941
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \

0 commit comments

Comments
 (0)