From 1254079d22bdb690db6eade4e6280b88e7b16434 Mon Sep 17 00:00:00 2001 From: Thomas A Date: Sun, 25 Jun 2023 09:39:11 -0700 Subject: [PATCH] Add Missing Declarations & Header Includes. FIx Stubs. --- .../CoreVideo/include/CoreVideo/CVPixelBuffer.h | 3 +++ .../LocalAuthentication/LAPrivateDefines.h | 8 ++++++++ src/frameworks/LocalAuthentication/src/stubs.c | 9 +++++---- src/launchd/liblaunch/launch.h | 3 +++ src/libDiagnosticMessagesClient/src/functions.c | 2 ++ src/libacm/include/ACMLib.h | 6 ++++++ src/libaks/include/libaks.h | 16 ++++++++++++++++ src/libaks/libaks.c | 2 ++ src/libsysmon/src/sysmon.c | 1 + .../include/ProtocolBuffer/PBDataReader.h | 8 ++++++++ src/private-frameworks/kperf/src/kperf.c | 2 +- src/startup/mldr/elfcalls/elfcalls.h | 2 +- src/xtrace/mig_trace.c | 1 + 13 files changed, 57 insertions(+), 6 deletions(-) diff --git a/src/frameworks/CoreVideo/include/CoreVideo/CVPixelBuffer.h b/src/frameworks/CoreVideo/include/CoreVideo/CVPixelBuffer.h index 1682bbd1e..0d0ba8921 100644 --- a/src/frameworks/CoreVideo/include/CoreVideo/CVPixelBuffer.h +++ b/src/frameworks/CoreVideo/include/CoreVideo/CVPixelBuffer.h @@ -3,6 +3,7 @@ #include #include +#include __BEGIN_DECLS @@ -78,8 +79,10 @@ enum extern const CFStringRef kCVPixelBufferMetalCompatibilityKey; typedef CVImageBufferRef CVPixelBufferRef; +typedef void (*CVPixelBufferReleaseBytesCallback)(void *releaseRefCon, const void *baseAddress); // TODO: This header file is incomplete +CVReturn CVPixelBufferCreateWithBytes(CFAllocatorRef allocator, size_t width, size_t height, OSType pixelFormatType, void *baseAddress, size_t bytesPerRow, CVPixelBufferReleaseBytesCallback releaseCallback, void *releaseRefCon, CFDictionaryRef pixelBufferAttributes, CVPixelBufferRef _Nullable *pixelBufferOut); __END_DECLS diff --git a/src/frameworks/LocalAuthentication/include/LocalAuthentication/LAPrivateDefines.h b/src/frameworks/LocalAuthentication/include/LocalAuthentication/LAPrivateDefines.h index 52b3d1cfe..caa089892 100644 --- a/src/frameworks/LocalAuthentication/include/LocalAuthentication/LAPrivateDefines.h +++ b/src/frameworks/LocalAuthentication/include/LocalAuthentication/LAPrivateDefines.h @@ -3,6 +3,11 @@ #include #include +#include +#include + +#include +#include CF_EXTERN_C_BEGIN @@ -19,6 +24,9 @@ typedef void* (*LAFunctionCopyExternalizedContext)(void*); static CFIndex kLAOptionNotInteractive = 1; static CFIndex kLAOptionCallerName = 2; +bool LAEvaluatePolicy(CFTypeRef context, int policy, CFMutableDictionaryRef options, CFErrorRef *error); +bool LAVerifySEP(uid_t pw_uid, CFErrorRef *error); + CF_EXTERN_C_END #endif diff --git a/src/frameworks/LocalAuthentication/src/stubs.c b/src/frameworks/LocalAuthentication/src/stubs.c index b86a18c0b..bc59b048e 100644 --- a/src/frameworks/LocalAuthentication/src/stubs.c +++ b/src/frameworks/LocalAuthentication/src/stubs.c @@ -1,9 +1,10 @@ #include +#include -void* LAEvaluatePolicy() { - return NULL; +bool LAEvaluatePolicy(CFTypeRef context, int policy, CFMutableDictionaryRef options, CFErrorRef *error) { + return false; }; -void* LAVerifySEP() { - return NULL; +bool LAVerifySEP(uid_t pw_uid, CFErrorRef *error) { + return false; }; diff --git a/src/launchd/liblaunch/launch.h b/src/launchd/liblaunch/launch.h index 07ea8b791..7313d0fdd 100644 --- a/src/launchd/liblaunch/launch.h +++ b/src/launchd/liblaunch/launch.h @@ -184,6 +184,9 @@ typedef enum { LAUNCH_DATA_MACHPORT, } launch_data_type_t; +int +launch_activate_socket(const char* key, int** fds, size_t* count); + __ld_allocator launch_data_t launch_data_alloc(launch_data_type_t); diff --git a/src/libDiagnosticMessagesClient/src/functions.c b/src/libDiagnosticMessagesClient/src/functions.c index 6d6f61a0f..1277f8e3a 100644 --- a/src/libDiagnosticMessagesClient/src/functions.c +++ b/src/libDiagnosticMessagesClient/src/functions.c @@ -19,6 +19,8 @@ along with Darling. If not, see . #include +#include + static int verbose = 0; __attribute__((constructor)) static void initme(void) { verbose = getenv("STUB_VERBOSE") != NULL; diff --git a/src/libacm/include/ACMLib.h b/src/libacm/include/ACMLib.h index 3ed7707b6..217977bf4 100644 --- a/src/libacm/include/ACMLib.h +++ b/src/libacm/include/ACMLib.h @@ -7,6 +7,12 @@ // CF type typedef void* ACMContextRef; +typedef int ACMStatus; +typedef char* ACMPassphrasePurpose; +typedef char* ACMScope; + ACMContextRef ACMContextCreateWithExternalForm(const void *externalForm, size_t dataLength); +ACMStatus ACMContextDelete(ACMContextRef context, bool destroyContext); +ACMStatus ACMContextRemovePassphraseCredentialsByPurposeAndScope(const ACMContextRef context, ACMPassphrasePurpose purpose, ACMScope scope); #endif // _ACMLIB_H_ diff --git a/src/libaks/include/libaks.h b/src/libaks/include/libaks.h index 4d7669de5..611a6152b 100644 --- a/src/libaks/include/libaks.h +++ b/src/libaks/include/libaks.h @@ -34,6 +34,8 @@ static kern_return_t aks_get_lock_state(keybag_handle_t handle, keybag_state_t * return kIOReturnSuccess; } +extern kern_return_t aks_get_bag_uuid(keybag_handle_t handle, uuid_t uuid); + extern kern_return_t aks_assert_hold(keybag_handle_t keybagHandle, AKSAssertionType_t lockAssertType, uint64_t timeout); extern kern_return_t aks_assert_drop(keybag_handle_t keybagHandle, AKSAssertionType_t lockAssertType); @@ -76,6 +78,7 @@ kern_return_t aks_save_bag(keybag_handle_t handle, void** bytes, size_t* size); kern_return_t aks_unload_bag(keybag_handle_t handle); kern_return_t aks_unlock_bag(keybag_handle_t handle, const void* passcode, int length); kern_return_t aks_load_bag(const void* data, int length, keybag_handle_t* handle); +kern_return_t aks_lock_bag(keybag_handle_t handle); typedef enum _aks_key_type_enum { key_class_none, @@ -109,6 +112,19 @@ kern_return_t aks_generation(keybag_handle_t handle, generation_option_t option, const uint8_t * aks_ref_key_get_blob(aks_ref_key_t refkey, size_t *out_blob_len); const uint8_t * aks_ref_key_get_external_data(aks_ref_key_t refkey, size_t *out_external_data_len); +int aks_ref_key_create(keybag_handle_t handle, keyclass_t key_class, aks_key_type_t type, const uint8_t *params, size_t params_len, aks_ref_key_t *ot); +int aks_ref_key_create_with_blob(keybag_handle_t keybag, const uint8_t *ref_key_blob, size_t ref_key_blob_len, aks_ref_key_t* handle); +int aks_ref_key_encrypt(aks_ref_key_t handle, const uint8_t *der_params, size_t der_params_len, const void *data, size_t data_len, void **out_der, size_t *out_der_len); +int aks_ref_key_decrypt(aks_ref_key_t handle, const uint8_t *der_params, size_t der_params_len, const void *data, size_t data_len, void **out_der, size_t *out_der_len); + +int aks_ref_key_free(aks_ref_key_t* refkey); +int aks_ref_key_delete(aks_ref_key_t handle, const uint8_t *der_params, size_t der_params_len); + +kern_return_t aks_wrap_key(const uint8_t *source, uint32_t textLength, keyclass_t keyclass, keybag_handle_t keybag, uint8_t *data, int *dest_len, keyclass_t *actual_class); +kern_return_t aks_unwrap_key(const uint8_t *source, uint32_t textLength, keyclass_t keyclass, keybag_handle_t keybag, uint8_t *data, int *dest_len); + +int aks_operation_optional_params(const uint8_t * access_groups, size_t access_groups_len, const uint8_t * external_data, size_t external_data_len, const void * acm_handle, int acm_handle_len, void ** out_der, size_t * out_der_len); + #ifdef __cplusplus } #endif diff --git a/src/libaks/libaks.c b/src/libaks/libaks.c index a458ff77f..c0669eb4a 100644 --- a/src/libaks/libaks.c +++ b/src/libaks/libaks.c @@ -1,3 +1,5 @@ +#include + #include "libaks.h" #include "libaks_smartcard.h" diff --git a/src/libsysmon/src/sysmon.c b/src/libsysmon/src/sysmon.c index 5d4cb0c9f..c75b38141 100755 --- a/src/libsysmon/src/sysmon.c +++ b/src/libsysmon/src/sysmon.c @@ -18,6 +18,7 @@ along with Darling. If not, see . */ +#include #include static int verbose = 0; __attribute__((constructor)) static void initme(void) { diff --git a/src/private-frameworks/ProtocolBuffer/include/ProtocolBuffer/PBDataReader.h b/src/private-frameworks/ProtocolBuffer/include/ProtocolBuffer/PBDataReader.h index 419567ece..22ed14d7e 100644 --- a/src/private-frameworks/ProtocolBuffer/include/ProtocolBuffer/PBDataReader.h +++ b/src/private-frameworks/ProtocolBuffer/include/ProtocolBuffer/PBDataReader.h @@ -44,6 +44,14 @@ static inline BOOL PBReaderReadBOOL(PBDataReader* reader) { return FALSE; }; +static inline uint32_t PBReaderReadUint32(PBDataReader *reader) { + return 0; +} + +static inline int32_t PBReaderReadInt32(PBDataReader* reader) { + return 0; +} + static inline uint64_t PBReaderReadUint64(PBDataReader* reader) { return 0; }; diff --git a/src/private-frameworks/kperf/src/kperf.c b/src/private-frameworks/kperf/src/kperf.c index f8dd1b4a9..531a54f1c 100755 --- a/src/private-frameworks/kperf/src/kperf.c +++ b/src/private-frameworks/kperf/src/kperf.c @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with Darling. If not, see . */ - +#include #include static int verbose = 0; __attribute__((constructor)) static void initme(void) { diff --git a/src/startup/mldr/elfcalls/elfcalls.h b/src/startup/mldr/elfcalls/elfcalls.h index 7275922bc..1a5d1d2f8 100644 --- a/src/startup/mldr/elfcalls/elfcalls.h +++ b/src/startup/mldr/elfcalls/elfcalls.h @@ -6,7 +6,7 @@ #include struct darling_thread_create_callbacks { - int (*thread_self_trap)(void); + unsigned int (*thread_self_trap)(void); void (*thread_set_tsd_base)(void*, int); void (*rpc_guard)(int); void (*rpc_unguard)(int); diff --git a/src/xtrace/mig_trace.c b/src/xtrace/mig_trace.c index 83c3a911e..2f126e9a5 100644 --- a/src/xtrace/mig_trace.c +++ b/src/xtrace/mig_trace.c @@ -4,6 +4,7 @@ #include #include #include +#include #include -- 2.51.2