support for SecOC cars (#33689)

* bump opendbc

* support for SecOC cars

* missed this

* bump opendbc

* un-nest SecOC params

* gate saved key retrieval on IsReleaseBranch false

* bump opendbc

* bump opendbc

* bump opendbc to point of SecOC merge

* bump opendbc
This commit is contained in:
Jason Young 2024-10-01 17:22:46 -07:00 committed by GitHub
parent 999c86e8a2
commit 17edc5f660
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 26 additions and 1 deletions

View File

@ -87,6 +87,7 @@ struct OnroadEvent @0x9b1657f34caf3ad3 {
startup @75;
startupNoCar @76;
startupNoControl @77;
startupNoSecOcKey @125;
startupMaster @78;
fcw @79;
steerSaturated @80;
@ -515,6 +516,9 @@ struct CarParams {
wheelSpeedFactor @63 :Float32; # Multiplier on wheels speeds to computer actual speeds
secOcRequired @75 :Bool; # Car requires SecOC message authentication to operate
secOcKeyAvailable @76 :Bool; # Stored SecOC key loaded from params
struct SafetyConfig {
safetyModel @0 :SafetyModel;
safetyParam @3 :UInt16;

View File

@ -182,6 +182,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"PrimeType", PERSISTENT},
{"RecordFront", PERSISTENT},
{"RecordFrontLock", PERSISTENT}, // for the internal fleet
{"SecOCKey", PERSISTENT | DONT_LOG},
{"RouteCount", PERSISTENT},
{"SnoozeUpdate", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
{"SshEnabled", PERSISTENT},

@ -1 +1 @@
Subproject commit 7b63ff21e9652242255b408840d0ebc5a7d0e768
Subproject commit bed4c18a959475251e48c28fadfa6bc207f20ec6

View File

@ -127,6 +127,18 @@ class Car:
safety_config.safetyModel = structs.CarParams.SafetyModel.noOutput
self.CP.safetyConfigs = [safety_config]
if self.CP.secOcRequired and not self.params.get_bool("IsReleaseBranch"):
secoc_key = self.params.get("SecOCKey", encoding='utf8')
if secoc_key is not None:
saved_secoc_key = bytes.fromhex(secoc_key.strip())
if len(saved_secoc_key) == 16:
self.CP.secOcKeyAvailable = True
self.CI.CS.secoc_key = saved_secoc_key
if controller_available:
self.CI.CC.secoc_key = saved_secoc_key
else:
cloudlog.warning("Saved SecOC key is invalid")
# Write previous route's CarParams
prev_cp = self.params.get("CarParamsPersistent")
if prev_cp is not None:

View File

@ -382,6 +382,12 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
ET.PERMANENT: StartupAlert("Dashcam mode for unsupported car"),
},
EventName.startupNoSecOcKey: {
ET.PERMANENT: NormalPermanentAlert("Dashcam Mode",
"Security Key Not Available",
priority=Priority.HIGH),
},
EventName.dashcamMode: {
ET.PERMANENT: NormalPermanentAlert("Dashcam Mode",
priority=Priority.LOWEST),

View File

@ -118,6 +118,8 @@ class SelfdriveD:
self.startup_event = EventName.startupNoCar
elif car_recognized and self.CP.passive:
self.startup_event = EventName.startupNoControl
elif self.CP.secOcRequired and not self.CP.secOcKeyAvailable:
self.startup_event = EventName.startupNoSecOcKey
if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True)