Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ jobs:
- check: test
check-name: Build and Test
packages: protobuf-compiler build-essential cmake ccache
- check: test-mbedtls4
check-name: Build and Test (Mbed TLS 4.x)
packages: protobuf-compiler build-essential cmake ccache
# Upstream Mbed TLS 4 (TF-PSA-Crypto), as shipped by ESP-IDF 6
cmake_args: -DTESLABLE_MBEDTLS_REPO=https://github.com/Mbed-TLS/mbedtls.git -DTESLABLE_MBEDTLS_TAG=v4.1.1
- check: examples
check-name: Build Examples
packages: protobuf-compiler build-essential cmake ccache
Expand Down Expand Up @@ -108,8 +113,9 @@ jobs:
clang-tidy --version

- name: Install python dependencies
if: matrix.check == 'test' || matrix.check == 'examples'
run: python3 -m pip install protobuf grpcio-tools
if: startsWith(matrix.check, 'test') || matrix.check == 'examples'
# jsonschema and jinja2: Mbed TLS 4.x generates its PSA driver wrappers at build time
run: python3 -m pip install protobuf grpcio-tools jsonschema jinja2

- name: Use a supported Python for clang-tidy
if: matrix.check == 'tidy'
Expand All @@ -128,7 +134,7 @@ jobs:
if: matrix.check != 'format'
uses: hendrikmuhs/ccache-action@v1.2.24
with:
key: checks-${{ matrix.check }}-${{ runner.os }}-mbedtls-3.6.6
key: checks-${{ matrix.check }}-${{ runner.os }}-mbedtls

- name: Set reusable strings
if: matrix.check != 'format'
Expand All @@ -146,6 +152,7 @@ jobs:
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
${{ matrix.cmake_args }}
-S ${{ github.workspace }}

- name: Check clang-format
Expand All @@ -157,11 +164,11 @@ jobs:
run: ./scripts/clang-tidy.sh --check

- name: Build Library
if: matrix.check == 'test'
if: startsWith(matrix.check, 'test')
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ env.BUILD_TYPE }} -j

- name: Run Tests
if: matrix.check == 'test'
if: startsWith(matrix.check, 'test')
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config ${{ env.BUILD_TYPE }} --output-on-failure --verbose

