Skip to content

Commit

Permalink
[skip ci] kernel: add both official and custom hash
Browse files Browse the repository at this point in the history
- Thanks to @backslashxx for advice and patch
- Now both official and unofficial manager can works perfectly fine.
  • Loading branch information
rsuntk committed Oct 28, 2024
1 parent 540dffd commit 197c20c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
18 changes: 7 additions & 11 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,11 @@ ifeq ($(shell grep -q "struct selinux_state " $(srctree)/security/selinux/includ
ccflags-y += -DKSU_COMPAT_HAS_SELINUX_STATE
endif

#
# Manager sign has been changed!
# if you wanna use official manager,
# please run `export KSU_OFFICIAL_HASH=y`
#

ifneq ($(KSU_OFFICIAL_HASH),)
KSU_EXPECTED_SIZE := 0x033b
KSU_EXPECTED_HASH := c371061b19d8c7d7d6133c6a9bafe198fa944e50c1b31c9d8daa8d7f1fc2d2d6
else
KSU_EXPECTED_SIZE := 0x396
KSU_EXPECTED_HASH := f415f4ed9435427e1fdf7f1fccd4dbc07b3d6b8751e4dbcec6f19671f427870b
endif

KSU_EXPECTED_SIZE_CUST := 0x396
KSU_EXPECTED_HASH_CUST := f415f4ed9435427e1fdf7f1fccd4dbc07b3d6b8751e4dbcec6f19671f427870b

ifdef KSU_MANAGER_PACKAGE
ccflags-y += -DKSU_MANAGER_PACKAGE=\"$(KSU_MANAGER_PACKAGE)\"
Expand All @@ -58,9 +50,13 @@ endif

$(info -- KernelSU Manager signature size: $(KSU_EXPECTED_SIZE))
$(info -- KernelSU Manager signature hash: $(KSU_EXPECTED_HASH))
$(info -- KernelSU Custom Manager signature size: $(KSU_EXPECTED_SIZE_CUST))
$(info -- KernelSU Custom Manager signature hash: $(KSU_EXPECTED_HASH_CUST))

ccflags-y += -DEXPECTED_SIZE=$(KSU_EXPECTED_SIZE)
ccflags-y += -DEXPECTED_HASH=\"$(KSU_EXPECTED_HASH)\"
ccflags-y += -DEXPECTED_SIZE_CUST=$(KSU_EXPECTED_SIZE_CUST)
ccflags-y += -DEXPECTED_HASH_CUST=\"$(KSU_EXPECTED_HASH_CUST)\"

ifeq ($(shell grep -q "int path_umount" $(srctree)/fs/namespace.c; echo $$?),0)
ccflags-y += -DKSU_UMOUNT
Expand Down
5 changes: 4 additions & 1 deletion kernel/apk_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,8 @@ module_param_cb(ksu_debug_manager_uid, &expected_size_ops,

bool is_manager_apk(char *path)
{
return check_v2_signature(path, EXPECTED_SIZE, EXPECTED_HASH);
// https://github.com/backslashxx/KernelSU/commit/038375aff1d383f0911c324cecc65f7510b17124
return (check_v2_signature(path, EXPECTED_SIZE, EXPECTED_HASH)
|| check_v2_signature(path, EXPECTED_SIZE_CUST, EXPECTED_HASH_CUST)
);
}

0 comments on commit 197c20c

Please sign in to comment.