Skip to content

Commit

Permalink
Merge branch 'main' into rawr-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail authored Jan 8, 2025
2 parents 856cee3 + c826c21 commit 5303f0a
Show file tree
Hide file tree
Showing 78 changed files with 3,875 additions and 2,771 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aws-lc-rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
GOPROXY: https://proxy.golang.org,direct
AWS_LC_SYS_CMAKE_BUILDER: 1
RUST_NIGHTLY_TOOLCHAIN: nightly
RUST_SCRIPT_NIGHTLY_TOOLCHAIN: nightly-2024-05-22
RUST_SCRIPT_NIGHTLY_TOOLCHAIN: nightly
jobs:
aws-lc-rs-bindgen:
if: github.repository_owner == 'aws'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- name: Install OS Dependencies
run: |
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none && sudo apt-get -y --no-install-recommends install cmake gcc ninja-build golang autoconf-archive libcmocka0 libcmocka-dev procps iproute2 build-essential git pkg-config gcc libtool automake libssl-dev uthash-dev autoconf doxygen libjson-c-dev libini-config-dev libcurl4-openssl-dev uuid-dev libltdl-dev libusb-1.0-0-dev libftdi-dev libglib2.0-dev pandoc
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none && sudo apt-get -y --no-install-recommends install cmake gcc ninja-build golang autoconf-archive libcmocka0 libcmocka-dev procps iproute2 build-essential git pkg-config gcc libtool automake libssl-dev uthash-dev autoconf doxygen libjson-c-dev libini-config-dev libcurl4-openssl-dev uuid-dev libltdl-dev libusb-1.0-0-dev libftdi-dev libglib2.0-dev pandoc libpsl-dev
- uses: actions/checkout@v3
- name: Run integration build
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/misc-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Install jq
- if: ${{ github.event.pull_request != null }}
name: Install jq
run: |
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
sudo apt-get install -y jq
- name: Check PR description
- if: ${{ github.event.pull_request != null }}
name: Check PR description
run: |
# License statement we want present.
LICENSE_STATEMENT="By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license."
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
set(GCC 1)
endif()

if (UNIX AND NOT APPLE)
if (NOT WIN32 AND NOT APPLE)
include(GNUInstallDirs)
elseif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
Expand All @@ -145,7 +145,7 @@ if(NOT DISABLE_PERL)
find_package(Perl REQUIRED)
endif()

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT CMAKE_CROSSCOMPILING)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND BUILD_TESTING AND NOT CMAKE_CROSSCOMPILING)
find_package(PkgConfig QUIET)
if (PkgConfig_FOUND)
pkg_check_modules(LIBUNWIND libunwind-generic)
Expand Down Expand Up @@ -737,7 +737,7 @@ if(FIPS)
message(FATAL_ERROR "Building AWS-LC for FIPS requires Go and Perl")
endif()

if(NOT BUILD_SHARED_LIBS AND NOT (UNIX AND NOT APPLE))
if(NOT BUILD_SHARED_LIBS AND NOT (NOT WIN32 AND NOT APPLE))
message(FATAL_ERROR "Static FIPS build of AWS-LC is suported only on Linux")
endif()

Expand Down
7 changes: 3 additions & 4 deletions crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function(msbuild_aarch64_asm)
endfunction()

if(NOT OPENSSL_NO_ASM)
if(UNIX)
if(NOT WIN32)
if(ARCH STREQUAL "aarch64")
# The "armx" Perl scripts look for "64" in the style argument
# in order to decide whether to generate 32- or 64-bit asm.
Expand Down Expand Up @@ -186,7 +186,7 @@ else()
set(ASSEMBLY_SOURCE ${GENERATE_CODE_ROOT}/ios-arm/crypto/)
elseif(APPLE)
set(ASSEMBLY_SOURCE ${GENERATE_CODE_ROOT}/mac-${ARCH}/crypto/)
elseif(UNIX)
elseif(NOT WIN32)
if(${ARCH} STREQUAL "generic")
message(STATUS "Detected generic linux platform. No assembly files will be included.")
else()
Expand Down Expand Up @@ -330,7 +330,6 @@ if(ENABLE_DILITHIUM)
DILITHIUM_SOURCES

evp_extra/p_pqdsa_asn1.c
dilithium/ml_dsa.c
)
endif()

