Inventors:
Gideon M. Myles - San Jose CA, US
Julien Lerouge - Santa Clara CA, US
Tanya Michelle Lattner - San Jose CA, US
Augustin J. Farrugia - Cupertino CA, US
Assignee:
Apple Inc. - Cupertino CA
International Classification:
G06F 9/45
Abstract:
Disclosed herein are systems, methods, and computer readable-media for obfuscating code. The method includes extracting a conditional statement from a computer program, creating a function equivalent to the conditional statement, creating a pointer that points to the function, storing the pointer in an array of pointers, replacing the conditional statement with a call to the function using the pointer at an index in the array, and during runtime of the computer program, dynamically calculating the index corresponding to the pointer in the array. In one aspect, a subset of instructions is extracted from a path associated with the conditional statement and the subset of instructions is placed in the function to evaluate the conditional statement. In another aspect, the conditional statement is replaced with a call to a select function that (1) calculates the index into the array, (2) retrieves the function pointer from the array using the index, and (3) calls the function using the function pointer. Calls can be routed through a select function before the function pointer is used to call the function evaluating the conditional statement.