manager: Update agp and dependency version, improve module signature error return

This commit is contained in:
ShirkNeko
2025-08-03 19:08:57 +08:00
parent cd4edf97bd
commit f8b8c7f671
2 changed files with 27 additions and 7 deletions

View File

@@ -197,36 +197,56 @@ bool get_managers_list(struct manager_list_info* info) {
bool verify_module_signature(const char* input) { bool verify_module_signature(const char* input) {
#if defined(__aarch64__) || defined(_M_ARM64) #if defined(__aarch64__) || defined(_M_ARM64)
if (input == NULL) { if (input == NULL) {
LogDebug("verify_module_signature: input path is null");
return false; return false;
} }
int fd = zako_file_open_rw(input); int fd = zako_file_open_rw(input);
if (fd < 0) {
LogDebug("verify_module_signature: failed to open file: %s", input);
return false;
}
uint32_t results = zako_file_verify_esig(fd, 0); uint32_t results = zako_file_verify_esig(fd, 0);
if (results != 0) { if (results != 0) {
/* If important error occured, verification process should
be considered as failed due to unexpected modification
potentially happened. */
if ((results & ZAKO_ESV_IMPORTANT_ERROR) != 0) { if ((results & ZAKO_ESV_IMPORTANT_ERROR) != 0) {
LogDebug("verify_module_signature: Verification failed! (important error)");
} else { } else {
/* This is for manager that doesn't want to do certificate checks */
LogDebug("verify_module_signature: Verification partially passed");
} }
} else { } else {
LogDebug("verify_module_signature: Verification passed!");
goto exit; goto exit;
} }
/* Go through all bit fields */ /* Go through all bit fields */
for (uint8_t i = 0; i < sizeof(uint32_t) * 8; i++) { for (size_t i = 0; i < sizeof(uint32_t) * 8; i++) {
if ((results & (1 << i)) == 0) { if ((results & (1 << i)) == 0) {
continue; continue;
} }
/* Convert error bit field index into human readable string */ /* Convert error bit field index into human readable string */
const char* message = zako_esign_verrcidx2str(i); const char* message = zako_esign_verrcidx2str((uint8_t)i);
// Error message: message // Error message: message
if (message != NULL) {
LogDebug("verify_module_signature: Error bit %zu: %s", i, message);
} else {
LogDebug("verify_module_signature: Error bit %zu: Unknown error", i);
}
} }
exit: exit:
close(fd); close(fd);
LogDebug("verify_module_signature: path=%s, results=0x%x, success=%s",
input, results, (results == 0) ? "true" : "false");
return results == 0; return results == 0;
#else #else
// 非arm64-v8a架构不支持模块签名验证 LogDebug("verify_module_signature: not supported on non-arm64 architecture, path=%s", input ? input : "null");
return false; return false;
#endif #endif
} }

View File

@@ -1,12 +1,12 @@
[versions] [versions]
accompanist-drawablepainter = "0.37.3" accompanist-drawablepainter = "0.37.3"
agp = "8.11.1" agp = "8.12.0"
gson = "2.13.1" gson = "2.13.1"
kotlin = "2.1.21" kotlin = "2.1.21"
ksp = "2.1.21-2.0.1" ksp = "2.1.21-2.0.1"
compose-bom = "2025.06.01" compose-bom = "2025.07.00"
lifecycle = "2.9.1" lifecycle = "2.9.2"
navigation = "2.9.1" navigation = "2.9.3"
activity-compose = "1.10.1" activity-compose = "1.10.1"
kotlinx-coroutines = "1.10.2" kotlinx-coroutines = "1.10.2"
coil-compose = "2.7.0" coil-compose = "2.7.0"