From 5509850986968caa141cb7b5604d181a6712e2fb Mon Sep 17 00:00:00 2001 From: Calvin Park Date: Sat, 18 Jan 2025 11:25:07 -0800 Subject: [PATCH] Install user SecOCKey to params (#34401) * Install user SecOCKey to params * Move it to launch_chffrplus.sh/launch * Move it to card.py * Basic error check * Catch Exception to suppress the linter * Make it local to secOC section --- selfdrive/car/card.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 3ed835a1f5..db89da262f 100755 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -125,6 +125,15 @@ class Car: self.CP.safetyConfigs = [safety_config] if self.CP.secOcRequired and not self.params.get_bool("IsReleaseBranch"): + # Copy user key if available + try: + with open("/cache/params/SecOCKey") as f: + user_key = f.readline().strip() + if len(user_key) == 32: + self.params.put("SecOCKey", user_key) + except Exception: + pass + secoc_key = self.params.get("SecOCKey", encoding='utf8') if secoc_key is not None: saved_secoc_key = bytes.fromhex(secoc_key.strip())