Skip to content

Commit 1a1a6ff

Browse files
authored
Merge branch 'main' into support-WASM
2 parents f0ac48b + 3d314dc commit 1a1a6ff

33 files changed

Lines changed: 4307 additions & 580 deletions

.github/workflows/actions-ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,18 @@ jobs:
230230
run: cmake --build ./build --target run_tests
231231

232232
compiler-tests:
233-
name: x86-64 - ${{ matrix.compiler }} - ${{ (matrix.fips == 1 && 'FIPS') || 'non-FIPS' }}
233+
name: >-
234+
x86-64 - ${{ matrix.compiler }} -
235+
${{ (matrix.fips == 1 && 'FIPS') || 'non-FIPS' }} -
236+
${{ (matrix.shared == 1 && 'shared') || 'static' }}
234237
needs: [sanity-test-run]
235238
env:
236239
GOFLAGS: "-buildvcs=false"
237240
strategy:
238241
fail-fast: false
239242
matrix:
240243
fips: [0, 1]
244+
shared: [0, 1]
241245
compiler:
242246
- "gcc9"
243247
- "gcc10"
@@ -273,8 +277,8 @@ jobs:
273277
run: |
274278
echo "CC=gcc" >> $GITHUB_ENV
275279
echo "CXX=g++" >> $GITHUB_ENV
276-
- name: Setup ${{ (matrix.fips == 1 && 'FIPS') || 'non-FIPS' }} Build
277-
run: cmake -G Ninja -B ./build -DCMAKE_BUILD_TYPE=Release -DFIPS=${{matrix.fips}}
280+
- name: Setup Build
281+
run: cmake -G Ninja -B ./build -DCMAKE_BUILD_TYPE=Release -DFIPS=${{matrix.fips}} -DBUILD_SHARED_LIBS=${{matrix.shared}}
278282
- name: Build Project
279283
run: cmake --build ./build --target all
280284
- name: Run tests

.github/workflows/check-test-vectors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
if: steps.check_vectors.outputs.vectors_outdated == 'true'
4747
run: |
4848
previous_issue_number=$(gh issue list \
49-
--label "$LABELS" \
49+
--label 'vectors' \
5050
--json number \
5151
--jq '.[0].number')
5252
if [[ -n $previous_issue_number ]]; then

CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function(target_add_awslc_include_paths)
7979

8080
add_dependencies(${arg_TARGET} boringssl_prefix_symbols)
8181
target_include_directories(${arg_TARGET} BEFORE ${arg_SCOPE}
82-
$<$<BOOL:INCLUDE_PREFIX_HEADERS>:$<BUILD_INTERFACE:${AWSLC_BINARY_DIR}/symbol_prefix_include>>
82+
$<$<BOOL:${INCLUDE_PREFIX_HEADERS}>:$<BUILD_INTERFACE:${AWSLC_BINARY_DIR}/symbol_prefix_include>>
8383
$<BUILD_INTERFACE:${AWSLC_SOURCE_DIR}/include>
8484
$<INSTALL_INTERFACE:include>)
8585
endfunction()
@@ -344,10 +344,13 @@ elseif(BORINGSSL_PREFIX AND BORINGSSL_PREFIX_HEADERS)
344344
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
345345
COMPONENT Development
346346
)
347+
elseif(BORINGSSL_PREFIX AND BORINGSSL_PREFIX_SYMBOLS AND NOT GO_EXECUTABLE)
348+
# This case is reached when both BORINGSSL_PREFIX and BORINGSSL_PREFIX_SYMBOLS are set,
349+
# but GO_EXECUTABLE is not available (checked after the first if-branch).
350+
message(FATAL_ERROR "Must have Go installed when using BORINGSSL_PREFIX and BORINGSSL_PREFIX_SYMBOLS")
347351
elseif(BORINGSSL_PREFIX OR BORINGSSL_PREFIX_SYMBOLS)
352+
# Only one of BORINGSSL_PREFIX or BORINGSSL_PREFIX_SYMBOLS is set
348353
message(FATAL_ERROR "Must specify both or neither of BORINGSSL_PREFIX and BORINGSSL_PREFIX_SYMBOLS")
349-
elseif((BORINGSSL_PREFIX AND BORINGSSL_PREFIX_SYMBOLS) AND NOT GO_EXECUTABLE)
350-
message(FATAL_ERROR "Must have Go installed when using BORINGSSL_PREFIX and BORINGSSL_PREFIX_SYMBOLS")
351354
else()
352355
add_custom_target(boringssl_prefix_symbols)
353356

