Skip to content

Commit 16601fd

Browse files
committed
Tweak keychain hooks
1 parent 1a1808b commit 16601fd

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/Tweak.xmi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static NSString *preferenceFilePath = @"/private/var/mobile/Library/Preferences/
2323
// Hooks for ObjC methods rely on the Logos pre-processor
2424
// H4ck to split Logos hooking code into separate files: we're including actual code, not headers
2525
SQLiteStorage *traceStorage;
26-
static NSString *objectTypeNotSupported = @"Introspy - Not supported";
26+
NSString *objectTypeNotSupported = @"Introspy - Not supported";
2727

2828
// Delegate hooks => We proxy the delegate objects
2929
#import "hooks/DelegateProxies.h"

src/hooks/KeychainHooks.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010

1111
// Nice global
1212
extern SQLiteStorage *traceStorage;
13-
13+
extern NSString *objectTypeNotSupported;
1414

1515
// Hook SecItemAdd()
1616
static OSStatus (*original_SecItemAdd)(CFDictionaryRef attributes, CFTypeRef *result);
1717

1818
static OSStatus replaced_SecItemAdd(CFDictionaryRef attributes, CFTypeRef *result){
19-
19+
2020
OSStatus origResult = original_SecItemAdd(attributes, result);
2121

2222
// Need the call stack inspector or we get into a weird infinite loop of SecItemAdd() calls
2323
// because SecIdentityCopyCertificate() seems to call SecItemAdd(), or something...
2424
if ([CallStackInspector wasDirectlyCalledByApp]) {
2525
CallTracer *tracer = [[CallTracer alloc] initWithClass:@"C" andMethod:@"SecItemAdd"];
2626
[tracer addArgFromPlistObject:[PlistObjectConverter convertSecItemAttributesDict:attributes] withKey:@"attributes"];
27-
[tracer addArgFromPlistObject: [NSNumber numberWithUnsignedInt: (unsigned int)result] withKey:@"result"];
27+
[tracer addArgFromPlistObject:objectTypeNotSupported withKey:@"result"];
2828
[tracer addReturnValueFromPlistObject: [NSNumber numberWithInt:origResult]];
2929
[traceStorage saveTracedCall: tracer];
3030
[tracer release];
@@ -41,7 +41,7 @@ static OSStatus replaced_SecItemCopyMatching(CFDictionaryRef query, CFTypeRef *r
4141
OSStatus origResult = original_SecItemCopyMatching(query, result);
4242
CallTracer *tracer = [[CallTracer alloc] initWithClass:@"C" andMethod:@"SecItemCopyMatching"];
4343
[tracer addArgFromPlistObject:(NSDictionary*)query withKey:@"query"];
44-
[tracer addArgFromPlistObject: [NSNumber numberWithUnsignedInt: (unsigned int)result] withKey:@"result"];
44+
[tracer addArgFromPlistObject:objectTypeNotSupported withKey:@"result"];
4545
[tracer addReturnValueFromPlistObject: [NSNumber numberWithInt:origResult]];
4646
[traceStorage saveTracedCall: tracer];
4747
[tracer release];
@@ -68,7 +68,7 @@ static OSStatus replaced_SecItemDelete(CFDictionaryRef query){
6868

6969
static OSStatus replaced_SecItemUpdate(CFDictionaryRef query, CFDictionaryRef attributesToUpdate){
7070
OSStatus origResult = original_SecItemUpdate(query, attributesToUpdate);
71-
71+
7272
if ([CallStackInspector wasDirectlyCalledByApp]) {
7373
CallTracer *tracer = [[CallTracer alloc] initWithClass:@"C" andMethod:@"SecItemUpdate"];
7474
[tracer addArgFromPlistObject:(NSDictionary*)query withKey:@"query"];
@@ -81,7 +81,7 @@ static OSStatus replaced_SecItemUpdate(CFDictionaryRef query, CFDictionaryRef at
8181
}
8282

8383

84-
@implementation KeychainHooks
84+
@implementation KeychainHooks
8585

8686
+ (void)enableHooks {
8787
MSHookFunction(SecItemAdd, replaced_SecItemAdd, (void **) &original_SecItemAdd);

0 commit comments

Comments
 (0)