Skip to content

Commit

Permalink
make this a dylib to support both arm64 and arm64e
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeajames authored Jul 11, 2019
1 parent 55c9cf5 commit d3e169b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Library with commonly used patches in open-source jailbreaks. Call this a (light

# Compiling:

./make.sh
./make.sh

# Setup

- Compile OR head over to https://github.com/jakeajames/jelbrekLib/tree/master/downloads and get everything there.
- Link with jelbrekLib.a & IOKit.tbd and include jelbrekLib.h
- Call init_jelbrek() with tfp0 as your first thing and term_jelbrek() as your last
- Compile OR head over to https://github.com/jakeajames/jelbrekLib/tree/master/downloads and get everything there.
- Link with jelbrekLib.dylib and include jelbrekLib.h
- Call init_jelbrek() with tfp0, as your first thing and term_jelbrek(), as your last

# Issues
- AMFID patch won't resist after app enters background. Fix would be using a daemon (like amfidebilitate) or injecting a dylib (iOS 11)
Expand All @@ -37,3 +37,4 @@ Library with commonly used patches in open-source jailbreaks. Call this a (light
- The rest of patches are fairly simple and shouldn't be considered property of anyone in my opinion. Everyone who has enough knowledge can write them fairly easily

And, don't forget to tell me if I forgot to credit anyone!

3 changes: 3 additions & 0 deletions amfi_utils.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ uint64_t ubc_cs_blob_allocate(vm_size_t size) {
return alloced;
}
else {
size = (size + 0x3fff) & ~0x3fff;

uint64_t addrp = Kernel_alloc(sizeof(uint64_t));
if (!addrp) return 0;

Expand All @@ -211,6 +213,7 @@ uint64_t ubc_cs_blob_allocate(vm_size_t size) {
}

void kern_free(uint64_t addr, vm_size_t size) {
if (size > 0x1ff8) size = (size + 0x3fff) & ~0x3fff;
Kernel_Execute(Find_kfree(), addr, size, 0, 0, 0, 0, 0);
}

Expand Down
5 changes: 5 additions & 0 deletions cs_blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ struct cs_blob {
/* The following two will be replaced by the csb_signer_type. */
unsigned int csb_platform_binary:1;
unsigned int csb_platform_path:1;

#if __arm64e__
uint64_t csb_pmap_cs_entry;
#endif

};

typedef void (*cs_md_init)(void *ctx);
Expand Down
Binary file added downloads/jelbrekLib.dylib
Binary file not shown.
2 changes: 2 additions & 0 deletions downloads/jelbrekLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ extern uint64_t KernelBase;
extern mach_port_t TFP0;
extern kexecFunc kernel_exec;

typedef bool BOOL;

/*
Purpose: Initialize jelbrekLib (first thing you have to call)
Parameters:
Expand Down
4 changes: 1 addition & 3 deletions jelbrek.m
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,7 @@ int trust_hash(hash_t hash) {
}

static const char *csblob_parse_teamid(struct cs_blob *csblob) {
const CS_CodeDirectory *cd;

cd = csblob->csb_cd;
const CS_CodeDirectory *cd = csblob->csb_cd;

if (ntohl(KernelRead_32bits((uint64_t)cd + offsetof(CS_CodeDirectory, version))) < CS_SUPPORTSTEAMID) return 0;
if (KernelRead_32bits((uint64_t)cd + offsetof(CS_CodeDirectory, teamOffset)) == 0) return 0;
Expand Down
2 changes: 1 addition & 1 deletion make.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

xcrun -sdk iphoneos clang -c -arch arm64 -Iinclude -fobjc-arc *.c *.m *.cpp && ar rcu downloads/jelbrekLib.a *.o && rm *.o
xcrun -sdk iphoneos clang -arch arm64e -arch arm64 -dynamiclib -lc++ -framework UIKit -framework IOKit -install_name "@executable_path/jelbrekLib.dylib" -Iinclude -fobjc-arc *.c *.m *.cpp -o downloads/jelbrekLib.dylib

0 comments on commit d3e169b

Please sign in to comment.