Skip to content

Commit

Permalink
v3.2
Browse files Browse the repository at this point in the history
- Changed the redirect wae (again)
- Finally added an icon0.png
- Fixed #21
- Fixed #15
- Removed #17
  • Loading branch information
SKGleba committed Jun 18, 2021
1 parent 4d8529c commit d184231
Show file tree
Hide file tree
Showing 10 changed files with 234 additions and 125 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ all: $(TARGET).vpk
%.vpk: eboot.bin
vita-mksfoex -s TITLE_ID=$(TITLE_ID) "iTLS-Enso" param.sfo
vita-pack-vpk -s param.sfo -b eboot.bin \
-a sce_sys/icon0.png=sce_sys/icon0.png \
-a sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \
-a sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml \
-a kernel/itls.skprx=kernel.skprx \
-a old_dns_fix/old_dns_fix.suprx=dnsfix.suprx \
-a misc/compat.suprx=compat.suprx \
-a misc/lhttp.suprx=lhttp.suprx \
-a misc/lssl.suprx=lssl.suprx \
-a misc/comm2.suprx=comm2.suprx \
-a misc/certs.cer=certs.cer \$@

eboot.bin: $(TARGET).velf
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
Adds TLS v1.2 to devices with enso installed.

# How-To

1) Install the provided VPK file.

2) Start the app, select "Install the full iTLS package" and wait til it finishes.
- You may want to only install the new root certs, to do it select "Install the iTLS CA certs"

3) Reboot.

# Credits

Thanks to:
- Team Molecule
- Testers from the HenKaku discord server

# FAQ

- Can I use it without enso?
- Yes for browser-only patch, but it is strongly recommended to use enso.
- Yes for the browser patch only.
- Where can I find the CA certs?
- vs0:/data/external/cert/CA_LIST.cer
- How can I update the tool?
- Uninstall via the previous installer, install via the new one.

# Notes
- Since version 3.0 iTLS also patches apps-side TLS stuff.
- Since version 3.0 iTLS also patches app-side TLS stuff.
- Since version 3.2 iTLS also patches the NP server link on firmware 3.60.
- Updating CA certs may fix some problems with web sites, apps (like netflix), etc.
- For any help/serious issue DM me on twitter (twitter.com/skgleba)