Expand Down
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,14 @@ else()
GIT_TAG 0.4.9.1
GIT_SHALLOW TRUE
)
# Host builds default to the ESP-IDF 5.x fork; CI also builds against
# upstream Mbed TLS 4.x (TF-PSA-Crypto), which ESP-IDF 6 ships.
set(TESLABLE_MBEDTLS_REPO https://github.com/espressif/mbedtls.git CACHE STRING "Mbed TLS git repository")
set(TESLABLE_MBEDTLS_TAG mbedtls-3.6.6-idf CACHE STRING "Mbed TLS git tag")
FetchContent_Declare(
mbedtls
GIT_REPOSITORY https://github.com/espressif/mbedtls.git
GIT_TAG mbedtls-3.6.6-idf
GIT_REPOSITORY ${TESLABLE_MBEDTLS_REPO}
GIT_TAG ${TESLABLE_MBEDTLS_TAG}
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(nanopb mbedtls)
Expand Down Expand Up @@ -193,7 +197,12 @@ else()
${NANOPB_INCLUDE_DIRS}
)

target_link_libraries(TeslaBLE PUBLIC mbedcrypto mbedtls mbedx509)
# Mbed TLS 4.x moved the crypto library into TF-PSA-Crypto (tfpsacrypto).
if(TARGET tfpsacrypto)
target_link_libraries(TeslaBLE PUBLIC tfpsacrypto mbedtls mbedx509)
else()
target_link_libraries(TeslaBLE PUBLIC mbedcrypto mbedtls mbedx509)
endif()

# Strict warnings for the library's own C++ sources. Scoped to this target and
# language so third-party deps (mbedtls, nanopb) and generated .pb.c files are
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ This architecture provides a clean, maintainable approach to command lifecycle m
### Dependencies

- [nanopb](https://github.com/nanopb/nanopb)
- [mbedtls 3.x](https://github.com/Mbed-TLS/mbedtls)
- NOTE: ESP-IDF <=4.4 includes [mbedtls 2.x](https://github.com/espressif/mbedtls/wiki#mbed-tls-support-in-esp-idf), and is not compatible with this library. You will need to use at least ESP-IDF 5.0.
- [mbedtls 3.6 or 4.x](https://github.com/Mbed-TLS/mbedtls) (PSA Crypto API)
- NOTE: ESP-IDF 5.3 is the first release with Mbed TLS 3.6; older ESP-IDF releases are not compatible with this library.

## Features

Expand Down
Binary file added build4/.ninja_deps
Binary file not shown.
353 changes: 353 additions & 0 deletions build4/.ninja_log

Large diffs are not rendered by default.

5,120 changes: 5,120 additions & 0 deletions build4/build.ninja

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions build4/tests/cmake_test_discovery_0c1fa89deb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"tests": 8,
"name": "AllTests",
"testsuites": [
{
"name": "TBUtilsTest",
"tests": 8,
"testsuite": [
{
"name": "PbEncodeFieldsValidMessage",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_tb_utils.cpp",
"line": 12
},
{
"name": "PbEncodeFieldsNullPointers",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_tb_utils.cpp",
"line": 31
},
{
"name": "PbEncodeFieldsUniversalMessage",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_tb_utils.cpp",
"line": 53
},
{
"name": "FormatHexBasic",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_tb_utils.cpp",
"line": 74
},
{
"name": "FormatHexEmptyData",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_tb_utils.cpp",
"line": 81
},
{
"name": "FormatHexSingleByte",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_tb_utils.cpp",
"line": 90
},
{
"name": "FormatHexAllZeros",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_tb_utils.cpp",
"line": 97
},
{
"name": "FormatHexLargeData",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_tb_utils.cpp",
"line": 104
}
]
}
]
}
37 changes: 37 additions & 0 deletions build4/tests/cmake_test_discovery_0f01f041c1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"tests": 5,
"name": "AllTests",
"testsuites": [
{
"name": "ProtocolFailureTest",
"tests": 5,
"testsuite": [
{
"name": "PrivateKeyPemParsing",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_protocol_compliance.cpp",
"line": 20
},
{
"name": "EcdhKeyAgreement",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_protocol_compliance.cpp",
"line": 34
},
{
"name": "SessionInfoAuthentication",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_protocol_compliance.cpp",
"line": 67
},
{
"name": "ClientStrictValidation",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_protocol_compliance.cpp",
"line": 100
},
{
"name": "CounterAntiReplay",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_protocol_compliance.cpp",
"line": 127
}
]
}
]
}
97 changes: 97 additions & 0 deletions build4/tests/cmake_test_discovery_21aed2170e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"tests": 17,
"name": "AllTests",
"testsuites": [
{
"name": "PollingPolicyTest",
"tests": 17,
"testsuite": [
{
"name": "DefaultIntervals",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 17
},
{
"name": "IdlePollingBacksOffAfterTimeout",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 24
},
{
"name": "ObservedAsleepSkipsWakePolling",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 40
},
{
"name": "ChargingKeepsVehicleAwake",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 49
},
{
"name": "SentryModeKeepsVehicleAwake",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 62
},
{
"name": "AwakeBlipDoesNotResumeWakePolling",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 75
},
{
"name": "ActivityAfterSleepResumesFastPolling",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 86
},
{
"name": "ResetStartsFreshIdleWindow",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 98
},
{
"name": "IdleTimeoutCountsFromChargingStop",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 109
},
{
"name": "IdleTimeoutCountsFromSentryOff",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 125
},
{
"name": "ChargingAndSentryTogetherStayAwake",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 140
},
{
"name": "PollDueWhenNoPollFiredYet",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 149
},
{
"name": "PollDueAfterInterval",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 157
},
{
"name": "PollTracksFireTime",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 165
},
{
"name": "ForceUpdateThrottledToActiveInterval",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 174
},
{
"name": "PollStaysCorrectAcrossMillisWraparound",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 182
},
{
"name": "FullTickCadenceWhileCharging",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_polling_policy.cpp",
"line": 191
}
]
}
]
}
62 changes: 62 additions & 0 deletions build4/tests/cmake_test_discovery_2edbfe6529.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"tests": 10,
"name": "AllTests",
"testsuites": [
{
"name": "ErrorHandlingTest",
"tests": 10,
"testsuite": [
{
"name": "ErrorCodeToStringMapping",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 44
},
{
"name": "UnknownErrorCode",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 54
},
{
"name": "AllErrorCodesAreMapped",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 70
},
{
"name": "BuildMessageWithoutPrivateKey",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 83
},
{
"name": "BuildMessageWithNullParameters",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 104
},
{
"name": "ParseMessageWithNullParameters",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 125
},
{
"name": "ParseSessionInfoWithNullParameters",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 142
},
{
"name": "PrivateKeyOperationsWithoutKey",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 159
},
{
"name": "EdgeCaseFunctionCalls",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 168
},
{
"name": "BuildUniversalMessageRejectsOversizedPayload",
"file": "\/home\/dev\/dev\/tesla-ble\/tests\/test_error_handling.cpp",
"line": 200
}
]
}
]
}
Loading
Loading