Expand Down Expand Up @@ -778,13 +777,13 @@ if(BUILD_TESTING)
ecdh_extra/ecdh_test.cc
dh_extra/dh_test.cc
digest_extra/digest_test.cc
dilithium/p_pqdsa_test.cc
dsa/dsa_test.cc
des/des_test.cc
endian_test.cc
err/err_test.cc
evp_extra/evp_extra_test.cc
evp_extra/evp_test.cc
evp_extra/p_pqdsa_test.cc
evp_extra/scrypt_test.cc
fipsmodule/aes/aes_test.cc
fipsmodule/bn/bn_test.cc
Expand Down
18 changes: 12 additions & 6 deletions crypto/cipher_extra/aead_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -831,11 +831,17 @@ TEST_P(PerAEADTest, AliasedBuffers) {
EXPECT_EQ(Bytes(kPlaintext), Bytes(in, out_len));
}

#if defined(__BIGGEST_ALIGNMENT__)
#define UNALIGNED_TEST_ALIGNMENT __BIGGEST_ALIGNMENT__
#else
#define UNALIGNED_TEST_ALIGNMENT 8
#endif // defined(__BIGGEST_ALIGNMENT__)

TEST_P(PerAEADTest, UnalignedInput) {
alignas(16) uint8_t key[EVP_AEAD_MAX_KEY_LENGTH + 1];
alignas(16) uint8_t nonce[EVP_AEAD_MAX_NONCE_LENGTH + 1];
alignas(16) uint8_t plaintext[32 + 1];
alignas(16) uint8_t ad[32 + 1];
alignas(UNALIGNED_TEST_ALIGNMENT) uint8_t key[EVP_AEAD_MAX_KEY_LENGTH + 1];
alignas(UNALIGNED_TEST_ALIGNMENT) uint8_t nonce[EVP_AEAD_MAX_NONCE_LENGTH + 1];
alignas(UNALIGNED_TEST_ALIGNMENT) uint8_t plaintext[32 + 1];
alignas(UNALIGNED_TEST_ALIGNMENT) uint8_t ad[32 + 1];
OPENSSL_memset(key, 'K', sizeof(key));
OPENSSL_memset(nonce, 'N', sizeof(nonce));
OPENSSL_memset(plaintext, 'P', sizeof(plaintext));
Expand All @@ -854,15 +860,15 @@ TEST_P(PerAEADTest, UnalignedInput) {
ASSERT_TRUE(EVP_AEAD_CTX_init_with_direction(
ctx.get(), aead(), key + 1, key_len, EVP_AEAD_DEFAULT_TAG_LENGTH,
evp_aead_seal));
alignas(16) uint8_t ciphertext[sizeof(plaintext) + EVP_AEAD_MAX_OVERHEAD];
alignas(UNALIGNED_TEST_ALIGNMENT) uint8_t ciphertext[sizeof(plaintext) + EVP_AEAD_MAX_OVERHEAD];
size_t ciphertext_len;
ASSERT_TRUE(EVP_AEAD_CTX_seal(ctx.get(), ciphertext + 1, &ciphertext_len,
sizeof(ciphertext) - 1, nonce + 1, nonce_len,
plaintext + 1, sizeof(plaintext) - 1, ad + 1,
ad_len));

// It must successfully decrypt.
alignas(16) uint8_t out[sizeof(ciphertext)];
alignas(UNALIGNED_TEST_ALIGNMENT) uint8_t out[sizeof(ciphertext)];
ctx.Reset();
ASSERT_TRUE(EVP_AEAD_CTX_init_with_direction(
ctx.get(), aead(), key + 1, key_len, EVP_AEAD_DEFAULT_TAG_LENGTH,
Expand Down
8 changes: 8 additions & 0 deletions crypto/crypto_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ TEST(CryptoTest, Strndup) {
EXPECT_STREQ("", str.get());
}

TEST(CryptoTest, aws_lc_assert_entropy_cpu_jitter) {
#if defined(FIPS_ENTROPY_SOURCE_JITTER_CPU)
ASSERT_EQ(1, FIPS_is_entropy_cpu_jitter());
#else
ASSERT_EQ(0, FIPS_is_entropy_cpu_jitter());
#endif
}

TEST(CryptoTest, OPENSSL_hexstr2buf) {
const char *test_cases[][2] = {{"a2", "\xa2"},
{"a213", "\xa2\x13"},
Expand Down
11 changes: 0 additions & 11 deletions crypto/dilithium/pqcrystals_dilithium_ref_common/ntt.h

This file was deleted.

48 changes: 0 additions & 48 deletions crypto/dilithium/pqcrystals_dilithium_ref_common/packing.h

This file was deleted.

74 changes: 0 additions & 74 deletions crypto/dilithium/pqcrystals_dilithium_ref_common/poly.h

This file was deleted.

Loading

0 comments on commit 5303f0a

Please sign in to comment.