attestation: add status, battery charging/volts to 'get_version_info' RPC
What changed, and why it matters
This commit simply adds more information to an existing device status report (the 'get_version_info' RPC). It now reports whether tamper-evident attestation is active, the battery voltage, and whether the battery is charging. There is no change to security logic, access control, or cryptography. It is a routine telemetry/informational enhancement.
No security action required. Review as normal feature/telemetry change.
Security signals we found
No security-sensitive code paths altered
No new dependencies or external interfaces introduced
No changes to authentication, authorization, or cryptography
Informational RPC response expanded with read-only device telemetry
Evidence from the diff
The patch extends build_version_info_reply() in main/versioninfo.c to include three new CBOR fields: ATTESTATION_INITIALISED (boolean), BATTERY_MILLIVOLTS (uint), and BATTERY_CHARGING (boolean). It also makes the attestation.c source compile on non-ESP32-S3 targets by moving the target guard inside the file and providing a stub attestation_initialised() that returns false. The test expectation NUM_VALUES_VERINFO is updated from 20 to 23. No RPC handler behavior, authentication, or cryptographic operations are modified.
Changed components
main/versioninfo.cmain/attestation/attestation.cmain/CMakeLists.txtmain/amalgamated.ctest_jade.pyInspect captured patch +24 / −13
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index f7b87a7..5785c1f 100755
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -23,7 +23,6 @@ else()
endif()
if (CONFIG_IDF_TARGET_ESP32S3)
- set(attestdir "attestation")
set(usbdir "usbhmsc")
endif()
@@ -38,18 +37,18 @@ if(CONFIG_LOG_WIFI)
endif()
idf_component_register(SRC_DIRS "."
+ "attestation"
+ "fonts"
"process"
"utils"
"ui"
- "fonts"
"${bledir}"
"${qemudir}"
- "${attestdir}"
"${usbdir}"
PRIV_INCLUDE_DIRS "."
+ "attestation"
"${bledir}"
"${qemudir}"
- "${attestdir}"
"${usbdir}"
"${wallydirs}"
"${secpdir}"
diff --git a/main/amalgamated.c b/main/amalgamated.c
index 99d3dd0..659641f 100644
--- a/main/amalgamated.c
+++ b/main/amalgamated.c
@@ -26,9 +26,7 @@ void __wrap_abort(void);
#include "./aes.c"
#include "./assets.c"
-#ifdef CONFIG_IDF_TARGET_ESP32S3
#include "./attestation/attestation.c"
-#endif // CONFIG_IDF_TARGET_ESP32S3
#include "./bcur.c"
#ifdef CONFIG_BT_ENABLED
#include "./ble/ble.c"
diff --git a/main/attestation/attestation.c b/main/attestation/attestation.c
index 75b9451..dc9a661 100644
--- a/main/attestation/attestation.c
+++ b/main/attestation/attestation.c
@@ -1,7 +1,8 @@
#ifndef AMALGAMATED_BUILD
+#include "attestation.h"
#include <sdkconfig.h>
-#include "attestation.h"
+#ifdef CONFIG_IDF_TARGET_ESP32S3
#include "jade_assert.h"
#include "jade_wally_verify.h"
#include "random.h"
@@ -735,4 +736,7 @@ cleanup:
mbedtls_pk_free(&pk);
return retval;
}
+#else // CONFIG_IDF_TARGET_ESP32S3
+bool attestation_initialised(void) { return false; }
+#endif // CONFIG_IDF_TARGET_ESP32S3
#endif // AMALGAMATED_BUILD
diff --git a/main/versioninfo.c b/main/versioninfo.c
index 8a7ae98..664d26c 100644
--- a/main/versioninfo.c
+++ b/main/versioninfo.c
@@ -1,4 +1,5 @@
#ifndef AMALGAMATED_BUILD
+#include "attestation/attestation.h"
#include "jade_assert.h"
#include "jade_wally_verify.h"
#include "keychain.h"
@@ -31,9 +32,9 @@ void build_version_info_reply(const void* ctx, CborEncoder* container)
const jade_msg_source_t* const source = (const jade_msg_source_t*)ctx;
#ifdef CONFIG_DEBUG_MODE
- const uint8_t num_version_fields = 20;
+ const uint8_t num_version_fields = 23;
#else
- const uint8_t num_version_fields = 12;
+ const uint8_t num_version_fields = 15;
#endif
CborEncoder map_encoder;
@@ -44,15 +45,15 @@ void build_version_info_reply(const void* ctx, CborEncoder* container)
add_uint_to_map(&map_encoder, "JADE_OTA_MAX_CHUNK", JADE_OTA_BUF_SIZE);
// Config - eg. ble/radio enabled in build, or not
- // defined in ota.h
+ // defined in ota_defines.h
add_string_to_map(&map_encoder, "JADE_CONFIG", JADE_OTA_CONFIG);
// Board type - Production Jade, M5Stack, esp32 dev board, etc.
- // defined in ota.h
+ // defined in ota_defines.h
add_string_to_map(&map_encoder, "BOARD_TYPE", JADE_OTA_BOARD_TYPE);
// hardware 'features' eg. 'secure boot' or 'dev' etc.
- // defined in ota.h
+ // defined in ota_defines.h
add_string_to_map(&map_encoder, "JADE_FEATURES", JADE_OTA_FEATURES);
const char* idfversion = esp_get_idf_version();
@@ -68,9 +69,18 @@ void build_version_info_reply(const void* ctx, CborEncoder* container)
add_string_to_map(&map_encoder, "EFUSEMAC", hexstr);
JADE_WALLY_VERIFY(wally_free_string(hexstr));
+ // Attestation initialised
+ add_boolean_to_map(&map_encoder, "ATTESTATION_INITIALISED", attestation_initialised());
+
// Battery level
add_uint_to_map(&map_encoder, "BATTERY_STATUS", power_get_battery_status());
+ // Battery millivolts
+ add_uint_to_map(&map_encoder, "BATTERY_MILLIVOLTS", power_get_vbat());
+
+ // Battery charging
+ add_boolean_to_map(&map_encoder, "BATTERY_CHARGING", power_get_battery_charging());
+
// We have five cases:
// 1. Ready - has keys already associated with the passed message source
// - READY
diff --git a/test_jade.py b/test_jade.py
index df349fc..fadeff7 100644
--- a/test_jade.py
+++ b/test_jade.py
@@ -178,7 +178,7 @@ PINSERVER_DEFAULT_URL = 'https://j8d.io'
PINSERVER_DEFAULT_ONION = 'http://mrrxtq6tjpbnbm7vh5jt6mpjctn7ggyfy5wegvbeff3x7jrznqawlmid.onion'
# The number of values expected back in version info
-NUM_VALUES_VERINFO = 20
+NUM_VALUES_VERINFO = 23
ESP32S3_CHIP_BOARDS = ['JADE_V2', 'JADE_V2C', 'TTGO_TDISPLAYS3', 'TTGO_TDISPLAYS3PROCAMERA',
'M5CORES3']
Why this scored 13/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.