@@ -1341,7 +1344,7 @@ if(BUILD_TESTING)
13411344
DEPENDS all_tests
13421345
${MAYBE_USES_TERMINAL})
13431346
else()
1344-
add_custom_command(
1347+
add_custom_target(
13451348
run_minimal_tests
13461349
COMMAND crypto/crypto_test
13471350
COMMAND crypto/urandom_test

crypto/err/evp.errordata

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ EVP,107,EXPECTING_AN_RSA_KEY
1010
EVP,139,EXPECTING_A_DH_KEY
1111
EVP,108,EXPECTING_A_DSA_KEY
1212
EVP,106,EXPECTING_A_EC_KEY_KEY
13+
EVP,140,EXPECTING_A_PQDSA_KEY
1314
EVP,109,ILLEGAL_OR_UNSUPPORTED_PADDING_MODE
1415
EVP,137,INVALID_BUFFER_SIZE
1516
EVP,110,INVALID_DIGEST_LENGTH

crypto/evp_extra/p_pqdsa_test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ TEST_P(PQDSAParameterTest, KeyGen) {
16961696
ASSERT_TRUE(EVP_PKEY_keygen_init(ctx.get()));
16971697
ASSERT_TRUE(EVP_PKEY_keygen(ctx.get(), &raw));
16981698
ASSERT_TRUE(raw);
1699+
ASSERT_EQ(EVP_PKEY_pqdsa_get_type(raw), nid);
16991700
bssl::UniquePtr<EVP_PKEY> pkey(raw);
17001701

17011702
// ---- 2. Test key generation with PKEY as a template ----

crypto/fipsmodule/CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ if(ANDROID)
1515
# Clang reports that argument as unused. We remove the flag only for the FIPS build of Android.
1616
string(FIND ${CMAKE_CXX_FLAGS} "noexecstack" CXX_EXTRA_WA)
1717
string(FIND ${CMAKE_C_FLAGS} "noexecstack" C_EXTRA_WA)
18-
if(NOT ${CXX_EXTRA_WA} EQUAL '-1')
19-
string( REPLACE "-Wa,--noexecstack" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
18+
if(NOT CXX_EXTRA_WA EQUAL -1)
19+
string(REPLACE "-Wa,--noexecstack" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
2020
endif()
21-
if(NOT ${C_EXTRA_WA} EQUAL '-1')
22-
string( REPLACE "-Wa,--noexecstack" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" )
21+
if(NOT C_EXTRA_WA EQUAL -1)
22+
string(REPLACE "-Wa,--noexecstack" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
2323
endif()
2424
endif()
2525

@@ -551,6 +551,18 @@ elseif(FIPS_SHARED)
551551
target_compile_definitions(bcm_library PRIVATE BORINGSSL_IMPLEMENTATION S2N_BN_HIDE_SYMBOLS )
552552
target_add_awslc_include_paths(TARGET bcm_library SCOPE PRIVATE)
553553
target_include_directories(bcm_library PRIVATE "${S2N_BIGNUM_INCLUDE_DIR}")
554+
555+
# On GCC 14+ the Superword Level Parallelism (SLP) vectorizer causes the
556+
# compiler to aggressively store static function pointer addresses in the
557+
# .data.rel.ro.local section which is discarded by our linker script and
558+
# results in undefined references when linking libcrypto.
559+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
560+
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "14" AND
561+
CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
562+
ARCH STREQUAL "x86_64")
563+
target_compile_options(bcm_library PRIVATE -fno-tree-slp-vectorize)
564+
endif()
565+
554566
if (APPLE)
555567
set(BCM_NAME bcm.o)
556568
# The linker on macOS doesn't have the ability to process linker scripts,

crypto/fipsmodule/evp/evp.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#include "../../pem/internal.h"
7373
#include "../../console/internal.h"
7474
#include "../../internal.h"
75+
#include "../pqdsa/internal.h"
7576
#include "internal.h"
7677

7778

@@ -293,6 +294,18 @@ int EVP_PKEY_id(const EVP_PKEY *pkey) {
293294
return pkey->type;
294295
}
295296

297+
int EVP_PKEY_pqdsa_get_type(const EVP_PKEY *pkey) {
298+
SET_DIT_AUTO_RESET;
299+
if (pkey->type != EVP_PKEY_PQDSA) {
300+
OPENSSL_PUT_ERROR(EVP, EVP_R_EXPECTING_A_PQDSA_KEY);
301+
return 0;
302+
}
303+
if (!pkey->pkey.pqdsa_key || !pkey->pkey.pqdsa_key->pqdsa) {
304+
return 0;
305+
}
306+
return pkey->pkey.pqdsa_key->pqdsa->nid;
307+
}
308+
296309
int EVP_MD_get_pkey_type(const EVP_MD *md) {
297310
if (md) {
298311
int sig_nid = 0;

crypto/fipsmodule/evp/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ struct evp_pkey_st {
150150
DH *dh;
151151
EC_KEY *ec;
152152
KEM_KEY *kem_key;
153-
PQDSA_KEY * pqdsa_key;
153+
PQDSA_KEY *pqdsa_key;
154154
} pkey;
155155

156156
// ameth contains a pointer to a method table that contains many ASN.1
15.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)