feat: add web update pad functionality
What changed, and why it matters
This commit adds a small piece of firmware code that stores a fixed 15-byte pattern of bytes and a function that reads and mixes those bytes during device startup. On its own, the change does not appear to introduce a vulnerability; it looks like a compatibility or update-related marker. However, the purpose is not explained in the commit message, and the code is not obviously connected to any security-critical function, so its exact role is unclear from the diff alone.
Treat as low-risk housekeeping. If reviewing for security, verify with the vendor or project maintainers whether this pad is part of a firmware-update compatibility scheme and confirm it does not interact with signature verification, secure boot, or downgrade protection. No immediate patch is indicated by the diff alone.
Security signals we found
Addition of fixed, non-secret byte pad with no documented security purpose
New code executed during device initialization (DeviceSettingsInit)
No input-dependent behavior or privileged operations observed in the added function
Compile-time length check prevents out-of-bounds access
Evidence from the diff
The patch introduces legacy_web_update_pad.c/h, which defines a constant byte array g_legacyUsbPad (length 1-15, default 1) and a function LegacyWebUpdatePadTouch() that XORs each byte with its index and stores the result in a volatile sink variable. DeviceSettingsInit() now calls LegacyWebUpdatePadTouch() after InitBootParam(). The array is marked attribute((used)) to prevent linker removal. The values are fixed and public (visible in source), so they cannot serve as a secret. The function has no side effects beyond writing to a volatile variable, and no callers consume the result. There is no buffer overflow, use-after-free, or obvious memory-safety issue because LEGACY_USB_PAD_LEN is compile-time bounded to [1,15].
Changed components
src/config/legacy_web_update_pad.csrc/config/legacy_web_update_pad.hsrc/device_settings.cInspect captured patch +82 / −0
diff --git a/src/config/legacy_web_update_pad.c b/src/config/legacy_web_update_pad.c
new file mode 100644
index 0000000..14e87c8
--- /dev/null
+++ b/src/config/legacy_web_update_pad.c
@@ -0,0 +1,73 @@
+#include <stdint.h>
+#include "legacy_web_update_pad.h"
+
+#ifndef LEGACY_USB_PAD_LEN
+#define LEGACY_USB_PAD_LEN 1U
+#endif
+
+#if (LEGACY_USB_PAD_LEN < 1) || (LEGACY_USB_PAD_LEN > 15)
+#error "LEGACY_USB_PAD_LEN must be in range [1, 15]"
+#endif
+
+static const uint8_t g_legacyUsbPad[LEGACY_USB_PAD_LEN] __attribute__((used)) = {
+#if LEGACY_USB_PAD_LEN >= 1
+ 0x13,
+#endif
+#if LEGACY_USB_PAD_LEN >= 2
+ 0x57,
+#endif
+#if LEGACY_USB_PAD_LEN >= 3
+ 0x9B,
+#endif
+#if LEGACY_USB_PAD_LEN >= 4
+ 0xDF,
+#endif
+#if LEGACY_USB_PAD_LEN >= 5
+ 0x24,
+#endif
+#if LEGACY_USB_PAD_LEN >= 6
+ 0x68,
+#endif
+#if LEGACY_USB_PAD_LEN >= 7
+ 0xAC,
+#endif
+#if LEGACY_USB_PAD_LEN >= 8
+ 0xF0,
+#endif
+#if LEGACY_USB_PAD_LEN >= 9
+ 0x35,
+#endif
+#if LEGACY_USB_PAD_LEN >= 10
+ 0x79,
+#endif
+#if LEGACY_USB_PAD_LEN >= 11
+ 0xBD,
+#endif
+#if LEGACY_USB_PAD_LEN >= 12
+ 0xE1,
+#endif
+#if LEGACY_USB_PAD_LEN >= 13
+ 0x46,
+#endif
+#if LEGACY_USB_PAD_LEN >= 14
+ 0x8A,
+#endif
+#if LEGACY_USB_PAD_LEN >= 15
+ 0xCE,
+#endif
+};
+
+static volatile uint8_t g_legacyUsbPadSink = 0;
+
+void LegacyWebUpdatePadTouch(void)
+{
+ const volatile uint8_t *pad = (const volatile uint8_t *)g_legacyUsbPad;
+ uint8_t mix = 0;
+ uint32_t i;
+
+ for (i = 0; i < LEGACY_USB_PAD_LEN; i++) {
+ mix ^= (uint8_t)(pad[i] + (uint8_t)i);
+ }
+
+ g_legacyUsbPadSink ^= mix;
+}
diff --git a/src/config/legacy_web_update_pad.h b/src/config/legacy_web_update_pad.h
new file mode 100644
index 0000000..db2766f
--- /dev/null
+++ b/src/config/legacy_web_update_pad.h
@@ -0,0 +1,6 @@
+#ifndef LEGACY_WEB_UPDATE_PAD_H
+#define LEGACY_WEB_UPDATE_PAD_H
+
+void LegacyWebUpdatePadTouch(void);
+
+#endif
diff --git a/src/device_settings.c b/src/device_settings.c
index 7629509..bd0bfd3 100644
--- a/src/device_settings.c
+++ b/src/device_settings.c
@@ -17,6 +17,7 @@
#include "power_manager.h"
#include "account_manager.h"
#include "version.h"
+#include "legacy_web_update_pad.h"
#include "lv_i18n_api.h"
#include "fetch_sensitive_data_task.h"
#include "ctaes.h"
@@ -147,6 +148,8 @@ void DeviceSettingsInit(void)
}
InitBootParam();
+
+ LegacyWebUpdatePadTouch();
}
void InitBootParam(void)
Why this scored 11/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.