-
Notifications
You must be signed in to change notification settings - Fork 15
/
Tweak.xm
30 lines (26 loc) · 867 Bytes
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#import <Foundation/Foundation.h>
#import <Security/Security.h>
#include <substrate.h>
/*
Define the new SecTrustEvaluate function
*/
OSStatus new_SecTrustEvaluate(SecTrustRef trust, SecTrustResultType *result);
OSStatus new_SecTrustEvaluate(SecTrustRef trust, SecTrustResultType *result)
{
NSLog(@"trustme: Intercepting SecTrustEvaluate Call");
*result = kSecTrustResultProceed;
return errSecSuccess;
}
/*
Function signature for original SecTrustEvaluate
*/
static OSStatus(*original_SecTrustEvaluate)(SecTrustRef trust, SecTrustResultType *result);
/*
Constructor that is called when Tweak is loaded
*/
__attribute__((constructor))
static void _MSInitialize(void) {
NSLog(@"trustme: Loaded");
NSLog(@"trustme: Hooking SecTrustEvaluate");
MSHookFunction((void *)SecTrustEvaluate, (void *)new_SecTrustEvaluate, (void **)&original_SecTrustEvaluate);
}