From 18e80e1a994423c810ff0d86820c4eb3775aff8e Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 09:26:47 -0400 Subject: [PATCH 01/16] Adding clang job matrix and enabling symbol checking --- .github/workflows/build-test.yaml | 33 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 208d60fc..698e02cf 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -35,7 +35,8 @@ jobs: fail-fast: false matrix: os: ['ubuntu-24.04', 'centos-9'] - name: Unit Test (os=${{matrix.os}}) + compiler: ['gcc', 'clang'] + name: Unit Test (${{matrix.os}} ${{matrix.compiler}}) runs-on: ${{ matrix.os == 'centos-9' && 'ubuntu-24.04' || matrix.os }} container: ${{ matrix.os == 'centos-9' && 'quay.io/centos/centos:stream9' || null }} permissions: @@ -47,9 +48,9 @@ jobs: run: | sudo apt-get update && \ sudo apt-get install -y \ - cmake ninja-build ruby build-essential \ + cmake ninja-build ruby gcc g++ ccache patch \ libssl-dev \ - valgrind gcovr xmlstarlet + ${{matrix.compiler=='clang' && 'clang llvm' || ''}} \ valgrind gcovr xmlstarlet - name: Set up OS if: startsWith(matrix.os, 'centos') run: | @@ -60,7 +61,7 @@ jobs: cmake ninja-build \ ruby pkg-config gcc gcc-c++ ccache patch \ openssl-devel \ - valgrind xmlstarlet python3-pip + ${{matrix.compiler=='clang' && 'clang llvm' || ''}} \ valgrind xmlstarlet python3-pip pip3 install gcovr - name: Checkout repository uses: actions/checkout@v4 @@ -74,7 +75,10 @@ jobs: - name: Dependencies run: ./build.sh deps - name: Prep - run: ./build.sh prep -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DBUILD_TESTING=ON + run: | + ./build.sh prep \ + ${{matrix.compiler=='clang' && '-DCMAKE_C_COMPILER=clang' || ''}} \ + -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DBUILD_TESTING=ON - name: Build run: ./build.sh - name: Test @@ -84,7 +88,7 @@ jobs: - name: Archive coverage uses: actions/upload-artifact@v4 with: - name: ${{github.job}}-${{matrix.os}}-coverage + name: ${{github.job}}-${{matrix.os}}-${{matrix.compiler}}-coverage path: build/default/coverage* - name: Report coverage run: | @@ -92,21 +96,22 @@ jobs: echo "Source coverage: ${SRC_COV_PERC}%" >> $GITHUB_STEP_SUMMARY mock-bpa-test: - name: Mock BPA Test (os=ubunntu-24.04) + name: Mock BPA Test (ubunntu-24.04 gcc) runs-on: ubuntu-24.04 permissions: contents: read actions: write steps: - name: Set up OS - run: > - sudo apt-get update && sudo apt-get install -y - cmake ninja-build ruby build-essential - libssl-dev + run: | + sudo apt-get update && sudo apt-get install -y \ + cmake ninja-build ruby gcc g++ ccache patch \ + libssl-dev \ valgrind gcovr xmlstarlet - name: Checkout repository uses: actions/checkout@v4 with: + fetch-depth: 0 submodules: recursive - name: ccache uses: hendrikmuhs/ccache-action@v1.2 @@ -121,7 +126,11 @@ jobs: - name: Install run: ./build.sh install - name: Check symbols - run: echo ./check_symbols.py bsl #FIXME replace + run: | + ./check_symbols.py --prefix bsl_ -- bsl_front bsl_backend bsl_crypto + ./check_symbols.py --prefix bslx_ -- bsl_default_sc + ./check_symbols.py --prefix bslp_ -- bsl_sample_pp + ./check_symbols.py -- bsl_mock_bpa - name: Test Prep run: | sudo apt-get update && sudo apt-get install -y \ From 3b7fe35af925cec7deb75df55a3f3d0e134baca1 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 09:32:58 -0400 Subject: [PATCH 02/16] Fix indentation, fix deps environment --- .github/workflows/build-test.yaml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 698e02cf..b1988f69 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -42,15 +42,20 @@ jobs: permissions: contents: read actions: write + env: + CC: ${{matrix.compiler=='clang' && 'clang' || 'gcc'}} + CXX: ${{matrix.compiler=='clang' && 'clang++' || 'g++'}} steps: - name: Set up OS if: startsWith(matrix.os, 'ubuntu') run: | sudo apt-get update && \ sudo apt-get install -y \ - cmake ninja-build ruby gcc g++ ccache patch \ + cmake ninja-build \ + ruby pkg-config ccache patch \ + ${{matrix.compiler=='clang' && 'clang llvm' || 'gcc g++'}} \ libssl-dev \ - ${{matrix.compiler=='clang' && 'clang llvm' || ''}} \ valgrind gcovr xmlstarlet + valgrind gcovr xmlstarlet - name: Set up OS if: startsWith(matrix.os, 'centos') run: | @@ -59,9 +64,10 @@ jobs: dnf install -y \ git rsync \ cmake ninja-build \ - ruby pkg-config gcc gcc-c++ ccache patch \ + ruby pkg-config ccache patch \ + ${{matrix.compiler=='clang' && 'clang llvm' || 'gcc gcc-c++'}} \ openssl-devel \ - ${{matrix.compiler=='clang' && 'clang llvm' || ''}} \ valgrind xmlstarlet python3-pip + valgrind xmlstarlet python3-pip pip3 install gcovr - name: Checkout repository uses: actions/checkout@v4 @@ -77,7 +83,6 @@ jobs: - name: Prep run: | ./build.sh prep \ - ${{matrix.compiler=='clang' && '-DCMAKE_C_COMPILER=clang' || ''}} \ -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DBUILD_TESTING=ON - name: Build run: ./build.sh From 7d66f9df62de70434112e487b9cf9f52c843738a Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 09:35:52 -0400 Subject: [PATCH 03/16] Fix typos --- .github/workflows/build-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index b1988f69..90c9d8b9 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -101,7 +101,7 @@ jobs: echo "Source coverage: ${SRC_COV_PERC}%" >> $GITHUB_STEP_SUMMARY mock-bpa-test: - name: Mock BPA Test (ubunntu-24.04 gcc) + name: Mock BPA Test (ubuntu-24.04 gcc) runs-on: ubuntu-24.04 permissions: contents: read @@ -132,7 +132,7 @@ jobs: run: ./build.sh install - name: Check symbols run: | - ./check_symbols.py --prefix bsl_ -- bsl_front bsl_backend bsl_crypto + ./check_symbols.py --prefix bsl_ -- bsl_front bsl_dynamic bsl_crypto ./check_symbols.py --prefix bslx_ -- bsl_default_sc ./check_symbols.py --prefix bslp_ -- bsl_sample_pp ./check_symbols.py -- bsl_mock_bpa From 90921f3d28d846511628d098495f61561054ec1d Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 09:40:10 -0400 Subject: [PATCH 04/16] Compiler specific options --- CMakeLists.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a7e041a..89c0d6b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,23 +80,25 @@ add_compile_options( -Werror -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wcast-align - -Wformat=2 -Wswitch-enum -Wlogical-op -Wduplicated-branches + -Wformat=2 -Wswitch-enum -fno-strict-aliasing -Werror=format-security -fno-common -Wstrict-aliasing=2 # -Wconversion ) -# LEON safe options add_compile_options( -ffunction-sections -fdata-sections -fno-omit-frame-pointer $<$:-fno-exceptions> - $<$:-fno-enforce-eh-specs> - $<$:-fnothrow-opt> ) if(CMAKE_C_COMPILER_ID MATCHES "GNU") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0") + add_compile_options( + -Wlogical-op -Wduplicated-branches + $<$:-fno-enforce-eh-specs> + $<$:-fnothrow-opt> + ) elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-4") endif() @@ -108,11 +110,6 @@ add_custom_target(clang-tidy COMMENT "Running clang-tidy..." ) -# Force specific POSIX compatibility version -add_definitions( - "-D_POSIX_C_SOURCE=200809L" -) - if(BUILD_LIB) find_package(MLIB REQUIRED) find_package(QCBOR REQUIRED) From 29be196d7b027b11da7844a36cc8c34e0972e6e8 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 09:44:20 -0400 Subject: [PATCH 05/16] Check symbols for all build variations --- .github/workflows/build-test.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 90c9d8b9..4c4a8159 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -86,6 +86,15 @@ jobs: -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DBUILD_TESTING=ON - name: Build run: ./build.sh + - name: Install + run: ./build.sh install + - name: Check symbols + run: | + ./check_symbols.py --prefix bsl_ -- bsl_front bsl_dynamic + ./check_symbols.py --prefix bsl_ bslb_ -- bsl_crypto + ./check_symbols.py --prefix bslx_ -- bsl_default_sc + ./check_symbols.py --prefix bslp_ -- bsl_sample_pp + ./check_symbols.py -- bsl_mock_bpa - name: Test run: ./build.sh check - name: Collect coverage @@ -130,12 +139,6 @@ jobs: run: ./build.sh - name: Install run: ./build.sh install - - name: Check symbols - run: | - ./check_symbols.py --prefix bsl_ -- bsl_front bsl_dynamic bsl_crypto - ./check_symbols.py --prefix bslx_ -- bsl_default_sc - ./check_symbols.py --prefix bslp_ -- bsl_sample_pp - ./check_symbols.py -- bsl_mock_bpa - name: Test Prep run: | sudo apt-get update && sudo apt-get install -y \ From 5c26251e34c28de6281f6d90fc562cd298c71806 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 10:06:39 -0400 Subject: [PATCH 06/16] Fixing clang-identified genuine errors --- src/backend/AbsSecBlock.c | 2 +- src/backend/PublicInterfaceImpl.c | 2 +- src/backend/SecOperation.h | 2 +- src/backend/SecOutcome.c | 2 +- src/backend/SecParam.c | 2 +- src/backend/SecurityResultSet.c | 2 +- src/crypto/CryptoInterface.c | 9 ++++---- src/mock_bpa/BPSecLib_MockBPA.h | 2 +- src/mock_bpa/bsl_mock_bpa_crc.c | 34 +++++++++++++++++-------------- src/mock_bpa/mock_bpa.c | 16 +++++++-------- test/test_BackendPolicyProvider.c | 2 +- test/test_MockBPA_EID.c | 2 +- 12 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/backend/AbsSecBlock.c b/src/backend/AbsSecBlock.c index 6d84fbf4..3d43a430 100644 --- a/src/backend/AbsSecBlock.c +++ b/src/backend/AbsSecBlock.c @@ -490,4 +490,4 @@ int BSL_AbsSecBlock_DecodeFromCBOR(BSL_AbsSecBlock_t *self, BSL_Data_t encoded_c ASSERT_POSTCONDITION(BSL_AbsSecBlock_IsConsistent(self)); return BSL_SUCCESS; -} \ No newline at end of file +} diff --git a/src/backend/PublicInterfaceImpl.c b/src/backend/PublicInterfaceImpl.c index ef76e83b..2b385f8b 100644 --- a/src/backend/PublicInterfaceImpl.c +++ b/src/backend/PublicInterfaceImpl.c @@ -257,4 +257,4 @@ int BSL_API_ApplySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityResponseSet_t *re // TODO CHK_POSTCONDITION return (must_drop) ? BSL_ERR_SECURITY_OPERATION_FAILED : BSL_SUCCESS; -} \ No newline at end of file +} diff --git a/src/backend/SecOperation.h b/src/backend/SecOperation.h index dae1384e..db2ec7cf 100644 --- a/src/backend/SecOperation.h +++ b/src/backend/SecOperation.h @@ -60,4 +60,4 @@ struct BSL_SecOper_s LIST_DEF(BSLB_SecOperList, BSL_SecOper_t, M_POD_OPLIST) // NOLINTEND -#endif /* BSLB_SECOPERATIONS_H_ */ \ No newline at end of file +#endif /* BSLB_SECOPERATIONS_H_ */ diff --git a/src/backend/SecOutcome.c b/src/backend/SecOutcome.c index 8a811c1b..27a98126 100644 --- a/src/backend/SecOutcome.c +++ b/src/backend/SecOutcome.c @@ -189,4 +189,4 @@ bool BSL_SecOutcome_IsInAbsSecBlock(const BSL_SecOutcome_t *self, const BSL_AbsS } BSL_LOG_DEBUG("Checking results: %lu expected, %lu found", expected_matches, found_matches); return (expected_matches == found_matches) && (found_matches > 0); -} \ No newline at end of file +} diff --git a/src/backend/SecParam.c b/src/backend/SecParam.c index 5b491791..c63360e0 100644 --- a/src/backend/SecParam.c +++ b/src/backend/SecParam.c @@ -127,4 +127,4 @@ bool BSL_SecParam_IsParamIDOutput(uint64_t param_id) // If this index is less than the start index for numbering // internal param ids, then it's probably a param_id from the spec. return param_id < BSL_SECPARAM_TYPE_INT_STARTINDEX; -} \ No newline at end of file +} diff --git a/src/backend/SecurityResultSet.c b/src/backend/SecurityResultSet.c index 7cfe3275..0262188c 100644 --- a/src/backend/SecurityResultSet.c +++ b/src/backend/SecurityResultSet.c @@ -25,7 +25,7 @@ */ #include "SecurityResultSet.h" -size_t BSL_SecurityResponseSet_Sizeof() +size_t BSL_SecurityResponseSet_Sizeof(void) { return sizeof(BSL_SecurityResponseSet_t); } diff --git a/src/crypto/CryptoInterface.c b/src/crypto/CryptoInterface.c index 89f92f4e..770d2a78 100644 --- a/src/crypto/CryptoInterface.c +++ b/src/crypto/CryptoInterface.c @@ -386,13 +386,14 @@ int BSL_Cipher_FinalizeSeq(BSL_Cipher_t *cipher_ctx, BSL_SeqWriter_t *writer) // finalize can add 1 cipher block uint8_t buf[EVP_CIPHER_CTX_block_size(cipher_ctx->libhandle)]; - int len = 0; - int res = EVP_CipherFinal_ex(cipher_ctx->libhandle, buf, &len); + int evp_len = 0; + int res = EVP_CipherFinal_ex(cipher_ctx->libhandle, buf, &evp_len); CHK_PROPERTY(res == 1); - if (len > 0) + if (evp_len > 0) { - BSL_SeqWriter_Put(writer, buf, (size_t *)&len); + size_t bsl_len = evp_len; + BSL_SeqWriter_Put(writer, buf, &bsl_len); } return 0; diff --git a/src/mock_bpa/BPSecLib_MockBPA.h b/src/mock_bpa/BPSecLib_MockBPA.h index dfac2faa..7e6b8150 100644 --- a/src/mock_bpa/BPSecLib_MockBPA.h +++ b/src/mock_bpa/BPSecLib_MockBPA.h @@ -28,4 +28,4 @@ #include "bsl_mock_bpa_eidpat.h" #include "bsl_mock_bpa.h" -#endif //_BSL_MockBPA_BPSECLIB_MockBPA_H_ \ No newline at end of file +#endif //_BSL_MockBPA_BPSECLIB_MockBPA_H_ diff --git a/src/mock_bpa/bsl_mock_bpa_crc.c b/src/mock_bpa/bsl_mock_bpa_crc.c index 9dd06a26..4d19433a 100644 --- a/src/mock_bpa/bsl_mock_bpa_crc.c +++ b/src/mock_bpa/bsl_mock_bpa_crc.c @@ -63,20 +63,24 @@ void mock_bpa_crc_apply(UsefulBuf buf, size_t begin, size_t end, BSL_BundleCRCTy { case BSL_BUNDLECRCTYPE_16: { - uint16_t *crc_enc = (uint16_t *)endptr - 1; // less one crc value + uint8_t *crc_pos = endptr - 2; // less one crc value const uint16_t crc_val = bp_crc16(blk_enc); - - *crc_enc = htons(crc_val); + // Network byte order + crc_pos[0] = (crc_val >> 16) & 0xFF; + crc_pos[1] = crc_val & 0xFF; break; } case BSL_BUNDLECRCTYPE_32: { - uint32_t *crc_enc = (uint32_t *)endptr - 1; // less one crc value + uint8_t *crc_pos = endptr - 4; // less one crc value const uint32_t crc_val = bp_crc32(blk_enc); - - *crc_enc = htonl(crc_val); + // Network byte order + crc_pos[0] = (crc_val >> 24) & 0xFF; + crc_pos[1] = (crc_val >> 16) & 0xFF; + crc_pos[2] = (crc_val >> 8) & 0xFF; + crc_pos[3] = crc_val & 0xFF; break; } case BSL_BUNDLECRCTYPE_NONE: @@ -108,21 +112,21 @@ bool mock_bpa_crc_check(UsefulBufC buf, size_t begin, size_t end, BSL_BundleCRCT { case BSL_BUNDLECRCTYPE_16: { - const uint16_t *crc_enc = (uint16_t *)endptr - 1; // less one crc value - // copy of original for reference - const uint16_t orig_val = ntohs(*crc_enc); - const uint16_t crc_val = bp_crc16(blk_enc); - same = (crc_val == orig_val); + const uint8_t *crc_pos = endptr - 2; // less one crc value + + const uint16_t crc_val = bp_crc16(blk_enc); + // Network byte order + same = ((crc_pos[0] == ((crc_val >> 16) & 0xFF)) && (crc_pos[1] == (crc_val & 0xFF))); break; } case BSL_BUNDLECRCTYPE_32: { - const uint32_t *crc_enc = (uint32_t *)endptr - 1; // less one crc value - // copy of original for reference - const uint32_t orig_val = ntohs(*crc_enc); + const uint8_t *crc_pos = endptr - 4; // less one crc value const uint16_t crc_val = bp_crc32(blk_enc); - same = (crc_val == orig_val); + // Network byte order + same = ((crc_pos[0] == ((crc_val >> 24) & 0xFF)) && (crc_pos[1] == ((crc_val >> 16) & 0xFF)) + && (crc_pos[2] == ((crc_val >> 8) & 0xFF)) && (crc_pos[3] == (crc_val & 0xFF))); break; } case BSL_BUNDLECRCTYPE_NONE: diff --git a/src/mock_bpa/mock_bpa.c b/src/mock_bpa/mock_bpa.c index e014421c..acf4f3ab 100644 --- a/src/mock_bpa/mock_bpa.c +++ b/src/mock_bpa/mock_bpa.c @@ -69,11 +69,11 @@ static struct sockaddr_in6 router_addr = { .sin6_family = 0 }; static int tx_notify_r, tx_notify_w; static BSL_HostEID_t sec_eid; -static int ingest_netaddr(struct sockaddr_in6 *addr, const char *optarg) +static int ingest_netaddr(struct sockaddr_in6 *addr, const char *arg) { - const char *node = optarg; + const char *node = arg; const char *service = "4556"; - char *sep = strchr(optarg, ':'); + char *sep = strchr(arg, ':'); if (sep) { *sep = '\0'; @@ -91,7 +91,7 @@ static int ingest_netaddr(struct sockaddr_in6 *addr, const char *optarg) int res = getaddrinfo(node, service, &hints, &result); if (res) { - BSL_LOG_ERR("Failed to resolve router address: %s", optarg); + BSL_LOG_ERR("Failed to resolve router address: %s", arg); return 1; } else @@ -519,9 +519,9 @@ static void bpa_cleanup(void) mock_bpa_ctr_t item; // join RX workers first - // mock_bpa_ctr_init(&item); + mock_bpa_ctr_init(&item); data_queue_push(under_rx, item); - // mock_bpa_ctr_init(&item); + mock_bpa_ctr_init(&item); data_queue_push(over_rx, item); if (pthread_join(thr_under_rx, NULL)) { @@ -533,9 +533,9 @@ static void bpa_cleanup(void) } // then delivery/forward workers after RX are all flushed - // mock_bpa_ctr_init(&item); + mock_bpa_ctr_init(&item); data_queue_push(forward, item); - // mock_bpa_ctr_init(&item); + mock_bpa_ctr_init(&item); data_queue_push(deliver, item); if (pthread_join(thr_forward, NULL)) { diff --git a/test/test_BackendPolicyProvider.c b/test/test_BackendPolicyProvider.c index 5a496fe3..d58ddaf7 100644 --- a/test/test_BackendPolicyProvider.c +++ b/test/test_BackendPolicyProvider.c @@ -153,4 +153,4 @@ void test_PolicyProvider_Inspect_RFC9173_BIB(void) BSL_SecurityActionSet_Deinit(&action_set); } -// TODO - test with also setting sec pararms and other things and test the RFC 9173 things. \ No newline at end of file +// TODO - test with also setting sec pararms and other things and test the RFC 9173 things. diff --git a/test/test_MockBPA_EID.c b/test/test_MockBPA_EID.c index a0dab294..57b4c6bb 100644 --- a/test/test_MockBPA_EID.c +++ b/test/test_MockBPA_EID.c @@ -183,4 +183,4 @@ void test_BSL_HostEIDPattern_IsMatch(const char *pat_text, const char *eid_text, BSL_HostEID_Deinit(&eid); BSL_HostEIDPattern_Deinit(&pat); -} \ No newline at end of file +} From 3ffe0f49ba5429c94dfbd076e7e17d30abe53613 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 10:12:04 -0400 Subject: [PATCH 07/16] Force needed linking --- cmake/FindQCBOR.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/FindQCBOR.cmake b/cmake/FindQCBOR.cmake index 1f3901ed..de21918d 100644 --- a/cmake/FindQCBOR.cmake +++ b/cmake/FindQCBOR.cmake @@ -9,3 +9,4 @@ set_target_properties(QCBOR::qcbor PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${QCBOR_HEADER}" IMPORTED_LOCATION "${QCBOR_LIB}" ) +target_link_libraries(QCBOR::qcbor INTERFACE m) From fb5bf109bb73cb8db3eaedd7e02c25f4be9e916b Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 10:13:53 -0400 Subject: [PATCH 08/16] Add mock_bpa symbols used --- .github/workflows/build-test.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 4c4a8159..e08a0989 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -90,11 +90,11 @@ jobs: run: ./build.sh install - name: Check symbols run: | - ./check_symbols.py --prefix bsl_ -- bsl_front bsl_dynamic - ./check_symbols.py --prefix bsl_ bslb_ -- bsl_crypto - ./check_symbols.py --prefix bslx_ -- bsl_default_sc - ./check_symbols.py --prefix bslp_ -- bsl_sample_pp - ./check_symbols.py -- bsl_mock_bpa + ./check_symbols.py bsl_front bsl_dynamic --prefix bsl_ + ./check_symbols.py bsl_crypto --prefix bsl_ bslb_ + ./check_symbols.py bsl_default_sc --prefix bslx_ + ./check_symbols.py bsl_sample_pp --prefix bslp_ + ./check_symbols.py bsl_mock_bpa --prefix MockBPA_ bsl_eidpat_ bsl_mock_ mock_bpa_ - name: Test run: ./build.sh check - name: Collect coverage From 4c6df9b42d92d5452f8b832ff1647652493109c1 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 12:37:42 -0400 Subject: [PATCH 09/16] Fixing bit shift --- src/mock_bpa/bsl_mock_bpa_crc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mock_bpa/bsl_mock_bpa_crc.c b/src/mock_bpa/bsl_mock_bpa_crc.c index 4d19433a..6a34bd45 100644 --- a/src/mock_bpa/bsl_mock_bpa_crc.c +++ b/src/mock_bpa/bsl_mock_bpa_crc.c @@ -67,7 +67,7 @@ void mock_bpa_crc_apply(UsefulBuf buf, size_t begin, size_t end, BSL_BundleCRCTy const uint16_t crc_val = bp_crc16(blk_enc); // Network byte order - crc_pos[0] = (crc_val >> 16) & 0xFF; + crc_pos[0] = (crc_val >> 8) & 0xFF; crc_pos[1] = crc_val & 0xFF; break; } @@ -116,7 +116,7 @@ bool mock_bpa_crc_check(UsefulBufC buf, size_t begin, size_t end, BSL_BundleCRCT const uint16_t crc_val = bp_crc16(blk_enc); // Network byte order - same = ((crc_pos[0] == ((crc_val >> 16) & 0xFF)) && (crc_pos[1] == (crc_val & 0xFF))); + same = ((crc_pos[0] == ((crc_val >> 8) & 0xFF)) && (crc_pos[1] == (crc_val & 0xFF))); break; } case BSL_BUNDLECRCTYPE_32: From 6d77723c8efcbfb5e965cbee9cc73da6e4d8268a Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 13:33:27 -0400 Subject: [PATCH 10/16] Skip man-db in CI jobs --- .github/workflows/build-test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index e08a0989..81ae596a 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -49,6 +49,7 @@ jobs: - name: Set up OS if: startsWith(matrix.os, 'ubuntu') run: | + sudo rm /var/lib/man-db/auto-update && \ sudo apt-get update && \ sudo apt-get install -y \ cmake ninja-build \ @@ -59,6 +60,7 @@ jobs: - name: Set up OS if: startsWith(matrix.os, 'centos') run: | + rm /var/lib/man-db/auto-update && \ dnf config-manager --set-enabled crb dnf install -y epel-release dnf install -y \ @@ -118,6 +120,7 @@ jobs: steps: - name: Set up OS run: | + sudo rm /var/lib/man-db/auto-update && \ sudo apt-get update && sudo apt-get install -y \ cmake ninja-build ruby gcc g++ ccache patch \ libssl-dev \ From 88dd7d6c183faba68b450a7f99205eb7afeae7fd Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 13:39:52 -0400 Subject: [PATCH 11/16] Fix RHEL CI --- .github/workflows/build-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 81ae596a..f27dfcd5 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -60,7 +60,7 @@ jobs: - name: Set up OS if: startsWith(matrix.os, 'centos') run: | - rm /var/lib/man-db/auto-update && \ + dnf install -y man-db && rm /var/lib/man-db/auto-update && \ dnf config-manager --set-enabled crb dnf install -y epel-release dnf install -y \ From b7458f0a2976164582877d9100907a3c102b483d Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 14:01:11 -0400 Subject: [PATCH 12/16] Recommended crb use --- .github/workflows/build-test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index f27dfcd5..710f254e 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -49,8 +49,8 @@ jobs: - name: Set up OS if: startsWith(matrix.os, 'ubuntu') run: | - sudo rm /var/lib/man-db/auto-update && \ - sudo apt-get update && \ + sudo rm /var/lib/man-db/auto-update + sudo apt-get update sudo apt-get install -y \ cmake ninja-build \ ruby pkg-config ccache patch \ @@ -60,8 +60,8 @@ jobs: - name: Set up OS if: startsWith(matrix.os, 'centos') run: | - dnf install -y man-db && rm /var/lib/man-db/auto-update && \ - dnf config-manager --set-enabled crb + dnf install -y man-db && rm /var/lib/man-db/auto-update + crb enable dnf install -y epel-release dnf install -y \ git rsync \ From 35916d4703078f695dead7770652a9ef1394023e Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 14:05:25 -0400 Subject: [PATCH 13/16] Ignore centos man-db --- .github/workflows/build-test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 710f254e..f297ad8e 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -60,7 +60,6 @@ jobs: - name: Set up OS if: startsWith(matrix.os, 'centos') run: | - dnf install -y man-db && rm /var/lib/man-db/auto-update crb enable dnf install -y epel-release dnf install -y \ From b9d60ba30f7fab6f8bc6daf5fa2a4b555259d081 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 14:07:41 -0400 Subject: [PATCH 14/16] Fix crb enable --- .github/workflows/build-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index f297ad8e..4bda6567 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -60,8 +60,8 @@ jobs: - name: Set up OS if: startsWith(matrix.os, 'centos') run: | - crb enable dnf install -y epel-release + crb enable dnf install -y \ git rsync \ cmake ninja-build \ From 5bbdce261bc2c557d23a1645240b7c77f829a1d8 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 14:17:17 -0400 Subject: [PATCH 15/16] Use more direct test assertion --- test/test_DefaultSecurityContext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/test_DefaultSecurityContext.c b/test/test_DefaultSecurityContext.c index 1cbdb3ab..c49e9699 100644 --- a/test/test_DefaultSecurityContext.c +++ b/test/test_DefaultSecurityContext.c @@ -175,8 +175,7 @@ void test_RFC9173_AppendixA_Example2_BCB_Source(void) // Confirm expected vs actual auth tag byte length's match and they are equal TEST_ASSERT_EQUAL(sizeof(ApxA2_AuthTag), auth_tag_result->_bytelen); - bool is_auth_tag_valid = memcmp(ApxA2_AuthTag, auth_tag_result->_bytes, sizeof(ApxA2_AuthTag)) == 0; - TEST_ASSERT_TRUE(is_auth_tag_valid); + TEST_ASSERT_EQUAL_MEMORY(ApxA2_AuthTag, auth_tag_result->_bytes, sizeof(ApxA2_AuthTag)); BSL_CanonicalBlock_t target_block; BSL_BundleCtx_GetBlockMetadata(&mock_bpa_ctr->bundle_ref, 1, &target_block); From d1564d7029f5dd51ecf3f07fa99e1e7eae562a6b Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Tue, 29 Jul 2025 14:24:55 -0400 Subject: [PATCH 16/16] Remove clang CI for now --- .github/workflows/build-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 4bda6567..34ce8dc7 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -35,7 +35,7 @@ jobs: fail-fast: false matrix: os: ['ubuntu-24.04', 'centos-9'] - compiler: ['gcc', 'clang'] + compiler: ['gcc'] name: Unit Test (${{matrix.os}} ${{matrix.compiler}}) runs-on: ${{ matrix.os == 'centos-9' && 'ubuntu-24.04' || matrix.os }} container: ${{ matrix.os == 'centos-9' && 'quay.io/centos/centos:stream9' || null }}