mirror of
				https://github.com/SoPat712/YTLitePlus.git
				synced 2025-10-31 04:44:14 -04:00 
			
		
		
		
	added files via upload
This commit is contained in:
		
							
								
								
									
										36
									
								
								Tweaks/PSHeader/PAC.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Tweaks/PSHeader/PAC.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| #ifndef PTRAUTH_HELPERS_H | ||||
| #define PTRAUTH_HELPERS_H | ||||
| // Helpers for PAC archs. | ||||
| // https://gist.github.com/summertriangle-dev/6b0449ce561f756ac82a4bc3de7af30a | ||||
|  | ||||
| // If the compiler understands __arm64e__, assume it's paired with an SDK that has | ||||
| // ptrauth.h. Otherwise, it'll probably error if we try to include it so don't. | ||||
| #if __arm64e__ | ||||
| #include <ptrauth.h> | ||||
| #endif | ||||
|  | ||||
| #pragma clang diagnostic push | ||||
| #pragma clang diagnostic ignored "-Wunused-function" | ||||
|  | ||||
| // Given a pointer to instructions, sign it so you can call it like a normal fptr. | ||||
| static void *make_sym_callable(void *ptr) { | ||||
| #if __arm64e__ | ||||
|     if (ptr == NULL) | ||||
|         return NULL; | ||||
|     ptr = ptrauth_sign_unauthenticated(ptrauth_strip(ptr, ptrauth_key_function_pointer), ptrauth_key_function_pointer, 0); | ||||
| #endif | ||||
|     return ptr; | ||||
| } | ||||
|  | ||||
| // Given a function pointer, strip the PAC so you can read the instructions. | ||||
| static void *make_sym_readable(void *ptr) { | ||||
| #if __arm64e__ | ||||
|     if (ptr == NULL) | ||||
|         return NULL; | ||||
|     ptr = ptrauth_strip(ptr, ptrauth_key_function_pointer); | ||||
| #endif | ||||
|     return ptr; | ||||
| } | ||||
|  | ||||
| #pragma clang diagnostic pop | ||||
| #endif | ||||
		Reference in New Issue
	
	Block a user
	 Balackburn
					Balackburn