### Donation
- Via [ko-fi](https://ko-fi.com/skgleba), thanks!

# Credits
Thanks to:
- Team Molecule
- Testers from the HenKaku discord server
- Cuevavirus for the 3.60 np server fix

## CURRENT MODULES ORIGIN FW: 3.73
3 changes: 3 additions & 0 deletions kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ target_link_libraries(itls.elf
taihenForKernel_stub
SceSysmemForDriver_stub
SceIofilemgrForDriver_stub
SceDebugForDriver_stub
SceModulemgrForDriver_stub
SceSysrootForDriver_stub
)

set_target_properties(itls.elf
Expand Down
96 changes: 43 additions & 53 deletions kernel/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
iTLS-Enso v3.1 by SKGleba
iTLS-Enso v3.2 by SKGleba
All Rights Reserved
*/

Expand All @@ -9,72 +9,62 @@
#include <psp2kern/kernel/modulemgr.h>
#include <vitasdkkern.h>

#define INJECT(name, off, data, sz) \
do { \
uintptr_t addr; \
tai_module_info_t info; \
info.size = sizeof(info); \
if (module_get_by_name_nid(KERNEL_PID, name, TAI_IGNORE_MODULE_NID, &info) >= 0) { \
module_get_offset(KERNEL_PID, info.modid, 0, off, &addr); \
ksceKernelCpuUnrestrictedMemcpy((void *)addr, (void *)data, sz); \
} \
} while (0)
const char* new_modules[5] = { "vs0:/data/external/itls/ScePsp2Compat.suprx" , "vs0:/data/external/itls/libhttp.suprx" , "vs0:/data/external/itls/libssl.suprx", "vs0:/data/external/itls/old_dns_fix.suprx", "vs0:/data/external/itls/np_commerce2.suprx" };
static char replace[5] = {0, 0, 0, 0, 0};
static char replace_iap = 0, replace_comm2 = 0;

int ex(char *path) {
int add_replace_flags(void) {
SceIoStat stat;
int stat_ret = ksceIoGetstat(path, &stat);
if (stat_ret < 0)
return 0;
return 1;
for(int i = 0; i < 5; i-=-1) {
if (ksceIoGetstat(new_modules[i], &stat) >= 0)
replace[i] = 1;
}
replace_iap = replace[1] & replace[2];
replace_comm2 = replace[3] & replace[4];
replace_comm2 -=- replace_comm2;
return replace[0] + replace_iap + replace_comm2;
}

uint8_t pmode = 0;
static char path_k[0x80];
static int hk;
static tai_hook_ref_t lum_hook;
static SceUID lum_patch(char *path, SceSize args, void *argp, int flags, SceKernelLMOption *option, int *status) {
int state;
ENTER_SYSCALL(state);
int pathlen = ksceKernelStrnlenUser((uintptr_t)path, 0x80);
if (pathlen < 0x80) {
ksceKernelMemcpyUserToKernel(path_k, (uintptr_t)path, pathlen);
if (path_k[pathlen - 14] == 0x70 && path_k[pathlen - 13] == 0x32 && path_k[pathlen - 12] == 0x43) {
path_k[pathlen - 1] = 0x30;
ksceKernelMemcpyKernelToUser((uintptr_t)path, path_k, pathlen);
}

static int hk = 0;
static tai_hook_ref_t lfp_hook;
// load module for pid (0 to get), running in kernel context, path is in kernel
static SceUID load_for_pid_patched(int pid, const char *path, uint32_t flags, int *ptr_to_four) {
int len = strnlen(path, 0x400);
if (len > 0 && len < 0x400) {
if (replace_iap && strncmp(path, "vs0:sys/external/libhttp.suprx", 30) == 0)
path = new_modules[1];
else if (replace_iap && strncmp(path, "vs0:sys/external/libssl.suprx", 29) == 0)
path = new_modules[2];
else if (replace[0] && strncmp(path + len - 27, "webcore/ScePsp2Compat.suprx", 27) == 0)
strncpy((char *)(path + len - 27), new_modules[0] + 19, 25);
else if (replace_comm2 && strncmp(path, "vs0:sys/external/np_commerce2.suprx", 35) == 0)
path = new_modules[4];
};
int res = TAI_CONTINUE(SceUID, lfp_hook, pid, path, flags, ptr_to_four);
if (replace_comm2 == 2 && path == new_modules[2] && pid == ksceKernelSysrootGetShellPid()) { // 3.60 dns fix
ksceKernelLoadStartModuleForPid(pid, new_modules[3], 0, NULL, 0, NULL, NULL);
replace_comm2 = 1;
}
EXIT_SYSCALL(state);
SceUID ret = TAI_CONTINUE(SceUID, lum_hook, path, args, argp, flags, option, status);
return ret;
return res;
}

void _start() __attribute__ ((weak, alias ("module_start")));
int module_start(SceSize argc, const void *args)
{
char zero[1] = {0x30};
if (ex("vs0:/sys/external/libhttp.supr0") == 1) {
INJECT("SceSysmodule", 0x162c, zero, sizeof(zero));
INJECT("SceSysmodule", 0x163b, zero, sizeof(zero));
pmode = 1;
}
if (ex("vs0:/data/external/webcore/ScePsp2Compat.supr0") == 1) {
hk = taiHookFunctionExportForKernel(KERNEL_PID, &lum_hook, "SceKernelModulemgr", TAI_ANY_LIBRARY, 0x60647592, lum_patch);
pmode = pmode + 0x10;
ksceDebugPrintf("itls module loaded\n");
if (add_replace_flags() > 0) {
int modid = ksceKernelSearchModuleByName("SceKernelModulemgr");
if (modid > 0)
hk = taiHookFunctionOffsetForKernel(KERNEL_PID, &lfp_hook, modid, 0, 0x21ec, 1, load_for_pid_patched);
if (modid < 0 || hk < 0)
return SCE_KERNEL_START_FAILED;
}
return SCE_KERNEL_START_SUCCESS;
}

int module_stop(SceSize argc, const void *args)
{
if (pmode >= 0x10) {
if (hk >= 0)
taiHookReleaseForKernel(hk, lum_hook);
pmode = pmode - 0x10;
}
char x[1] = {0x7A};
if (pmode == 1) {
INJECT("SceSysmodule", 0x162c, x, sizeof(x));
INJECT("SceSysmodule", 0x163b, x, sizeof(x));
}
if (hk >= 0)
taiHookReleaseForKernel(hk, lfp_hook);
return SCE_KERNEL_STOP_SUCCESS;
}
Loading

0 comments on commit d184231

Please sign in to comment.