diff --git a/CMakeLists.txt b/CMakeLists.txt index 06b17891..f796797f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ add_definitions( ) include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/securityd/securityd_service/KeyStore ${CMAKE_CURRENT_SOURCE_DIR}/OSX/trustd ${CMAKE_CURRENT_SOURCE_DIR}/OSX/authd ${CMAKE_CURRENT_SOURCE_DIR}/OSX/security_dotmac_tp/lib diff --git a/OSX/CMakeLists.txt b/OSX/CMakeLists.txt index 21f1a8f6..3202ad25 100644 --- a/OSX/CMakeLists.txt +++ b/OSX/CMakeLists.txt @@ -18,3 +18,14 @@ add_subdirectory(libsecurity_cryptkit) add_subdirectory(libsecurity_cssm) add_subdirectory(libsecurity_filedb) add_subdirectory(libsecurity_keychain) +add_subdirectory(libsecurity_manifest) +add_subdirectory(libsecurity_mds) +add_subdirectory(libsecurity_ocspd) +add_subdirectory(libsecurity_pkcs12) +add_subdirectory(libsecurity_sd_cspdl) +add_subdirectory(libsecurity_smime) +add_subdirectory(libsecurity_ssl) +add_subdirectory(libsecurity_transform) +add_subdirectory(libsecurity_utilities) +add_subdirectory(libsecurityd) +add_subdirectory(utilities) diff --git a/OSX/libsecurity_keychain/CMakeLists.txt b/OSX/libsecurity_keychain/CMakeLists.txt index ce26ab8f..07583dc7 100644 --- a/OSX/libsecurity_keychain/CMakeLists.txt +++ b/OSX/libsecurity_keychain/CMakeLists.txt @@ -85,3 +85,13 @@ add_library(libsecurity_keychain OBJECT lib/tsaDERUtilities.c ) make_fat(libsecurity_keychain) + +add_library(libsecurity_keychain_DER OBJECT + libDER/libDER/DER_Decode.c + libDER/libDER/DER_Encode.c + libDER/libDER/DER_Keys.c + libDER/libDER/DER_Digest.c + libDER/libDER/oids.c + libDER/libDER/DER_CertCrl.c +) +make_fat(libsecurity_keychain_DER) diff --git a/OSX/libsecurity_manifest/CMakeLists.txt b/OSX/libsecurity_manifest/CMakeLists.txt new file mode 100644 index 00000000..19657464 --- /dev/null +++ b/OSX/libsecurity_manifest/CMakeLists.txt @@ -0,0 +1,15 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +add_library(libsecurity_manifest OBJECT + lib/ManifestSigner.cpp + lib/Manifest.cpp + lib/SecManifest.cpp + lib/SecureDownloadInternal.c + lib/SecureDownload.cpp + lib/ManifestInternal.cpp + lib/Download.cpp + lib/AppleManifest.cpp +) +make_fat(libsecurity_manifest) diff --git a/OSX/libsecurity_mds/CMakeLists.txt b/OSX/libsecurity_mds/CMakeLists.txt new file mode 100644 index 00000000..98703db8 --- /dev/null +++ b/OSX/libsecurity_mds/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +add_library(libsecurity_mds OBJECT + lib/MDSDictionary.cpp + lib/MDSDatabase.cpp + lib/MDSAttrParser.cpp + lib/MDSSchema.cpp + lib/MDSModule.cpp + lib/MDSAttrUtils.cpp + lib/MDSAttrStrings.cpp + lib/MDSSession.cpp + lib/mdsapi.cpp +) +make_fat(libsecurity_mds) diff --git a/OSX/libsecurity_ocspd/CMakeLists.txt b/OSX/libsecurity_ocspd/CMakeLists.txt new file mode 100644 index 00000000..ab93cf97 --- /dev/null +++ b/OSX/libsecurity_ocspd/CMakeLists.txt @@ -0,0 +1,15 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/common +) + +add_library(libsecurity_ocspd OBJECT + mig/ocspd_client.cpp + common/ocspdDbSchema.cpp + mig/ocspd.defs + common/ocspResponse.cpp + mig/ocspd_server.cpp + client/ocspdClient.cpp + common/ocspExtensions.cpp + common/ocspdUtils.cpp +) +make_fat(libsecurity_ocspd) diff --git a/OSX/libsecurity_ocspd/common/ocspd.h b/OSX/libsecurity_ocspd/common/ocspd.h new file mode 100644 index 00000000..ebad9fbc --- /dev/null +++ b/OSX/libsecurity_ocspd/common/ocspd.h @@ -0,0 +1,631 @@ +#ifndef _ocspd_user_ +#define _ocspd_user_ + +/* Module ocspd */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* BEGIN VOUCHER CODE */ + +#ifndef KERNEL +#if defined(__has_include) +#if __has_include() +#ifndef USING_VOUCHERS +#define USING_VOUCHERS +#endif +#ifndef __VOUCHER_FORWARD_TYPE_DECLS__ +#define __VOUCHER_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif // __VOUCHER_FORWARD_TYPE_DECLS__ +#endif // __has_include() +#endif // __has_include +#endif // !KERNEL + +/* END VOUCHER CODE */ + + +/* BEGIN MIG_STRNCPY_ZEROFILL CODE */ + +#if defined(__has_include) +#if __has_include() +#ifndef USING_MIG_STRNCPY_ZEROFILL +#define USING_MIG_STRNCPY_ZEROFILL +#endif +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ +#endif /* __has_include() */ +#endif /* __has_include */ + +/* END MIG_STRNCPY_ZEROFILL CODE */ + + +#ifdef AUTOTEST +#ifndef FUNCTION_PTR_T +#define FUNCTION_PTR_T +typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); +typedef struct { + char *name; + function_ptr_t function; +} function_table_entry; +typedef function_table_entry *function_table_t; +#endif /* FUNCTION_PTR_T */ +#endif /* AUTOTEST */ + +#ifndef ocspd_MSG_COUNT +#define ocspd_MSG_COUNT 10 +#endif /* ocspd_MSG_COUNT */ + +#include +#include +#include +#include +#include +#include + +#ifdef __BeforeMigUserHeader +__BeforeMigUserHeader +#endif /* __BeforeMigUserHeader */ + +#include +__BEGIN_DECLS + + +/* Routine ocspdFetch */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_ocspdFetch +( + mach_port_t serverport, + Data ocsp_req, + mach_msg_type_number_t ocsp_reqCnt, + Data *ocsp_rep, + mach_msg_type_number_t *ocsp_repCnt +); + +/* Routine ocspdCacheFlush */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_ocspdCacheFlush +( + mach_port_t serverport, + Data certID, + mach_msg_type_number_t certIDCnt +); + +/* Routine ocspdCacheFlushStale */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_ocspdCacheFlushStale +( + mach_port_t serverport +); + +/* Routine certFetch */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_certFetch +( + mach_port_t serverport, + Data cert_url, + mach_msg_type_number_t cert_urlCnt, + Data *cert_data, + mach_msg_type_number_t *cert_dataCnt +); + +/* Routine crlFetch */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_crlFetch +( + mach_port_t serverport, + Data crl_url, + mach_msg_type_number_t crl_urlCnt, + Data crl_issuer, + mach_msg_type_number_t crl_issuerCnt, + boolean_t cache_read, + boolean_t cache_write, + Data verify_time, + mach_msg_type_number_t verify_timeCnt, + Data *crl_data, + mach_msg_type_number_t *crl_dataCnt +); + +/* Routine crlRefresh */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_crlRefresh +( + mach_port_t serverport, + uint32_t stale_days, + uint32_t expire_overlap_seconds, + boolean_t purge_all, + boolean_t full_crypto_verify +); + +/* Routine crlFlush */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_crlFlush +( + mach_port_t serverport, + Data cert_url, + mach_msg_type_number_t cert_urlCnt +); + +/* Routine trustSettingsRead */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_trustSettingsRead +( + mach_port_t serverport, + uint32_t domain, + Data *trustSettings, + mach_msg_type_number_t *trustSettingsCnt, + OSStatus *rcode +); + +/* Routine trustSettingsWrite */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_trustSettingsWrite +( + mach_port_t serverport, + mach_port_t clientport, + uint32_t domain, + Data authBlob, + mach_msg_type_number_t authBlobCnt, + Data trustSettings, + mach_msg_type_number_t trustSettingsCnt, + OSStatus *rcode +); + +/* Routine crlStatus */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_client_crlStatus +( + mach_port_t serverport, + Data serial_number, + mach_msg_type_number_t serial_numberCnt, + Data cert_issuers, + mach_msg_type_number_t cert_issuersCnt, + Data crl_issuer, + mach_msg_type_number_t crl_issuerCnt, + Data crl_url, + mach_msg_type_number_t crl_urlCnt +); + +__END_DECLS + +/********************** Caution **************************/ +/* The following data types should be used to calculate */ +/* maximum message sizes only. The actual message may be */ +/* smaller, and the position of the arguments within the */ +/* message layout may vary from what is presented here. */ +/* For example, if any of the arguments are variable- */ +/* sized, and less than the maximum is sent, the data */ +/* will be packed tight in the actual message to reduce */ +/* the presence of holes. */ +/********************** Caution **************************/ + +/* typedefs for all requests */ + +#ifndef __Request__ocspd_subsystem__defined +#define __Request__ocspd_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ocsp_req; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ocsp_reqCnt; + } __Request__ocspdFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t certID; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t certIDCnt; + } __Request__ocspdCacheFlush_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__ocspdCacheFlushStale_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_urlCnt; + } __Request__certFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t crl_url; + mach_msg_ool_descriptor_t crl_issuer; + mach_msg_ool_descriptor_t verify_time; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t crl_urlCnt; + mach_msg_type_number_t crl_issuerCnt; + boolean_t cache_read; + boolean_t cache_write; + mach_msg_type_number_t verify_timeCnt; + } __Request__crlFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t stale_days; + uint32_t expire_overlap_seconds; + boolean_t purge_all; + boolean_t full_crypto_verify; + } __Request__crlRefresh_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_urlCnt; + } __Request__crlFlush_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t domain; + } __Request__trustSettingsRead_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t clientport; + mach_msg_ool_descriptor_t authBlob; + mach_msg_ool_descriptor_t trustSettings; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32_t domain; + mach_msg_type_number_t authBlobCnt; + mach_msg_type_number_t trustSettingsCnt; + } __Request__trustSettingsWrite_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t serial_number; + mach_msg_ool_descriptor_t cert_issuers; + mach_msg_ool_descriptor_t crl_issuer; + mach_msg_ool_descriptor_t crl_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t serial_numberCnt; + mach_msg_type_number_t cert_issuersCnt; + mach_msg_type_number_t crl_issuerCnt; + mach_msg_type_number_t crl_urlCnt; + } __Request__crlStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Request__ocspd_subsystem__defined */ + +/* union of all requests */ + +#ifndef __RequestUnion__ocsp_client_ocspd_subsystem__defined +#define __RequestUnion__ocsp_client_ocspd_subsystem__defined +union __RequestUnion__ocsp_client_ocspd_subsystem { + __Request__ocspdFetch_t Request_ocsp_client_ocspdFetch; + __Request__ocspdCacheFlush_t Request_ocsp_client_ocspdCacheFlush; + __Request__ocspdCacheFlushStale_t Request_ocsp_client_ocspdCacheFlushStale; + __Request__certFetch_t Request_ocsp_client_certFetch; + __Request__crlFetch_t Request_ocsp_client_crlFetch; + __Request__crlRefresh_t Request_ocsp_client_crlRefresh; + __Request__crlFlush_t Request_ocsp_client_crlFlush; + __Request__trustSettingsRead_t Request_ocsp_client_trustSettingsRead; + __Request__trustSettingsWrite_t Request_ocsp_client_trustSettingsWrite; + __Request__crlStatus_t Request_ocsp_client_crlStatus; +}; +#endif /* !__RequestUnion__ocsp_client_ocspd_subsystem__defined */ +/* typedefs for all replies */ + +#ifndef __Reply__ocspd_subsystem__defined +#define __Reply__ocspd_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ocsp_rep; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ocsp_repCnt; + } __Reply__ocspdFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__ocspdCacheFlush_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__ocspdCacheFlushStale_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_dataCnt; + } __Reply__certFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t crl_data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t crl_dataCnt; + } __Reply__crlFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__crlRefresh_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__crlFlush_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t trustSettings; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t trustSettingsCnt; + OSStatus rcode; + } __Reply__trustSettingsRead_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + OSStatus rcode; + } __Reply__trustSettingsWrite_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__crlStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Reply__ocspd_subsystem__defined */ + +/* union of all replies */ + +#ifndef __ReplyUnion__ocsp_client_ocspd_subsystem__defined +#define __ReplyUnion__ocsp_client_ocspd_subsystem__defined +union __ReplyUnion__ocsp_client_ocspd_subsystem { + __Reply__ocspdFetch_t Reply_ocsp_client_ocspdFetch; + __Reply__ocspdCacheFlush_t Reply_ocsp_client_ocspdCacheFlush; + __Reply__ocspdCacheFlushStale_t Reply_ocsp_client_ocspdCacheFlushStale; + __Reply__certFetch_t Reply_ocsp_client_certFetch; + __Reply__crlFetch_t Reply_ocsp_client_crlFetch; + __Reply__crlRefresh_t Reply_ocsp_client_crlRefresh; + __Reply__crlFlush_t Reply_ocsp_client_crlFlush; + __Reply__trustSettingsRead_t Reply_ocsp_client_trustSettingsRead; + __Reply__trustSettingsWrite_t Reply_ocsp_client_trustSettingsWrite; + __Reply__crlStatus_t Reply_ocsp_client_crlStatus; +}; +#endif /* !__RequestUnion__ocsp_client_ocspd_subsystem__defined */ + +#ifndef subsystem_to_name_map_ocspd +#define subsystem_to_name_map_ocspd \ + { "ocspdFetch", 33003 },\ + { "ocspdCacheFlush", 33004 },\ + { "ocspdCacheFlushStale", 33005 },\ + { "certFetch", 33006 },\ + { "crlFetch", 33007 },\ + { "crlRefresh", 33008 },\ + { "crlFlush", 33009 },\ + { "trustSettingsRead", 33010 },\ + { "trustSettingsWrite", 33011 },\ + { "crlStatus", 33012 } +#endif + +#ifdef __AfterMigUserHeader +__AfterMigUserHeader +#endif /* __AfterMigUserHeader */ + +#endif /* _ocspd_user_ */ diff --git a/OSX/libsecurity_ocspd/mig/ocspd_client.cpp b/OSX/libsecurity_ocspd/mig/ocspd_client.cpp new file mode 100644 index 00000000..59259ed0 --- /dev/null +++ b/OSX/libsecurity_ocspd/mig/ocspd_client.cpp @@ -0,0 +1,2049 @@ +/* + * IDENTIFICATION: + * stub generated Mon Jul 3 19:46:36 2017 + * with a MiG generated by bootstrap_cmds-96.20.2 + * OPTIONS: + */ +#define __MIG_check__Reply__ocspd_subsystem__ 1 + +#include "ocspd.h" + + +#ifndef mig_internal +#define mig_internal static __inline__ +#endif /* mig_internal */ + +#ifndef mig_external +#define mig_external +#endif /* mig_external */ + +#if !defined(__MigTypeCheck) && defined(TypeCheck) +#define __MigTypeCheck TypeCheck /* Legacy setting */ +#endif /* !defined(__MigTypeCheck) */ + +#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) +#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ +#endif /* !defined(__MigKernelSpecificCode) */ + +#ifndef LimitCheck +#define LimitCheck 0 +#endif /* LimitCheck */ + +#ifndef min +#define min(a,b) ( ((a) < (b))? (a): (b) ) +#endif /* min */ + +#if !defined(_WALIGN_) +#define _WALIGN_(x) (((x) + 3) & ~3) +#endif /* !defined(_WALIGN_) */ + +#if !defined(_WALIGNSZ_) +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) +#endif /* !defined(_WALIGNSZ_) */ + +#ifndef UseStaticTemplates +#define UseStaticTemplates 0 +#endif /* UseStaticTemplates */ + +#ifndef __MachMsgErrorWithTimeout +#define __MachMsgErrorWithTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_DATA: \ + case MACH_SEND_INVALID_DEST: \ + case MACH_SEND_INVALID_HEADER: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + break; \ + case MACH_SEND_TIMED_OUT: \ + case MACH_RCV_TIMED_OUT: \ + default: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithTimeout */ + +#ifndef __MachMsgErrorWithoutTimeout +#define __MachMsgErrorWithoutTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_DATA: \ + case MACH_SEND_INVALID_DEST: \ + case MACH_SEND_INVALID_HEADER: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + break; \ + default: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithoutTimeout */ + +#ifndef __DeclareSendRpc +#define __DeclareSendRpc(_NUM_, _NAME_) +#endif /* __DeclareSendRpc */ + +#ifndef __BeforeSendRpc +#define __BeforeSendRpc(_NUM_, _NAME_) +#endif /* __BeforeSendRpc */ + +#ifndef __AfterSendRpc +#define __AfterSendRpc(_NUM_, _NAME_) +#endif /* __AfterSendRpc */ + +#ifndef __DeclareSendSimple +#define __DeclareSendSimple(_NUM_, _NAME_) +#endif /* __DeclareSendSimple */ + +#ifndef __BeforeSendSimple +#define __BeforeSendSimple(_NUM_, _NAME_) +#endif /* __BeforeSendSimple */ + +#ifndef __AfterSendSimple +#define __AfterSendSimple(_NUM_, _NAME_) +#endif /* __AfterSendSimple */ + +#define msgh_request_port msgh_remote_port +#define msgh_reply_port msgh_local_port + + + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__ocspdFetch_t__defined) +#define __MIG_check__Reply__ocspdFetch_t__defined + +mig_internal kern_return_t __MIG_check__Reply__ocspdFetch_t(__Reply__ocspdFetch_t *Out0P) +{ + + typedef __Reply__ocspdFetch_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 33103) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->ocsp_rep.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__ocspdFetch_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine ocspdFetch */ +mig_external kern_return_t ocsp_client_ocspdFetch +( + mach_port_t serverport, + Data ocsp_req, + mach_msg_type_number_t ocsp_reqCnt, + Data *ocsp_rep, + mach_msg_type_number_t *ocsp_repCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ocsp_req; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ocsp_reqCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ocsp_rep; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ocsp_repCnt; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ocsp_rep; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ocsp_repCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__ocspdFetch_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__ocspdFetch_t__defined */ + + __DeclareSendRpc(33003, "ocspdFetch") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t ocsp_reqTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->ocsp_req = ocsp_reqTemplate; + InP->ocsp_req.address = (void *)(ocsp_req); + InP->ocsp_req.size = ocsp_reqCnt; +#else /* UseStaticTemplates */ + InP->ocsp_req.address = (void *)(ocsp_req); + InP->ocsp_req.size = ocsp_reqCnt; + InP->ocsp_req.deallocate = FALSE; + InP->ocsp_req.copy = MACH_MSG_VIRTUAL_COPY; + InP->ocsp_req.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->ocsp_reqCnt = ocsp_reqCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33003; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33003, "ocspdFetch") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33003, "ocspdFetch") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__ocspdFetch_t__defined) + check_result = __MIG_check__Reply__ocspdFetch_t((__Reply__ocspdFetch_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__ocspdFetch_t__defined) */ + + *ocsp_rep = (Data)(Out0P->ocsp_rep.address); + *ocsp_repCnt = Out0P->ocsp_repCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__ocspdCacheFlush_t__defined) +#define __MIG_check__Reply__ocspdCacheFlush_t__defined + +mig_internal kern_return_t __MIG_check__Reply__ocspdCacheFlush_t(__Reply__ocspdCacheFlush_t *Out0P) +{ + + typedef __Reply__ocspdCacheFlush_t __Reply __attribute__((unused)); + if (Out0P->Head.msgh_id != 33104) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + { + return Out0P->RetCode; + } +} +#endif /* !defined(__MIG_check__Reply__ocspdCacheFlush_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine ocspdCacheFlush */ +mig_external kern_return_t ocsp_client_ocspdCacheFlush +( + mach_port_t serverport, + Data certID, + mach_msg_type_number_t certIDCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t certID; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t certIDCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__ocspdCacheFlush_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__ocspdCacheFlush_t__defined */ + + __DeclareSendRpc(33004, "ocspdCacheFlush") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t certIDTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->certID = certIDTemplate; + InP->certID.address = (void *)(certID); + InP->certID.size = certIDCnt; +#else /* UseStaticTemplates */ + InP->certID.address = (void *)(certID); + InP->certID.size = certIDCnt; + InP->certID.deallocate = FALSE; + InP->certID.copy = MACH_MSG_VIRTUAL_COPY; + InP->certID.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->certIDCnt = certIDCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33004; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33004, "ocspdCacheFlush") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33004, "ocspdCacheFlush") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__ocspdCacheFlush_t__defined) + check_result = __MIG_check__Reply__ocspdCacheFlush_t((__Reply__ocspdCacheFlush_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__ocspdCacheFlush_t__defined) */ + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__ocspdCacheFlushStale_t__defined) +#define __MIG_check__Reply__ocspdCacheFlushStale_t__defined + +mig_internal kern_return_t __MIG_check__Reply__ocspdCacheFlushStale_t(__Reply__ocspdCacheFlushStale_t *Out0P) +{ + + typedef __Reply__ocspdCacheFlushStale_t __Reply __attribute__((unused)); + if (Out0P->Head.msgh_id != 33105) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + { + return Out0P->RetCode; + } +} +#endif /* !defined(__MIG_check__Reply__ocspdCacheFlushStale_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine ocspdCacheFlushStale */ +mig_external kern_return_t ocsp_client_ocspdCacheFlushStale +( + mach_port_t serverport +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__ocspdCacheFlushStale_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__ocspdCacheFlushStale_t__defined */ + + __DeclareSendRpc(33005, "ocspdCacheFlushStale") + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33005; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33005, "ocspdCacheFlushStale") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33005, "ocspdCacheFlushStale") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__ocspdCacheFlushStale_t__defined) + check_result = __MIG_check__Reply__ocspdCacheFlushStale_t((__Reply__ocspdCacheFlushStale_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__ocspdCacheFlushStale_t__defined) */ + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__certFetch_t__defined) +#define __MIG_check__Reply__certFetch_t__defined + +mig_internal kern_return_t __MIG_check__Reply__certFetch_t(__Reply__certFetch_t *Out0P) +{ + + typedef __Reply__certFetch_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 33106) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->cert_data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__certFetch_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine certFetch */ +mig_external kern_return_t ocsp_client_certFetch +( + mach_port_t serverport, + Data cert_url, + mach_msg_type_number_t cert_urlCnt, + Data *cert_data, + mach_msg_type_number_t *cert_dataCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_urlCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_dataCnt; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_dataCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__certFetch_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__certFetch_t__defined */ + + __DeclareSendRpc(33006, "certFetch") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t cert_urlTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->cert_url = cert_urlTemplate; + InP->cert_url.address = (void *)(cert_url); + InP->cert_url.size = cert_urlCnt; +#else /* UseStaticTemplates */ + InP->cert_url.address = (void *)(cert_url); + InP->cert_url.size = cert_urlCnt; + InP->cert_url.deallocate = FALSE; + InP->cert_url.copy = MACH_MSG_VIRTUAL_COPY; + InP->cert_url.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->cert_urlCnt = cert_urlCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33006; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33006, "certFetch") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33006, "certFetch") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__certFetch_t__defined) + check_result = __MIG_check__Reply__certFetch_t((__Reply__certFetch_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__certFetch_t__defined) */ + + *cert_data = (Data)(Out0P->cert_data.address); + *cert_dataCnt = Out0P->cert_dataCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__crlFetch_t__defined) +#define __MIG_check__Reply__crlFetch_t__defined + +mig_internal kern_return_t __MIG_check__Reply__crlFetch_t(__Reply__crlFetch_t *Out0P) +{ + + typedef __Reply__crlFetch_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 33107) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->crl_data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__crlFetch_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine crlFetch */ +mig_external kern_return_t ocsp_client_crlFetch +( + mach_port_t serverport, + Data crl_url, + mach_msg_type_number_t crl_urlCnt, + Data crl_issuer, + mach_msg_type_number_t crl_issuerCnt, + boolean_t cache_read, + boolean_t cache_write, + Data verify_time, + mach_msg_type_number_t verify_timeCnt, + Data *crl_data, + mach_msg_type_number_t *crl_dataCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t crl_url; + mach_msg_ool_descriptor_t crl_issuer; + mach_msg_ool_descriptor_t verify_time; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t crl_urlCnt; + mach_msg_type_number_t crl_issuerCnt; + boolean_t cache_read; + boolean_t cache_write; + mach_msg_type_number_t verify_timeCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t crl_data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t crl_dataCnt; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t crl_data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t crl_dataCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__crlFetch_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__crlFetch_t__defined */ + + __DeclareSendRpc(33007, "crlFetch") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t crl_urlTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t crl_issuerTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t verify_timeTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->crl_url = crl_urlTemplate; + InP->crl_url.address = (void *)(crl_url); + InP->crl_url.size = crl_urlCnt; +#else /* UseStaticTemplates */ + InP->crl_url.address = (void *)(crl_url); + InP->crl_url.size = crl_urlCnt; + InP->crl_url.deallocate = FALSE; + InP->crl_url.copy = MACH_MSG_VIRTUAL_COPY; + InP->crl_url.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->crl_issuer = crl_issuerTemplate; + InP->crl_issuer.address = (void *)(crl_issuer); + InP->crl_issuer.size = crl_issuerCnt; +#else /* UseStaticTemplates */ + InP->crl_issuer.address = (void *)(crl_issuer); + InP->crl_issuer.size = crl_issuerCnt; + InP->crl_issuer.deallocate = FALSE; + InP->crl_issuer.copy = MACH_MSG_VIRTUAL_COPY; + InP->crl_issuer.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->verify_time = verify_timeTemplate; + InP->verify_time.address = (void *)(verify_time); + InP->verify_time.size = verify_timeCnt; +#else /* UseStaticTemplates */ + InP->verify_time.address = (void *)(verify_time); + InP->verify_time.size = verify_timeCnt; + InP->verify_time.deallocate = FALSE; + InP->verify_time.copy = MACH_MSG_VIRTUAL_COPY; + InP->verify_time.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->crl_urlCnt = crl_urlCnt; + + InP->crl_issuerCnt = crl_issuerCnt; + + InP->cache_read = cache_read; + + InP->cache_write = cache_write; + + InP->verify_timeCnt = verify_timeCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33007; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33007, "crlFetch") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33007, "crlFetch") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__crlFetch_t__defined) + check_result = __MIG_check__Reply__crlFetch_t((__Reply__crlFetch_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__crlFetch_t__defined) */ + + *crl_data = (Data)(Out0P->crl_data.address); + *crl_dataCnt = Out0P->crl_dataCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__crlRefresh_t__defined) +#define __MIG_check__Reply__crlRefresh_t__defined + +mig_internal kern_return_t __MIG_check__Reply__crlRefresh_t(__Reply__crlRefresh_t *Out0P) +{ + + typedef __Reply__crlRefresh_t __Reply __attribute__((unused)); + if (Out0P->Head.msgh_id != 33108) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + { + return Out0P->RetCode; + } +} +#endif /* !defined(__MIG_check__Reply__crlRefresh_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine crlRefresh */ +mig_external kern_return_t ocsp_client_crlRefresh +( + mach_port_t serverport, + uint32_t stale_days, + uint32_t expire_overlap_seconds, + boolean_t purge_all, + boolean_t full_crypto_verify +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t stale_days; + uint32_t expire_overlap_seconds; + boolean_t purge_all; + boolean_t full_crypto_verify; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__crlRefresh_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__crlRefresh_t__defined */ + + __DeclareSendRpc(33008, "crlRefresh") + + InP->NDR = NDR_record; + + InP->stale_days = stale_days; + + InP->expire_overlap_seconds = expire_overlap_seconds; + + InP->purge_all = purge_all; + + InP->full_crypto_verify = full_crypto_verify; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33008; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33008, "crlRefresh") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33008, "crlRefresh") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__crlRefresh_t__defined) + check_result = __MIG_check__Reply__crlRefresh_t((__Reply__crlRefresh_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__crlRefresh_t__defined) */ + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__crlFlush_t__defined) +#define __MIG_check__Reply__crlFlush_t__defined + +mig_internal kern_return_t __MIG_check__Reply__crlFlush_t(__Reply__crlFlush_t *Out0P) +{ + + typedef __Reply__crlFlush_t __Reply __attribute__((unused)); + if (Out0P->Head.msgh_id != 33109) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + { + return Out0P->RetCode; + } +} +#endif /* !defined(__MIG_check__Reply__crlFlush_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine crlFlush */ +mig_external kern_return_t ocsp_client_crlFlush +( + mach_port_t serverport, + Data cert_url, + mach_msg_type_number_t cert_urlCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_urlCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__crlFlush_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__crlFlush_t__defined */ + + __DeclareSendRpc(33009, "crlFlush") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t cert_urlTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->cert_url = cert_urlTemplate; + InP->cert_url.address = (void *)(cert_url); + InP->cert_url.size = cert_urlCnt; +#else /* UseStaticTemplates */ + InP->cert_url.address = (void *)(cert_url); + InP->cert_url.size = cert_urlCnt; + InP->cert_url.deallocate = FALSE; + InP->cert_url.copy = MACH_MSG_VIRTUAL_COPY; + InP->cert_url.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->cert_urlCnt = cert_urlCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33009; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33009, "crlFlush") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33009, "crlFlush") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__crlFlush_t__defined) + check_result = __MIG_check__Reply__crlFlush_t((__Reply__crlFlush_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__crlFlush_t__defined) */ + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__trustSettingsRead_t__defined) +#define __MIG_check__Reply__trustSettingsRead_t__defined + +mig_internal kern_return_t __MIG_check__Reply__trustSettingsRead_t(__Reply__trustSettingsRead_t *Out0P) +{ + + typedef __Reply__trustSettingsRead_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 33110) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->trustSettings.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__trustSettingsRead_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine trustSettingsRead */ +mig_external kern_return_t ocsp_client_trustSettingsRead +( + mach_port_t serverport, + uint32_t domain, + Data *trustSettings, + mach_msg_type_number_t *trustSettingsCnt, + OSStatus *rcode +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t domain; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t trustSettings; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t trustSettingsCnt; + OSStatus rcode; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t trustSettings; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t trustSettingsCnt; + OSStatus rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__trustSettingsRead_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__trustSettingsRead_t__defined */ + + __DeclareSendRpc(33010, "trustSettingsRead") + + InP->NDR = NDR_record; + + InP->domain = domain; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33010; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33010, "trustSettingsRead") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33010, "trustSettingsRead") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__trustSettingsRead_t__defined) + check_result = __MIG_check__Reply__trustSettingsRead_t((__Reply__trustSettingsRead_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__trustSettingsRead_t__defined) */ + + *trustSettings = (Data)(Out0P->trustSettings.address); + *trustSettingsCnt = Out0P->trustSettingsCnt; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__trustSettingsWrite_t__defined) +#define __MIG_check__Reply__trustSettingsWrite_t__defined + +mig_internal kern_return_t __MIG_check__Reply__trustSettingsWrite_t(__Reply__trustSettingsWrite_t *Out0P) +{ + + typedef __Reply__trustSettingsWrite_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 33111) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__trustSettingsWrite_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine trustSettingsWrite */ +mig_external kern_return_t ocsp_client_trustSettingsWrite +( + mach_port_t serverport, + mach_port_t clientport, + uint32_t domain, + Data authBlob, + mach_msg_type_number_t authBlobCnt, + Data trustSettings, + mach_msg_type_number_t trustSettingsCnt, + OSStatus *rcode +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t clientport; + mach_msg_ool_descriptor_t authBlob; + mach_msg_ool_descriptor_t trustSettings; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32_t domain; + mach_msg_type_number_t authBlobCnt; + mach_msg_type_number_t trustSettingsCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + OSStatus rcode; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + OSStatus rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__trustSettingsWrite_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__trustSettingsWrite_t__defined */ + + __DeclareSendRpc(33011, "trustSettingsWrite") + +#if UseStaticTemplates + const static mach_msg_port_descriptor_t clientportTemplate = { + /* name = */ MACH_PORT_NULL, + /* pad1 = */ 0, + /* pad2 = */ 0, + /* disp = */ 19, + /* type = */ MACH_MSG_PORT_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t authBlobTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t trustSettingsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->clientport = clientportTemplate; + InP->clientport.name = clientport; +#else /* UseStaticTemplates */ + InP->clientport.name = clientport; + InP->clientport.disposition = 19; + InP->clientport.type = MACH_MSG_PORT_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->authBlob = authBlobTemplate; + InP->authBlob.address = (void *)(authBlob); + InP->authBlob.size = authBlobCnt; +#else /* UseStaticTemplates */ + InP->authBlob.address = (void *)(authBlob); + InP->authBlob.size = authBlobCnt; + InP->authBlob.deallocate = FALSE; + InP->authBlob.copy = MACH_MSG_VIRTUAL_COPY; + InP->authBlob.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->trustSettings = trustSettingsTemplate; + InP->trustSettings.address = (void *)(trustSettings); + InP->trustSettings.size = trustSettingsCnt; +#else /* UseStaticTemplates */ + InP->trustSettings.address = (void *)(trustSettings); + InP->trustSettings.size = trustSettingsCnt; + InP->trustSettings.deallocate = FALSE; + InP->trustSettings.copy = MACH_MSG_VIRTUAL_COPY; + InP->trustSettings.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->domain = domain; + + InP->authBlobCnt = authBlobCnt; + + InP->trustSettingsCnt = trustSettingsCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33011; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33011, "trustSettingsWrite") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33011, "trustSettingsWrite") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__trustSettingsWrite_t__defined) + check_result = __MIG_check__Reply__trustSettingsWrite_t((__Reply__trustSettingsWrite_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__trustSettingsWrite_t__defined) */ + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ocspd_subsystem__ +#if !defined(__MIG_check__Reply__crlStatus_t__defined) +#define __MIG_check__Reply__crlStatus_t__defined + +mig_internal kern_return_t __MIG_check__Reply__crlStatus_t(__Reply__crlStatus_t *Out0P) +{ + + typedef __Reply__crlStatus_t __Reply __attribute__((unused)); + if (Out0P->Head.msgh_id != 33112) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + { + return Out0P->RetCode; + } +} +#endif /* !defined(__MIG_check__Reply__crlStatus_t__defined) */ +#endif /* __MIG_check__Reply__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine crlStatus */ +mig_external kern_return_t ocsp_client_crlStatus +( + mach_port_t serverport, + Data serial_number, + mach_msg_type_number_t serial_numberCnt, + Data cert_issuers, + mach_msg_type_number_t cert_issuersCnt, + Data crl_issuer, + mach_msg_type_number_t crl_issuerCnt, + Data crl_url, + mach_msg_type_number_t crl_urlCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t serial_number; + mach_msg_ool_descriptor_t cert_issuers; + mach_msg_ool_descriptor_t crl_issuer; + mach_msg_ool_descriptor_t crl_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t serial_numberCnt; + mach_msg_type_number_t cert_issuersCnt; + mach_msg_type_number_t crl_issuerCnt; + mach_msg_type_number_t crl_urlCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__crlStatus_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__crlStatus_t__defined */ + + __DeclareSendRpc(33012, "crlStatus") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t serial_numberTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t cert_issuersTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t crl_issuerTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t crl_urlTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 4; +#if UseStaticTemplates + InP->serial_number = serial_numberTemplate; + InP->serial_number.address = (void *)(serial_number); + InP->serial_number.size = serial_numberCnt; +#else /* UseStaticTemplates */ + InP->serial_number.address = (void *)(serial_number); + InP->serial_number.size = serial_numberCnt; + InP->serial_number.deallocate = FALSE; + InP->serial_number.copy = MACH_MSG_VIRTUAL_COPY; + InP->serial_number.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->cert_issuers = cert_issuersTemplate; + InP->cert_issuers.address = (void *)(cert_issuers); + InP->cert_issuers.size = cert_issuersCnt; +#else /* UseStaticTemplates */ + InP->cert_issuers.address = (void *)(cert_issuers); + InP->cert_issuers.size = cert_issuersCnt; + InP->cert_issuers.deallocate = FALSE; + InP->cert_issuers.copy = MACH_MSG_VIRTUAL_COPY; + InP->cert_issuers.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->crl_issuer = crl_issuerTemplate; + InP->crl_issuer.address = (void *)(crl_issuer); + InP->crl_issuer.size = crl_issuerCnt; +#else /* UseStaticTemplates */ + InP->crl_issuer.address = (void *)(crl_issuer); + InP->crl_issuer.size = crl_issuerCnt; + InP->crl_issuer.deallocate = FALSE; + InP->crl_issuer.copy = MACH_MSG_VIRTUAL_COPY; + InP->crl_issuer.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->crl_url = crl_urlTemplate; + InP->crl_url.address = (void *)(crl_url); + InP->crl_url.size = crl_urlCnt; +#else /* UseStaticTemplates */ + InP->crl_url.address = (void *)(crl_url); + InP->crl_url.size = crl_urlCnt; + InP->crl_url.deallocate = FALSE; + InP->crl_url.copy = MACH_MSG_VIRTUAL_COPY; + InP->crl_url.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->serial_numberCnt = serial_numberCnt; + + InP->cert_issuersCnt = cert_issuersCnt; + + InP->crl_issuerCnt = crl_issuerCnt; + + InP->crl_urlCnt = crl_urlCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = serverport; + InP->Head.msgh_reply_port = mig_get_reply_port(); + InP->Head.msgh_id = 33012; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(33012, "crlStatus") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(33012, "crlStatus") + if (msg_result != MACH_MSG_SUCCESS) { + __MachMsgErrorWithoutTimeout(msg_result); + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__crlStatus_t__defined) + check_result = __MIG_check__Reply__crlStatus_t((__Reply__crlStatus_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__crlStatus_t__defined) */ + + return KERN_SUCCESS; +} diff --git a/OSX/libsecurity_ocspd/mig/ocspd_server.cpp b/OSX/libsecurity_ocspd/mig/ocspd_server.cpp new file mode 100644 index 00000000..57edbd99 --- /dev/null +++ b/OSX/libsecurity_ocspd/mig/ocspd_server.cpp @@ -0,0 +1,1945 @@ +/* + * IDENTIFICATION: + * stub generated Mon Jul 3 19:46:36 2017 + * with a MiG generated by bootstrap_cmds-96.20.2 + * OPTIONS: + */ + +/* Module ocspd */ + +#define __MIG_check__Request__ocspd_subsystem__ 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* BEGIN VOUCHER CODE */ + +#ifndef KERNEL +#if defined(__has_include) +#if __has_include() +#ifndef USING_VOUCHERS +#define USING_VOUCHERS +#endif +#ifndef __VOUCHER_FORWARD_TYPE_DECLS__ +#define __VOUCHER_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif // __VOUCHER_FORWARD_TYPE_DECLS__ +#endif // __has_include() +#endif // __has_include +#endif // !KERNEL + +/* END VOUCHER CODE */ + + +/* BEGIN MIG_STRNCPY_ZEROFILL CODE */ + +#if defined(__has_include) +#if __has_include() +#ifndef USING_MIG_STRNCPY_ZEROFILL +#define USING_MIG_STRNCPY_ZEROFILL +#endif +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ +#endif /* __has_include() */ +#endif /* __has_include */ + +/* END MIG_STRNCPY_ZEROFILL CODE */ + + +#include +#include +#include +#include +#include +#include + +#ifndef mig_internal +#define mig_internal static __inline__ +#endif /* mig_internal */ + +#ifndef mig_external +#define mig_external +#endif /* mig_external */ + +#if !defined(__MigTypeCheck) && defined(TypeCheck) +#define __MigTypeCheck TypeCheck /* Legacy setting */ +#endif /* !defined(__MigTypeCheck) */ + +#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) +#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ +#endif /* !defined(__MigKernelSpecificCode) */ + +#ifndef LimitCheck +#define LimitCheck 0 +#endif /* LimitCheck */ + +#ifndef min +#define min(a,b) ( ((a) < (b))? (a): (b) ) +#endif /* min */ + +#if !defined(_WALIGN_) +#define _WALIGN_(x) (((x) + 3) & ~3) +#endif /* !defined(_WALIGN_) */ + +#if !defined(_WALIGNSZ_) +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) +#endif /* !defined(_WALIGNSZ_) */ + +#ifndef UseStaticTemplates +#define UseStaticTemplates 0 +#endif /* UseStaticTemplates */ + +#ifndef __DeclareRcvRpc +#define __DeclareRcvRpc(_NUM_, _NAME_) +#endif /* __DeclareRcvRpc */ + +#ifndef __BeforeRcvRpc +#define __BeforeRcvRpc(_NUM_, _NAME_) +#endif /* __BeforeRcvRpc */ + +#ifndef __AfterRcvRpc +#define __AfterRcvRpc(_NUM_, _NAME_) +#endif /* __AfterRcvRpc */ + +#ifndef __DeclareRcvSimple +#define __DeclareRcvSimple(_NUM_, _NAME_) +#endif /* __DeclareRcvSimple */ + +#ifndef __BeforeRcvSimple +#define __BeforeRcvSimple(_NUM_, _NAME_) +#endif /* __BeforeRcvSimple */ + +#ifndef __AfterRcvSimple +#define __AfterRcvSimple(_NUM_, _NAME_) +#endif /* __AfterRcvSimple */ + +#define novalue void + +#define msgh_request_port msgh_local_port +#define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits) +#define msgh_reply_port msgh_remote_port +#define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits) + +#define MIG_RETURN_ERROR(X, code) {\ + ((mig_reply_error_t *)X)->RetCode = code;\ + ((mig_reply_error_t *)X)->NDR = NDR_record;\ + return;\ + } + +/* typedefs for all requests */ + +#ifndef __Request__ocspd_subsystem__defined +#define __Request__ocspd_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ocsp_req; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ocsp_reqCnt; + } __Request__ocspdFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t certID; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t certIDCnt; + } __Request__ocspdCacheFlush_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__ocspdCacheFlushStale_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_urlCnt; + } __Request__certFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t crl_url; + mach_msg_ool_descriptor_t crl_issuer; + mach_msg_ool_descriptor_t verify_time; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t crl_urlCnt; + mach_msg_type_number_t crl_issuerCnt; + boolean_t cache_read; + boolean_t cache_write; + mach_msg_type_number_t verify_timeCnt; + } __Request__crlFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t stale_days; + uint32_t expire_overlap_seconds; + boolean_t purge_all; + boolean_t full_crypto_verify; + } __Request__crlRefresh_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_urlCnt; + } __Request__crlFlush_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t domain; + } __Request__trustSettingsRead_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t clientport; + mach_msg_ool_descriptor_t authBlob; + mach_msg_ool_descriptor_t trustSettings; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32_t domain; + mach_msg_type_number_t authBlobCnt; + mach_msg_type_number_t trustSettingsCnt; + } __Request__trustSettingsWrite_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t serial_number; + mach_msg_ool_descriptor_t cert_issuers; + mach_msg_ool_descriptor_t crl_issuer; + mach_msg_ool_descriptor_t crl_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t serial_numberCnt; + mach_msg_type_number_t cert_issuersCnt; + mach_msg_type_number_t crl_issuerCnt; + mach_msg_type_number_t crl_urlCnt; + } __Request__crlStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Request__ocspd_subsystem__defined */ + +/* typedefs for all replies */ + +#ifndef __Reply__ocspd_subsystem__defined +#define __Reply__ocspd_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ocsp_rep; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ocsp_repCnt; + } __Reply__ocspdFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__ocspdCacheFlush_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__ocspdCacheFlushStale_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_dataCnt; + } __Reply__certFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t crl_data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t crl_dataCnt; + } __Reply__crlFetch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__crlRefresh_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__crlFlush_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t trustSettings; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t trustSettingsCnt; + OSStatus rcode; + } __Reply__trustSettingsRead_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + OSStatus rcode; + } __Reply__trustSettingsWrite_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__crlStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Reply__ocspd_subsystem__defined */ + + +/* union of all replies */ + +#ifndef __ReplyUnion__ocsp_server_ocspd_subsystem__defined +#define __ReplyUnion__ocsp_server_ocspd_subsystem__defined +union __ReplyUnion__ocsp_server_ocspd_subsystem { + __Reply__ocspdFetch_t Reply_ocspdFetch; + __Reply__ocspdCacheFlush_t Reply_ocspdCacheFlush; + __Reply__ocspdCacheFlushStale_t Reply_ocspdCacheFlushStale; + __Reply__certFetch_t Reply_certFetch; + __Reply__crlFetch_t Reply_crlFetch; + __Reply__crlRefresh_t Reply_crlRefresh; + __Reply__crlFlush_t Reply_crlFlush; + __Reply__trustSettingsRead_t Reply_trustSettingsRead; + __Reply__trustSettingsWrite_t Reply_trustSettingsWrite; + __Reply__crlStatus_t Reply_crlStatus; +}; +#endif /* __RequestUnion__ocsp_server_ocspd_subsystem__defined */ +/* Forward Declarations */ + + +mig_internal novalue _XocspdFetch + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XocspdCacheFlush + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XocspdCacheFlushStale + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XcertFetch + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XcrlFetch + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XcrlRefresh + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XcrlFlush + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XtrustSettingsRead + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XtrustSettingsWrite + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XcrlStatus + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__ocspdFetch_t__defined) +#define __MIG_check__Request__ocspdFetch_t__defined + +mig_internal kern_return_t __MIG_check__Request__ocspdFetch_t(__attribute__((__unused__)) __Request__ocspdFetch_t *In0P) +{ + + typedef __Request__ocspdFetch_t __Request; +#if __MigTypeCheck + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 1) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->ocsp_req.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->ocsp_req.size != In0P->ocsp_reqCnt) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__ocspdFetch_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine ocspdFetch */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_ocspdFetch +( + mach_port_t serverport, + audit_token_t sourceAudit, + Data ocsp_req, + mach_msg_type_number_t ocsp_reqCnt, + Data *ocsp_rep, + mach_msg_type_number_t *ocsp_repCnt +); + +/* Routine ocspdFetch */ +mig_internal novalue _XocspdFetch + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ocsp_req; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ocsp_reqCnt; + mach_msg_max_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__ocspdFetch_t __Request; + typedef __Reply__ocspdFetch_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ +#ifdef __MIG_check__Request__ocspdFetch_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__ocspdFetch_t__defined */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t ocsp_repTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + kern_return_t RetCode; + __DeclareRcvRpc(33003, "ocspdFetch") + __BeforeRcvRpc(33003, "ocspdFetch") + +#if defined(__MIG_check__Request__ocspdFetch_t__defined) + check_result = __MIG_check__Request__ocspdFetch_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__ocspdFetch_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)In0P + + round_msg(In0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { MIG_RETURN_ERROR(In0P, MIG_TRAILER_ERROR); } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(audit_token_t)) + { MIG_RETURN_ERROR(OutP, MIG_TRAILER_ERROR); } + trailer_size -= (mach_msg_size_t)sizeof(audit_token_t); +#endif /* __MigTypeCheck */ +#if UseStaticTemplates + OutP->ocsp_rep = ocsp_repTemplate; +#else /* UseStaticTemplates */ + OutP->ocsp_rep.deallocate = FALSE; + OutP->ocsp_rep.copy = MACH_MSG_VIRTUAL_COPY; + OutP->ocsp_rep.pad1 = 0; + OutP->ocsp_rep.type = MACH_MSG_OOL_DESCRIPTOR; +#if defined(KERNEL) && !defined(__LP64__) + OutP->ocsp_rep.pad_end = 0; +#endif +#endif /* UseStaticTemplates */ + + + OutP->ocsp_repCnt = 0; + + RetCode = ocsp_server_ocspdFetch(In0P->Head.msgh_request_port, TrailerP->msgh_audit, (Data)(In0P->ocsp_req.address), In0P->ocsp_req.size, (Data *)&(OutP->ocsp_rep.address), &OutP->ocsp_repCnt); + mig_deallocate((vm_offset_t) In0P->ocsp_req.address, In0P->ocsp_req.size); + In0P->ocsp_req.address = (void *) 0; + In0P->ocsp_req.size = (mach_msg_size_t) 0; + if (RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, RetCode); + } + OutP->ocsp_rep.size = OutP->ocsp_repCnt; + + + OutP->NDR = NDR_record; + + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); + OutP->msgh_body.msgh_descriptor_count = 1; + __AfterRcvRpc(33003, "ocspdFetch") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__ocspdCacheFlush_t__defined) +#define __MIG_check__Request__ocspdCacheFlush_t__defined + +mig_internal kern_return_t __MIG_check__Request__ocspdCacheFlush_t(__attribute__((__unused__)) __Request__ocspdCacheFlush_t *In0P) +{ + + typedef __Request__ocspdCacheFlush_t __Request; +#if __MigTypeCheck + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 1) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->certID.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->certID.size != In0P->certIDCnt) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__ocspdCacheFlush_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine ocspdCacheFlush */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_ocspdCacheFlush +( + mach_port_t serverport, + Data certID, + mach_msg_type_number_t certIDCnt +); + +/* Routine ocspdCacheFlush */ +mig_internal novalue _XocspdCacheFlush + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t certID; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t certIDCnt; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__ocspdCacheFlush_t __Request; + typedef __Reply__ocspdCacheFlush_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__ocspdCacheFlush_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__ocspdCacheFlush_t__defined */ + + __DeclareRcvRpc(33004, "ocspdCacheFlush") + __BeforeRcvRpc(33004, "ocspdCacheFlush") + +#if defined(__MIG_check__Request__ocspdCacheFlush_t__defined) + check_result = __MIG_check__Request__ocspdCacheFlush_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__ocspdCacheFlush_t__defined) */ + + OutP->RetCode = ocsp_server_ocspdCacheFlush(In0P->Head.msgh_request_port, (Data)(In0P->certID.address), In0P->certID.size); + mig_deallocate((vm_offset_t) In0P->certID.address, In0P->certID.size); + In0P->certID.address = (void *) 0; + In0P->certID.size = (mach_msg_size_t) 0; + + OutP->NDR = NDR_record; + + + __AfterRcvRpc(33004, "ocspdCacheFlush") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__ocspdCacheFlushStale_t__defined) +#define __MIG_check__Request__ocspdCacheFlushStale_t__defined + +mig_internal kern_return_t __MIG_check__Request__ocspdCacheFlushStale_t(__attribute__((__unused__)) __Request__ocspdCacheFlushStale_t *In0P) +{ + + typedef __Request__ocspdCacheFlushStale_t __Request; +#if __MigTypeCheck + if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__ocspdCacheFlushStale_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine ocspdCacheFlushStale */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_ocspdCacheFlushStale +( + mach_port_t serverport +); + +/* Routine ocspdCacheFlushStale */ +mig_internal novalue _XocspdCacheFlushStale + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__ocspdCacheFlushStale_t __Request; + typedef __Reply__ocspdCacheFlushStale_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__ocspdCacheFlushStale_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__ocspdCacheFlushStale_t__defined */ + + __DeclareRcvRpc(33005, "ocspdCacheFlushStale") + __BeforeRcvRpc(33005, "ocspdCacheFlushStale") + +#if defined(__MIG_check__Request__ocspdCacheFlushStale_t__defined) + check_result = __MIG_check__Request__ocspdCacheFlushStale_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__ocspdCacheFlushStale_t__defined) */ + + OutP->RetCode = ocsp_server_ocspdCacheFlushStale(In0P->Head.msgh_request_port); + + OutP->NDR = NDR_record; + + + __AfterRcvRpc(33005, "ocspdCacheFlushStale") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__certFetch_t__defined) +#define __MIG_check__Request__certFetch_t__defined + +mig_internal kern_return_t __MIG_check__Request__certFetch_t(__attribute__((__unused__)) __Request__certFetch_t *In0P) +{ + + typedef __Request__certFetch_t __Request; +#if __MigTypeCheck + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 1) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->cert_url.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->cert_url.size != In0P->cert_urlCnt) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__certFetch_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine certFetch */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_certFetch +( + mach_port_t serverport, + audit_token_t sourceAudit, + Data cert_url, + mach_msg_type_number_t cert_urlCnt, + Data *cert_data, + mach_msg_type_number_t *cert_dataCnt +); + +/* Routine certFetch */ +mig_internal novalue _XcertFetch + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_urlCnt; + mach_msg_max_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__certFetch_t __Request; + typedef __Reply__certFetch_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ +#ifdef __MIG_check__Request__certFetch_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__certFetch_t__defined */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t cert_dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + kern_return_t RetCode; + __DeclareRcvRpc(33006, "certFetch") + __BeforeRcvRpc(33006, "certFetch") + +#if defined(__MIG_check__Request__certFetch_t__defined) + check_result = __MIG_check__Request__certFetch_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__certFetch_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)In0P + + round_msg(In0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { MIG_RETURN_ERROR(In0P, MIG_TRAILER_ERROR); } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(audit_token_t)) + { MIG_RETURN_ERROR(OutP, MIG_TRAILER_ERROR); } + trailer_size -= (mach_msg_size_t)sizeof(audit_token_t); +#endif /* __MigTypeCheck */ +#if UseStaticTemplates + OutP->cert_data = cert_dataTemplate; +#else /* UseStaticTemplates */ + OutP->cert_data.deallocate = FALSE; + OutP->cert_data.copy = MACH_MSG_VIRTUAL_COPY; + OutP->cert_data.pad1 = 0; + OutP->cert_data.type = MACH_MSG_OOL_DESCRIPTOR; +#if defined(KERNEL) && !defined(__LP64__) + OutP->cert_data.pad_end = 0; +#endif +#endif /* UseStaticTemplates */ + + + OutP->cert_dataCnt = 0; + + RetCode = ocsp_server_certFetch(In0P->Head.msgh_request_port, TrailerP->msgh_audit, (Data)(In0P->cert_url.address), In0P->cert_url.size, (Data *)&(OutP->cert_data.address), &OutP->cert_dataCnt); + mig_deallocate((vm_offset_t) In0P->cert_url.address, In0P->cert_url.size); + In0P->cert_url.address = (void *) 0; + In0P->cert_url.size = (mach_msg_size_t) 0; + if (RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, RetCode); + } + OutP->cert_data.size = OutP->cert_dataCnt; + + + OutP->NDR = NDR_record; + + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); + OutP->msgh_body.msgh_descriptor_count = 1; + __AfterRcvRpc(33006, "certFetch") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__crlFetch_t__defined) +#define __MIG_check__Request__crlFetch_t__defined + +mig_internal kern_return_t __MIG_check__Request__crlFetch_t(__attribute__((__unused__)) __Request__crlFetch_t *In0P) +{ + + typedef __Request__crlFetch_t __Request; +#if __MigTypeCheck + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 3) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->crl_url.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->crl_issuer.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->verify_time.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->crl_url.size != In0P->crl_urlCnt) + return MIG_TYPE_ERROR; + if (In0P->crl_issuer.size != In0P->crl_issuerCnt) + return MIG_TYPE_ERROR; + if (In0P->verify_time.size != In0P->verify_timeCnt) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__crlFetch_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine crlFetch */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_crlFetch +( + mach_port_t serverport, + audit_token_t sourceAudit, + Data crl_url, + mach_msg_type_number_t crl_urlCnt, + Data crl_issuer, + mach_msg_type_number_t crl_issuerCnt, + boolean_t cache_read, + boolean_t cache_write, + Data verify_time, + mach_msg_type_number_t verify_timeCnt, + Data *crl_data, + mach_msg_type_number_t *crl_dataCnt +); + +/* Routine crlFetch */ +mig_internal novalue _XcrlFetch + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t crl_url; + mach_msg_ool_descriptor_t crl_issuer; + mach_msg_ool_descriptor_t verify_time; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t crl_urlCnt; + mach_msg_type_number_t crl_issuerCnt; + boolean_t cache_read; + boolean_t cache_write; + mach_msg_type_number_t verify_timeCnt; + mach_msg_max_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__crlFetch_t __Request; + typedef __Reply__crlFetch_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ +#ifdef __MIG_check__Request__crlFetch_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__crlFetch_t__defined */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t crl_dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + kern_return_t RetCode; + __DeclareRcvRpc(33007, "crlFetch") + __BeforeRcvRpc(33007, "crlFetch") + +#if defined(__MIG_check__Request__crlFetch_t__defined) + check_result = __MIG_check__Request__crlFetch_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__crlFetch_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)In0P + + round_msg(In0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { MIG_RETURN_ERROR(In0P, MIG_TRAILER_ERROR); } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(audit_token_t)) + { MIG_RETURN_ERROR(OutP, MIG_TRAILER_ERROR); } + trailer_size -= (mach_msg_size_t)sizeof(audit_token_t); +#endif /* __MigTypeCheck */ +#if UseStaticTemplates + OutP->crl_data = crl_dataTemplate; +#else /* UseStaticTemplates */ + OutP->crl_data.deallocate = FALSE; + OutP->crl_data.copy = MACH_MSG_VIRTUAL_COPY; + OutP->crl_data.pad1 = 0; + OutP->crl_data.type = MACH_MSG_OOL_DESCRIPTOR; +#if defined(KERNEL) && !defined(__LP64__) + OutP->crl_data.pad_end = 0; +#endif +#endif /* UseStaticTemplates */ + + + OutP->crl_dataCnt = 0; + + RetCode = ocsp_server_crlFetch(In0P->Head.msgh_request_port, TrailerP->msgh_audit, (Data)(In0P->crl_url.address), In0P->crl_url.size, (Data)(In0P->crl_issuer.address), In0P->crl_issuer.size, In0P->cache_read, In0P->cache_write, (Data)(In0P->verify_time.address), In0P->verify_time.size, (Data *)&(OutP->crl_data.address), &OutP->crl_dataCnt); + mig_deallocate((vm_offset_t) In0P->verify_time.address, In0P->verify_time.size); + In0P->verify_time.address = (void *) 0; + In0P->verify_time.size = (mach_msg_size_t) 0; + mig_deallocate((vm_offset_t) In0P->crl_issuer.address, In0P->crl_issuer.size); + In0P->crl_issuer.address = (void *) 0; + In0P->crl_issuer.size = (mach_msg_size_t) 0; + mig_deallocate((vm_offset_t) In0P->crl_url.address, In0P->crl_url.size); + In0P->crl_url.address = (void *) 0; + In0P->crl_url.size = (mach_msg_size_t) 0; + if (RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, RetCode); + } + OutP->crl_data.size = OutP->crl_dataCnt; + + + OutP->NDR = NDR_record; + + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); + OutP->msgh_body.msgh_descriptor_count = 1; + __AfterRcvRpc(33007, "crlFetch") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__crlRefresh_t__defined) +#define __MIG_check__Request__crlRefresh_t__defined + +mig_internal kern_return_t __MIG_check__Request__crlRefresh_t(__attribute__((__unused__)) __Request__crlRefresh_t *In0P) +{ + + typedef __Request__crlRefresh_t __Request; +#if __MigTypeCheck + if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__crlRefresh_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine crlRefresh */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_crlRefresh +( + mach_port_t serverport, + uint32_t stale_days, + uint32_t expire_overlap_seconds, + boolean_t purge_all, + boolean_t full_crypto_verify +); + +/* Routine crlRefresh */ +mig_internal novalue _XcrlRefresh + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t stale_days; + uint32_t expire_overlap_seconds; + boolean_t purge_all; + boolean_t full_crypto_verify; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__crlRefresh_t __Request; + typedef __Reply__crlRefresh_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__crlRefresh_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__crlRefresh_t__defined */ + + __DeclareRcvRpc(33008, "crlRefresh") + __BeforeRcvRpc(33008, "crlRefresh") + +#if defined(__MIG_check__Request__crlRefresh_t__defined) + check_result = __MIG_check__Request__crlRefresh_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__crlRefresh_t__defined) */ + + OutP->RetCode = ocsp_server_crlRefresh(In0P->Head.msgh_request_port, In0P->stale_days, In0P->expire_overlap_seconds, In0P->purge_all, In0P->full_crypto_verify); + + OutP->NDR = NDR_record; + + + __AfterRcvRpc(33008, "crlRefresh") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__crlFlush_t__defined) +#define __MIG_check__Request__crlFlush_t__defined + +mig_internal kern_return_t __MIG_check__Request__crlFlush_t(__attribute__((__unused__)) __Request__crlFlush_t *In0P) +{ + + typedef __Request__crlFlush_t __Request; +#if __MigTypeCheck + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 1) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->cert_url.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->cert_url.size != In0P->cert_urlCnt) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__crlFlush_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine crlFlush */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_crlFlush +( + mach_port_t serverport, + Data cert_url, + mach_msg_type_number_t cert_urlCnt +); + +/* Routine crlFlush */ +mig_internal novalue _XcrlFlush + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cert_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t cert_urlCnt; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__crlFlush_t __Request; + typedef __Reply__crlFlush_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__crlFlush_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__crlFlush_t__defined */ + + __DeclareRcvRpc(33009, "crlFlush") + __BeforeRcvRpc(33009, "crlFlush") + +#if defined(__MIG_check__Request__crlFlush_t__defined) + check_result = __MIG_check__Request__crlFlush_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__crlFlush_t__defined) */ + + OutP->RetCode = ocsp_server_crlFlush(In0P->Head.msgh_request_port, (Data)(In0P->cert_url.address), In0P->cert_url.size); + mig_deallocate((vm_offset_t) In0P->cert_url.address, In0P->cert_url.size); + In0P->cert_url.address = (void *) 0; + In0P->cert_url.size = (mach_msg_size_t) 0; + + OutP->NDR = NDR_record; + + + __AfterRcvRpc(33009, "crlFlush") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__trustSettingsRead_t__defined) +#define __MIG_check__Request__trustSettingsRead_t__defined + +mig_internal kern_return_t __MIG_check__Request__trustSettingsRead_t(__attribute__((__unused__)) __Request__trustSettingsRead_t *In0P) +{ + + typedef __Request__trustSettingsRead_t __Request; +#if __MigTypeCheck + if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__trustSettingsRead_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine trustSettingsRead */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_trustSettingsRead +( + mach_port_t serverport, + audit_token_t sourceAudit, + uint32_t domain, + Data *trustSettings, + mach_msg_type_number_t *trustSettingsCnt, + OSStatus *rcode +); + +/* Routine trustSettingsRead */ +mig_internal novalue _XtrustSettingsRead + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t domain; + mach_msg_max_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__trustSettingsRead_t __Request; + typedef __Reply__trustSettingsRead_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ +#ifdef __MIG_check__Request__trustSettingsRead_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__trustSettingsRead_t__defined */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t trustSettingsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + kern_return_t RetCode; + __DeclareRcvRpc(33010, "trustSettingsRead") + __BeforeRcvRpc(33010, "trustSettingsRead") + +#if defined(__MIG_check__Request__trustSettingsRead_t__defined) + check_result = __MIG_check__Request__trustSettingsRead_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__trustSettingsRead_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)In0P + + round_msg(In0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { MIG_RETURN_ERROR(In0P, MIG_TRAILER_ERROR); } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(audit_token_t)) + { MIG_RETURN_ERROR(OutP, MIG_TRAILER_ERROR); } + trailer_size -= (mach_msg_size_t)sizeof(audit_token_t); +#endif /* __MigTypeCheck */ +#if UseStaticTemplates + OutP->trustSettings = trustSettingsTemplate; +#else /* UseStaticTemplates */ + OutP->trustSettings.deallocate = FALSE; + OutP->trustSettings.copy = MACH_MSG_VIRTUAL_COPY; + OutP->trustSettings.pad1 = 0; + OutP->trustSettings.type = MACH_MSG_OOL_DESCRIPTOR; +#if defined(KERNEL) && !defined(__LP64__) + OutP->trustSettings.pad_end = 0; +#endif +#endif /* UseStaticTemplates */ + + + OutP->trustSettingsCnt = 0; + + RetCode = ocsp_server_trustSettingsRead(In0P->Head.msgh_request_port, TrailerP->msgh_audit, In0P->domain, (Data *)&(OutP->trustSettings.address), &OutP->trustSettingsCnt, &OutP->rcode); + if (RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, RetCode); + } + OutP->trustSettings.size = OutP->trustSettingsCnt; + + + OutP->NDR = NDR_record; + + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); + OutP->msgh_body.msgh_descriptor_count = 1; + __AfterRcvRpc(33010, "trustSettingsRead") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__trustSettingsWrite_t__defined) +#define __MIG_check__Request__trustSettingsWrite_t__defined + +mig_internal kern_return_t __MIG_check__Request__trustSettingsWrite_t(__attribute__((__unused__)) __Request__trustSettingsWrite_t *In0P) +{ + + typedef __Request__trustSettingsWrite_t __Request; +#if __MigTypeCheck + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 3) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->clientport.type != MACH_MSG_PORT_DESCRIPTOR || + In0P->clientport.disposition != 17) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->authBlob.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->trustSettings.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->authBlob.size != In0P->authBlobCnt) + return MIG_TYPE_ERROR; + if (In0P->trustSettings.size != In0P->trustSettingsCnt) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__trustSettingsWrite_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine trustSettingsWrite */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_trustSettingsWrite +( + mach_port_t serverport, + audit_token_t sourceAudit, + mach_port_t clientport, + uint32_t domain, + Data authBlob, + mach_msg_type_number_t authBlobCnt, + Data trustSettings, + mach_msg_type_number_t trustSettingsCnt, + OSStatus *rcode +); + +/* Routine trustSettingsWrite */ +mig_internal novalue _XtrustSettingsWrite + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t clientport; + mach_msg_ool_descriptor_t authBlob; + mach_msg_ool_descriptor_t trustSettings; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32_t domain; + mach_msg_type_number_t authBlobCnt; + mach_msg_type_number_t trustSettingsCnt; + mach_msg_max_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__trustSettingsWrite_t __Request; + typedef __Reply__trustSettingsWrite_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ +#ifdef __MIG_check__Request__trustSettingsWrite_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__trustSettingsWrite_t__defined */ + + __DeclareRcvRpc(33011, "trustSettingsWrite") + __BeforeRcvRpc(33011, "trustSettingsWrite") + +#if defined(__MIG_check__Request__trustSettingsWrite_t__defined) + check_result = __MIG_check__Request__trustSettingsWrite_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__trustSettingsWrite_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)In0P + + round_msg(In0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { MIG_RETURN_ERROR(In0P, MIG_TRAILER_ERROR); } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(audit_token_t)) + { MIG_RETURN_ERROR(OutP, MIG_TRAILER_ERROR); } + trailer_size -= (mach_msg_size_t)sizeof(audit_token_t); +#endif /* __MigTypeCheck */ + OutP->RetCode = ocsp_server_trustSettingsWrite(In0P->Head.msgh_request_port, TrailerP->msgh_audit, In0P->clientport.name, In0P->domain, (Data)(In0P->authBlob.address), In0P->authBlob.size, (Data)(In0P->trustSettings.address), In0P->trustSettings.size, &OutP->rcode); + mig_deallocate((vm_offset_t) In0P->trustSettings.address, In0P->trustSettings.size); + In0P->trustSettings.address = (void *) 0; + In0P->trustSettings.size = (mach_msg_size_t) 0; + mig_deallocate((vm_offset_t) In0P->authBlob.address, In0P->authBlob.size); + In0P->authBlob.address = (void *) 0; + In0P->authBlob.size = (mach_msg_size_t) 0; + if (OutP->RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, OutP->RetCode); + } + + OutP->NDR = NDR_record; + + + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); + __AfterRcvRpc(33011, "trustSettingsWrite") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__ocspd_subsystem__ +#if !defined(__MIG_check__Request__crlStatus_t__defined) +#define __MIG_check__Request__crlStatus_t__defined + +mig_internal kern_return_t __MIG_check__Request__crlStatus_t(__attribute__((__unused__)) __Request__crlStatus_t *In0P) +{ + + typedef __Request__crlStatus_t __Request; +#if __MigTypeCheck + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 4) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->serial_number.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->cert_issuers.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->crl_issuer.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->crl_url.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->serial_number.size != In0P->serial_numberCnt) + return MIG_TYPE_ERROR; + if (In0P->cert_issuers.size != In0P->cert_issuersCnt) + return MIG_TYPE_ERROR; + if (In0P->crl_issuer.size != In0P->crl_issuerCnt) + return MIG_TYPE_ERROR; + if (In0P->crl_url.size != In0P->crl_urlCnt) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__crlStatus_t__defined) */ +#endif /* __MIG_check__Request__ocspd_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine crlStatus */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ocsp_server_crlStatus +( + mach_port_t serverport, + Data serial_number, + mach_msg_type_number_t serial_numberCnt, + Data cert_issuers, + mach_msg_type_number_t cert_issuersCnt, + Data crl_issuer, + mach_msg_type_number_t crl_issuerCnt, + Data crl_url, + mach_msg_type_number_t crl_urlCnt +); + +/* Routine crlStatus */ +mig_internal novalue _XcrlStatus + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t serial_number; + mach_msg_ool_descriptor_t cert_issuers; + mach_msg_ool_descriptor_t crl_issuer; + mach_msg_ool_descriptor_t crl_url; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t serial_numberCnt; + mach_msg_type_number_t cert_issuersCnt; + mach_msg_type_number_t crl_issuerCnt; + mach_msg_type_number_t crl_urlCnt; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__crlStatus_t __Request; + typedef __Reply__crlStatus_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__crlStatus_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__crlStatus_t__defined */ + + __DeclareRcvRpc(33012, "crlStatus") + __BeforeRcvRpc(33012, "crlStatus") + +#if defined(__MIG_check__Request__crlStatus_t__defined) + check_result = __MIG_check__Request__crlStatus_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__crlStatus_t__defined) */ + + OutP->RetCode = ocsp_server_crlStatus(In0P->Head.msgh_request_port, (Data)(In0P->serial_number.address), In0P->serial_number.size, (Data)(In0P->cert_issuers.address), In0P->cert_issuers.size, (Data)(In0P->crl_issuer.address), In0P->crl_issuer.size, (Data)(In0P->crl_url.address), In0P->crl_url.size); + mig_deallocate((vm_offset_t) In0P->crl_url.address, In0P->crl_url.size); + In0P->crl_url.address = (void *) 0; + In0P->crl_url.size = (mach_msg_size_t) 0; + mig_deallocate((vm_offset_t) In0P->crl_issuer.address, In0P->crl_issuer.size); + In0P->crl_issuer.address = (void *) 0; + In0P->crl_issuer.size = (mach_msg_size_t) 0; + mig_deallocate((vm_offset_t) In0P->cert_issuers.address, In0P->cert_issuers.size); + In0P->cert_issuers.address = (void *) 0; + In0P->cert_issuers.size = (mach_msg_size_t) 0; + mig_deallocate((vm_offset_t) In0P->serial_number.address, In0P->serial_number.size); + In0P->serial_number.address = (void *) 0; + In0P->serial_number.size = (mach_msg_size_t) 0; + + OutP->NDR = NDR_record; + + + __AfterRcvRpc(33012, "crlStatus") +} + + +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +boolean_t ocspd_server( + mach_msg_header_t *InHeadP, + mach_msg_header_t *OutHeadP); + +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +mig_routine_t ocspd_server_routine( + mach_msg_header_t *InHeadP); + + +/* Description of this subsystem, for use in direct RPC */ +const struct ocsp_server_ocspd_subsystem { + mig_server_routine_t server; /* Server routine */ + mach_msg_id_t start; /* Min routine number */ + mach_msg_id_t end; /* Max routine number + 1 */ + unsigned int maxsize; /* Max msg size */ + vm_address_t reserved; /* Reserved */ + struct routine_descriptor /*Array of routine descriptors */ + routine[10]; +} ocsp_server_ocspd_subsystem = { + ocspd_server_routine, + 33003, + 33013, + (mach_msg_size_t)sizeof(union __ReplyUnion__ocsp_server_ocspd_subsystem), + (vm_address_t)0, + { + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XocspdFetch, 13, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__ocspdFetch_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XocspdCacheFlush, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__ocspdCacheFlush_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XocspdCacheFlushStale, 1, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__ocspdCacheFlushStale_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XcertFetch, 13, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__certFetch_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XcrlFetch, 19, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__crlFetch_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XcrlRefresh, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__crlRefresh_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XcrlFlush, 3, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__crlFlush_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XtrustSettingsRead, 13, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__trustSettingsRead_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XtrustSettingsWrite, 16, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__trustSettingsWrite_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XcrlStatus, 9, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__crlStatus_t)}, + } +}; + +mig_external boolean_t ocspd_server + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + register mig_routine_t routine; + + OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); + OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; + /* Minimal size: routine() will update it if different */ + OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); + OutHeadP->msgh_local_port = MACH_PORT_NULL; + OutHeadP->msgh_id = InHeadP->msgh_id + 100; + OutHeadP->msgh_reserved = 0; + + if ((InHeadP->msgh_id > 33012) || (InHeadP->msgh_id < 33003) || + ((routine = ocsp_server_ocspd_subsystem.routine[InHeadP->msgh_id - 33003].stub_routine) == 0)) { + ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; + ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; + return FALSE; + } + (*routine) (InHeadP, OutHeadP); + return TRUE; +} + +mig_external mig_routine_t ocspd_server_routine + (mach_msg_header_t *InHeadP) +{ + register int msgh_id; + + msgh_id = InHeadP->msgh_id - 33003; + + if ((msgh_id > 9) || (msgh_id < 0)) + return 0; + + return ocsp_server_ocspd_subsystem.routine[msgh_id].stub_routine; +} diff --git a/OSX/libsecurity_pkcs12/CMakeLists.txt b/OSX/libsecurity_pkcs12/CMakeLists.txt new file mode 100644 index 00000000..7ec70e20 --- /dev/null +++ b/OSX/libsecurity_pkcs12/CMakeLists.txt @@ -0,0 +1,14 @@ +add_library(libsecurity_pkcs12 OBJECT + lib/pkcs12Crypto.cpp + lib/pkcs12Utils.cpp + lib/pkcs12Decode.cpp + lib/pkcs12BagAttrs.cpp + lib/pkcs12Coder.cpp + lib/pkcs12Encode.cpp + lib/SecPkcs12.cpp + lib/pkcs12SafeBag.cpp + lib/pkcs12Keychain.cpp + lib/pkcs7Templates.cpp + lib/pkcs12Templates.cpp +) +make_fat(libsecurity_pkcs12) diff --git a/OSX/libsecurity_sd_cspdl/CMakeLists.txt b/OSX/libsecurity_sd_cspdl/CMakeLists.txt new file mode 100644 index 00000000..8fa582be --- /dev/null +++ b/OSX/libsecurity_sd_cspdl/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +add_library(libsecurity_sd_cspdl OBJECT + lib/SDCSPSession.cpp + lib/SDCSPDLDatabase.cpp + lib/SDDLSession.cpp + lib/SDContext.cpp + lib/SDCSPDLSession.cpp + lib/SDFactory.cpp + lib/SDKey.cpp + lib/SDCSPDLPlugin.cpp + lib/SDCSPDLBuiltin.cpp +) +make_fat(libsecurity_sd_cspdl) diff --git a/OSX/libsecurity_smime/CMakeLists.txt b/OSX/libsecurity_smime/CMakeLists.txt new file mode 100644 index 00000000..c703299f --- /dev/null +++ b/OSX/libsecurity_smime/CMakeLists.txt @@ -0,0 +1,36 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +add_library(libsecurity_smime OBJECT + lib/cert.c + lib/cmsarray.c + lib/cmsasn1.c + lib/cmsattr.c + lib/cmscinfo.c + lib/cmscipher.c + lib/SecCMS.c + lib/cmsdecode.c + lib/cmsdigdata.c + lib/cmsdigest.c + lib/cmsencdata.c + lib/cmsencode.c + lib/cmsenvdata.c + lib/cmsmessage.c + lib/cmspubkey.c + lib/cmsrecinfo.c + lib/cmsreclist.c + lib/cmssigdata.c + lib/cmssiginfo.c + lib/cmsutil.c + lib/cryptohi.c + lib/plhash.c + lib/secalgid.c + lib/secitem.c + lib/secoid.c + lib/smimeutil.c + lib/siginfoUtils.cpp + lib/tsaTemplates.c + lib/tsaSupport.c +) +make_fat(libsecurity_smime) diff --git a/OSX/libsecurity_smime/lib/cert.c b/OSX/libsecurity_smime/lib/cert.c index ea5c9b9e..9a48df2a 100644 --- a/OSX/libsecurity_smime/lib/cert.c +++ b/OSX/libsecurity_smime/lib/cert.c @@ -674,7 +674,7 @@ SECStatus CERT_ImportCerts(SecKeychainRef keychain, SECCertUsage usage, unsigned rv = SecCertificateAddToKeychain(cert, keychain); if (rv) { - if (rv == errKCDuplicateItem) + if (rv == -25299) rv = noErr; else { diff --git a/OSX/libsecurity_ssl/CMakeLists.txt b/OSX/libsecurity_ssl/CMakeLists.txt new file mode 100644 index 00000000..8e57db55 --- /dev/null +++ b/OSX/libsecurity_ssl/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +add_library(libsecurity_ssl OBJECT + lib/sslRecord.c + lib/sslContext.c + lib/tlsCallbacks.c + lib/SSLRecordInternal.c + lib/sslKeychain.c + lib/sslMemory.c + lib/sslTransport.c + lib/sslCipherSpecs.c + lib/sslCrypto.c +) +make_fat(libsecurity_ssl) diff --git a/OSX/libsecurity_transform/CMakeLists.txt b/OSX/libsecurity_transform/CMakeLists.txt new file mode 100644 index 00000000..f6331085 --- /dev/null +++ b/OSX/libsecurity_transform/CMakeLists.txt @@ -0,0 +1,36 @@ +add_definitions( + -DCOM_APPLE_SECURITY_SANE_INCLUDES +) + +add_library(libsecurity_transform OBJECT + lib/c++utils.cpp + lib/Source.cpp + lib/EncryptTransform.cpp + lib/SecSignVerifyTransform.c + lib/GroupTransform.cpp + lib/SecCustomTransform.cpp + lib/SecExternalSourceTransform.cpp + lib/StreamSource.cpp + lib/SecGroupTransform.cpp + lib/misc.c + lib/SecEncryptTransform.cpp + lib/Digest.cpp + lib/SecMaskGenerationFunctionTransform.c + lib/LinkedList.cpp + lib/CoreFoundationBasics.cpp + lib/SingleShotSource.cpp + lib/CEncryptDecrypt.c + lib/SecNullTransform.cpp + lib/NullTransform.cpp + lib/EncodeDecodeTransforms.c + lib/SecTransform.cpp + lib/Transform.cpp + lib/TransformFactory.cpp + lib/EncryptTransformUtilities.cpp + lib/SecTransformReadTransform.cpp + lib/Monitor.cpp + lib/SecDigestTransform.cpp + lib/SecCollectTransform.cpp + lib/Utilities.cpp +) +make_fat(libsecurity_transform) diff --git a/OSX/libsecurity_translocate/CMakeLists.txt b/OSX/libsecurity_translocate/CMakeLists.txt new file mode 100644 index 00000000..d2ad52ab --- /dev/null +++ b/OSX/libsecurity_translocate/CMakeLists.txt @@ -0,0 +1,12 @@ +add_library(libsecurity_translocate OBJECT + lib/SecTranslocate.cpp + lib/SecTranslocateShared.cpp + lib/SecTranslocateLSNotification.cpp + lib/SecTranslocateUtilities.cpp + lib/SecTranslocateDANotification.cpp + lib/SecTranslocateServer.cpp + lib/SecTranslocateInterface.cpp + lib/SecTranslocateClient.cpp + lib/SecTranslocateXPCServer.cpp +) +make_fat(libsecurity_translocate) diff --git a/OSX/libsecurity_utilities/CMakeLists.txt b/OSX/libsecurity_utilities/CMakeLists.txt new file mode 100644 index 00000000..f1e61321 --- /dev/null +++ b/OSX/libsecurity_utilities/CMakeLists.txt @@ -0,0 +1,68 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +add_library(libsecurity_utilities OBJECT + lib/cfmach++.cpp + lib/hashing.cpp + lib/devrandom.cpp + lib/headermap.cpp + lib/pcsc++.cpp + lib/ccaudit.cpp + lib/cfmunge.cpp + lib/url.cpp + lib/seccfobject.cpp + lib/superblob.cpp + lib/dyldcache.cpp + lib/buffers.cpp + lib/simpleprefs.cpp + lib/logging.cpp + lib/threading.cpp + lib/tqueue.cpp + lib/timeflow.cpp + lib/trackingallocator.cpp + lib/utilities.cpp + lib/machserver.cpp + lib/cfutilities.cpp + lib/mach_notify.c + lib/crc.c + lib/hosts.cpp + lib/sqlite++.cpp + lib/dispatch.cpp + lib/selector.cpp + lib/inetreply.cpp + lib/fdsel.cpp + lib/fdmover.cpp + lib/socks++4.cpp + lib/FileLockTransaction.cpp + lib/socks++5.cpp + lib/blob.cpp + lib/typedvalue.cpp + lib/ip++.cpp + lib/errors.cpp + lib/endian.cpp + lib/transactions.cpp + lib/unix++.cpp + lib/coderepository.cpp + lib/iodevices.cpp + lib/alloc.cpp + lib/vproc++.cpp + lib/muscle++.cpp + lib/adornments.cpp + lib/debugging_internal.cpp + lib/streams.cpp + lib/cfclass.cpp + lib/mach++.cpp + lib/unixchild.cpp + lib/CSPDLTransaction.cpp + lib/macho++.cpp + lib/bufferfifo.cpp + lib/socks++.cpp + lib/osxcode.cpp + lib/globalizer.cpp + lib/powerwatch.cpp + lib/daemon.cpp + lib/machrunloopserver.cpp + lib/kq++.cpp +) +make_fat(libsecurity_utilities) diff --git a/OSX/libsecurityd/CMakeLists.txt b/OSX/libsecurityd/CMakeLists.txt new file mode 100644 index 00000000..e2d1135b --- /dev/null +++ b/OSX/libsecurityd/CMakeLists.txt @@ -0,0 +1,27 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/mig + ${CMAKE_CURRENT_SOURCE_DIR}/lib +) + +add_library(libsecurityd_client OBJECT + lib/dictionary.cpp + lib/sec_xdr.c + lib/sec_xdr_array.c + lib/sec_xdr_reference.c + lib/sec_xdrmem.c + lib/sec_xdr_sizeof.c + lib/xdr_auth.c + lib/xdr_cssm.c + lib/xdr_dldb.cpp + lib/SharedMemoryClient.cpp + lib/eventlistener.cpp + lib/ssblob.cpp + lib/ssclient.cpp + lib/sstransit.cpp + lib/transition.cpp + mig/ucspClient.cpp + mig/ucspNotifySender.cpp + mig/cshostingClient.cpp + mig/cshostingServer.cpp +) +make_fat(libsecurityd_client) diff --git a/OSX/libsecurityd/mig/cshosting.h b/OSX/libsecurityd/mig/cshosting.h new file mode 100755 index 00000000..d2dd8000 --- /dev/null +++ b/OSX/libsecurityd/mig/cshosting.h @@ -0,0 +1,300 @@ +#ifndef _cshosting_user_ +#define _cshosting_user_ + +/* Module cshosting */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* BEGIN VOUCHER CODE */ + +#ifndef KERNEL +#if defined(__has_include) +#if __has_include() +#ifndef USING_VOUCHERS +#define USING_VOUCHERS +#endif +#ifndef __VOUCHER_FORWARD_TYPE_DECLS__ +#define __VOUCHER_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif // __VOUCHER_FORWARD_TYPE_DECLS__ +#endif // __has_include() +#endif // __has_include +#endif // !KERNEL + +/* END VOUCHER CODE */ + + +/* BEGIN MIG_STRNCPY_ZEROFILL CODE */ + +#if defined(__has_include) +#if __has_include() +#ifndef USING_MIG_STRNCPY_ZEROFILL +#define USING_MIG_STRNCPY_ZEROFILL +#endif +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ +#endif /* __has_include() */ +#endif /* __has_include */ + +/* END MIG_STRNCPY_ZEROFILL CODE */ + + +#ifdef AUTOTEST +#ifndef FUNCTION_PTR_T +#define FUNCTION_PTR_T +typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); +typedef struct { + char *name; + function_ptr_t function; +} function_table_entry; +typedef function_table_entry *function_table_t; +#endif /* FUNCTION_PTR_T */ +#endif /* AUTOTEST */ + +#ifndef cshosting_MSG_COUNT +#define cshosting_MSG_COUNT 4 +#endif /* cshosting_MSG_COUNT */ + +#include +#include +#include +#include +#include +#include + +#ifdef __BeforeMigUserHeader +__BeforeMigUserHeader +#endif /* __BeforeMigUserHeader */ + +#include +__BEGIN_DECLS + + +/* Routine findGuest */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t cshosting_client_findGuest +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef host, + XMLBlob attributes, + mach_msg_type_number_t attributesCnt, + GuestChain *guest, + mach_msg_type_number_t *guestCnt, + mach_port_t *subhost +); + +/* Routine guestStatus */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t cshosting_client_guestStatus +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef guest, + uint32 *status +); + +/* Routine identifyGuest */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t cshosting_client_identifyGuest +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef guest, + FilePathOut path, + HashDataOut cdhash, + uint32 *hashLength, + XMLBlobOut *attributes, + mach_msg_type_number_t *attributesCnt +); + +__END_DECLS + +/********************** Caution **************************/ +/* The following data types should be used to calculate */ +/* maximum message sizes only. The actual message may be */ +/* smaller, and the position of the arguments within the */ +/* message layout may vary from what is presented here. */ +/* For example, if any of the arguments are variable- */ +/* sized, and less than the maximum is sent, the data */ +/* will be packed tight in the actual message to reduce */ +/* the presence of holes. */ +/********************** Caution **************************/ + +/* typedefs for all requests */ + +#ifndef __Request__cshosting_subsystem__defined +#define __Request__cshosting_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + SecGuestRef host; + mach_msg_type_number_t attributesCnt; + } __Request__findGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + } __Request__guestStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + } __Request__identifyGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Request__cshosting_subsystem__defined */ + +/* union of all requests */ + +#ifndef __RequestUnion__cshosting_client_cshosting_subsystem__defined +#define __RequestUnion__cshosting_client_cshosting_subsystem__defined +union __RequestUnion__cshosting_client_cshosting_subsystem { + __Request__findGuest_t Request_cshosting_client_findGuest; + __Request__guestStatus_t Request_cshosting_client_guestStatus; + __Request__identifyGuest_t Request_cshosting_client_identifyGuest; +}; +#endif /* !__RequestUnion__cshosting_client_cshosting_subsystem__defined */ +/* typedefs for all replies */ + +#ifndef __Reply__cshosting_subsystem__defined +#define __Reply__cshosting_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t guest; + mach_msg_port_descriptor_t subhost; + /* end of the kernel processed data */ + NDR_record_t NDR; + OSStatus rcode; + mach_msg_type_number_t guestCnt; + } __Reply__findGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + OSStatus rcode; + uint32 status; + } __Reply__guestStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + OSStatus rcode; + mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t pathCnt; + char path[1024]; + HashDataOut cdhash; + uint32 hashLength; + mach_msg_type_number_t attributesCnt; + } __Reply__identifyGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Reply__cshosting_subsystem__defined */ + +/* union of all replies */ + +#ifndef __ReplyUnion__cshosting_client_cshosting_subsystem__defined +#define __ReplyUnion__cshosting_client_cshosting_subsystem__defined +union __ReplyUnion__cshosting_client_cshosting_subsystem { + __Reply__findGuest_t Reply_cshosting_client_findGuest; + __Reply__guestStatus_t Reply_cshosting_client_guestStatus; + __Reply__identifyGuest_t Reply_cshosting_client_identifyGuest; +}; +#endif /* !__RequestUnion__cshosting_client_cshosting_subsystem__defined */ + +#ifndef subsystem_to_name_map_cshosting +#define subsystem_to_name_map_cshosting \ + { "findGuest", 20000 },\ + { "guestStatus", 20001 },\ + { "identifyGuest", 20003 } +#endif + +#ifdef __AfterMigUserHeader +__AfterMigUserHeader +#endif /* __AfterMigUserHeader */ + +#endif /* _cshosting_user_ */ diff --git a/OSX/libsecurityd/mig/cshostingClient.cpp b/OSX/libsecurityd/mig/cshostingClient.cpp new file mode 100755 index 00000000..ab11cced --- /dev/null +++ b/OSX/libsecurityd/mig/cshostingClient.cpp @@ -0,0 +1,691 @@ +/* + * IDENTIFICATION: + * stub generated Mon Jul 3 19:46:46 2017 + * with a MiG generated by bootstrap_cmds-96.20.2 + * OPTIONS: + */ +#define __MIG_check__Reply__cshosting_subsystem__ 1 + +#include "cshosting.h" + + +#ifndef mig_internal +#define mig_internal static __inline__ +#endif /* mig_internal */ + +#ifndef mig_external +#define mig_external +#endif /* mig_external */ + +#if !defined(__MigTypeCheck) && defined(TypeCheck) +#define __MigTypeCheck TypeCheck /* Legacy setting */ +#endif /* !defined(__MigTypeCheck) */ + +#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) +#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ +#endif /* !defined(__MigKernelSpecificCode) */ + +#ifndef LimitCheck +#define LimitCheck 0 +#endif /* LimitCheck */ + +#ifndef min +#define min(a,b) ( ((a) < (b))? (a): (b) ) +#endif /* min */ + +#if !defined(_WALIGN_) +#define _WALIGN_(x) (((x) + 3) & ~3) +#endif /* !defined(_WALIGN_) */ + +#if !defined(_WALIGNSZ_) +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) +#endif /* !defined(_WALIGNSZ_) */ + +#ifndef UseStaticTemplates +#define UseStaticTemplates 0 +#endif /* UseStaticTemplates */ + +#ifndef __MachMsgErrorWithTimeout +#define __MachMsgErrorWithTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_DATA: \ + case MACH_SEND_INVALID_DEST: \ + case MACH_SEND_INVALID_HEADER: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + break; \ + case MACH_SEND_TIMED_OUT: \ + case MACH_RCV_TIMED_OUT: \ + default: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithTimeout */ + +#ifndef __MachMsgErrorWithoutTimeout +#define __MachMsgErrorWithoutTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_DATA: \ + case MACH_SEND_INVALID_DEST: \ + case MACH_SEND_INVALID_HEADER: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + break; \ + default: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithoutTimeout */ + +#ifndef __DeclareSendRpc +#define __DeclareSendRpc(_NUM_, _NAME_) +#endif /* __DeclareSendRpc */ + +#ifndef __BeforeSendRpc +#define __BeforeSendRpc(_NUM_, _NAME_) +#endif /* __BeforeSendRpc */ + +#ifndef __AfterSendRpc +#define __AfterSendRpc(_NUM_, _NAME_) +#endif /* __AfterSendRpc */ + +#ifndef __DeclareSendSimple +#define __DeclareSendSimple(_NUM_, _NAME_) +#endif /* __DeclareSendSimple */ + +#ifndef __BeforeSendSimple +#define __BeforeSendSimple(_NUM_, _NAME_) +#endif /* __BeforeSendSimple */ + +#ifndef __AfterSendSimple +#define __AfterSendSimple(_NUM_, _NAME_) +#endif /* __AfterSendSimple */ + +#define msgh_request_port msgh_remote_port +#define msgh_reply_port msgh_local_port + + + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__cshosting_subsystem__ +#if !defined(__MIG_check__Reply__findGuest_t__defined) +#define __MIG_check__Reply__findGuest_t__defined + +mig_internal kern_return_t __MIG_check__Reply__findGuest_t(__Reply__findGuest_t *Out0P) +{ + + typedef __Reply__findGuest_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 20100) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->guest.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (Out0P->subhost.type != MACH_MSG_PORT_DESCRIPTOR || + Out0P->subhost.disposition != 17) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__findGuest_t__defined) */ +#endif /* __MIG_check__Reply__cshosting_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine findGuest */ +mig_external kern_return_t cshosting_client_findGuest +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef host, + XMLBlob attributes, + mach_msg_type_number_t attributesCnt, + GuestChain *guest, + mach_msg_type_number_t *guestCnt, + mach_port_t *subhost +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + SecGuestRef host; + mach_msg_type_number_t attributesCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t guest; + mach_msg_port_descriptor_t subhost; + /* end of the kernel processed data */ + NDR_record_t NDR; + OSStatus rcode; + mach_msg_type_number_t guestCnt; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t guest; + mach_msg_port_descriptor_t subhost; + /* end of the kernel processed data */ + NDR_record_t NDR; + OSStatus rcode; + mach_msg_type_number_t guestCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__findGuest_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__findGuest_t__defined */ + + __DeclareSendRpc(20000, "findGuest") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t attributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->attributes = attributesTemplate; + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; +#else /* UseStaticTemplates */ + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; + InP->attributes.deallocate = FALSE; + InP->attributes.copy = MACH_MSG_VIRTUAL_COPY; + InP->attributes.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->host = host; + + InP->attributesCnt = attributesCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 21); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 20000; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(20000, "findGuest") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(20000, "findGuest") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__findGuest_t__defined) + check_result = __MIG_check__Reply__findGuest_t((__Reply__findGuest_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__findGuest_t__defined) */ + + *rcode = Out0P->rcode; + + *guest = (GuestChain)(Out0P->guest.address); + *guestCnt = Out0P->guestCnt; + + *subhost = Out0P->subhost.name; + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__cshosting_subsystem__ +#if !defined(__MIG_check__Reply__guestStatus_t__defined) +#define __MIG_check__Reply__guestStatus_t__defined + +mig_internal kern_return_t __MIG_check__Reply__guestStatus_t(__Reply__guestStatus_t *Out0P) +{ + + typedef __Reply__guestStatus_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 20101) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__guestStatus_t__defined) */ +#endif /* __MIG_check__Reply__cshosting_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine guestStatus */ +mig_external kern_return_t cshosting_client_guestStatus +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef guest, + uint32 *status +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + OSStatus rcode; + uint32 status; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + OSStatus rcode; + uint32 status; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__guestStatus_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__guestStatus_t__defined */ + + __DeclareSendRpc(20001, "guestStatus") + + InP->NDR = NDR_record; + + InP->guest = guest; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 21); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 20001; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(20001, "guestStatus") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(20001, "guestStatus") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__guestStatus_t__defined) + check_result = __MIG_check__Reply__guestStatus_t((__Reply__guestStatus_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__guestStatus_t__defined) */ + + *rcode = Out0P->rcode; + + *status = Out0P->status; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__cshosting_subsystem__ +#if !defined(__MIG_check__Reply__identifyGuest_t__defined) +#define __MIG_check__Reply__identifyGuest_t__defined + +mig_internal kern_return_t __MIG_check__Reply__identifyGuest_t(__Reply__identifyGuest_t *Out0P, __Reply__identifyGuest_t **Out1PP) +{ + + typedef __Reply__identifyGuest_t __Reply __attribute__((unused)); + __Reply *Out1P; + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + unsigned int msgh_size_delta; + + if (Out0P->Head.msgh_id != 20103) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 1024) || msgh_size > (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->attributes.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + msgh_size_delta = _WALIGN_(Out0P->pathCnt); +#if __MigTypeCheck + if ( Out0P->pathCnt > 1024 ) + return MIG_TYPE_ERROR; + if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 1024))< Out0P->pathCnt) || + (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 1024) + _WALIGN_(Out0P->pathCnt))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + *Out1PP = Out1P = (__Reply *) ((pointer_t) Out0P + msgh_size_delta - 1024); + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__identifyGuest_t__defined) */ +#endif /* __MIG_check__Reply__cshosting_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine identifyGuest */ +mig_external kern_return_t cshosting_client_identifyGuest +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef guest, + FilePathOut path, + HashDataOut cdhash, + uint32 *hashLength, + XMLBlobOut *attributes, + mach_msg_type_number_t *attributesCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + OSStatus rcode; + mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t pathCnt; + char path[1024]; + HashDataOut cdhash; + uint32 hashLength; + mach_msg_type_number_t attributesCnt; + mach_msg_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + OSStatus rcode; + mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t pathCnt; + char path[1024]; + HashDataOut cdhash; + uint32 hashLength; + mach_msg_type_number_t attributesCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + Reply *Out1P = NULL; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__identifyGuest_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__identifyGuest_t__defined */ + + __DeclareSendRpc(20003, "identifyGuest") + + InP->NDR = NDR_record; + + InP->guest = guest; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 21); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 20003; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(20003, "identifyGuest") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(20003, "identifyGuest") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__identifyGuest_t__defined) + check_result = __MIG_check__Reply__identifyGuest_t((__Reply__identifyGuest_t *)Out0P, (__Reply__identifyGuest_t **)&Out1P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__identifyGuest_t__defined) */ + + *rcode = Out0P->rcode; + + (void) mig_strncpy(path, Out0P->path, 1024); + + { typedef struct { char data[64]; } *sp; + * (sp) cdhash = * (sp) Out1P->cdhash; + } + + *hashLength = Out1P->hashLength; + + *attributes = (XMLBlobOut)(Out0P->attributes.address); + *attributesCnt = Out1P->attributesCnt; + + return KERN_SUCCESS; +} diff --git a/OSX/libsecurityd/mig/cshostingServer.cpp b/OSX/libsecurityd/mig/cshostingServer.cpp new file mode 100755 index 00000000..b19834b4 --- /dev/null +++ b/OSX/libsecurityd/mig/cshostingServer.cpp @@ -0,0 +1,782 @@ +/* + * IDENTIFICATION: + * stub generated Mon Jul 3 19:46:46 2017 + * with a MiG generated by bootstrap_cmds-96.20.2 + * OPTIONS: + */ + +/* Module cshosting */ + +#define __MIG_check__Request__cshosting_subsystem__ 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* BEGIN VOUCHER CODE */ + +#ifndef KERNEL +#if defined(__has_include) +#if __has_include() +#ifndef USING_VOUCHERS +#define USING_VOUCHERS +#endif +#ifndef __VOUCHER_FORWARD_TYPE_DECLS__ +#define __VOUCHER_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif // __VOUCHER_FORWARD_TYPE_DECLS__ +#endif // __has_include() +#endif // __has_include +#endif // !KERNEL + +/* END VOUCHER CODE */ + + +/* BEGIN MIG_STRNCPY_ZEROFILL CODE */ + +#if defined(__has_include) +#if __has_include() +#ifndef USING_MIG_STRNCPY_ZEROFILL +#define USING_MIG_STRNCPY_ZEROFILL +#endif +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ +#endif /* __has_include() */ +#endif /* __has_include */ + +/* END MIG_STRNCPY_ZEROFILL CODE */ + + +#include +#include +#include +#include +#include +#include + +#ifndef mig_internal +#define mig_internal static __inline__ +#endif /* mig_internal */ + +#ifndef mig_external +#define mig_external +#endif /* mig_external */ + +#if !defined(__MigTypeCheck) && defined(TypeCheck) +#define __MigTypeCheck TypeCheck /* Legacy setting */ +#endif /* !defined(__MigTypeCheck) */ + +#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) +#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ +#endif /* !defined(__MigKernelSpecificCode) */ + +#ifndef LimitCheck +#define LimitCheck 0 +#endif /* LimitCheck */ + +#ifndef min +#define min(a,b) ( ((a) < (b))? (a): (b) ) +#endif /* min */ + +#if !defined(_WALIGN_) +#define _WALIGN_(x) (((x) + 3) & ~3) +#endif /* !defined(_WALIGN_) */ + +#if !defined(_WALIGNSZ_) +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) +#endif /* !defined(_WALIGNSZ_) */ + +#ifndef UseStaticTemplates +#define UseStaticTemplates 0 +#endif /* UseStaticTemplates */ + +#ifndef __DeclareRcvRpc +#define __DeclareRcvRpc(_NUM_, _NAME_) +#endif /* __DeclareRcvRpc */ + +#ifndef __BeforeRcvRpc +#define __BeforeRcvRpc(_NUM_, _NAME_) +#endif /* __BeforeRcvRpc */ + +#ifndef __AfterRcvRpc +#define __AfterRcvRpc(_NUM_, _NAME_) +#endif /* __AfterRcvRpc */ + +#ifndef __DeclareRcvSimple +#define __DeclareRcvSimple(_NUM_, _NAME_) +#endif /* __DeclareRcvSimple */ + +#ifndef __BeforeRcvSimple +#define __BeforeRcvSimple(_NUM_, _NAME_) +#endif /* __BeforeRcvSimple */ + +#ifndef __AfterRcvSimple +#define __AfterRcvSimple(_NUM_, _NAME_) +#endif /* __AfterRcvSimple */ + +#define novalue void + +#define msgh_request_port msgh_local_port +#define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits) +#define msgh_reply_port msgh_remote_port +#define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits) + +#define MIG_RETURN_ERROR(X, code) {\ + ((mig_reply_error_t *)X)->RetCode = code;\ + ((mig_reply_error_t *)X)->NDR = NDR_record;\ + return;\ + } + +/* typedefs for all requests */ + +#ifndef __Request__cshosting_subsystem__defined +#define __Request__cshosting_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + SecGuestRef host; + mach_msg_type_number_t attributesCnt; + } __Request__findGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + } __Request__guestStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + } __Request__identifyGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Request__cshosting_subsystem__defined */ + +/* typedefs for all replies */ + +#ifndef __Reply__cshosting_subsystem__defined +#define __Reply__cshosting_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t guest; + mach_msg_port_descriptor_t subhost; + /* end of the kernel processed data */ + NDR_record_t NDR; + OSStatus rcode; + mach_msg_type_number_t guestCnt; + } __Reply__findGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + OSStatus rcode; + uint32 status; + } __Reply__guestStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + OSStatus rcode; + mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t pathCnt; + char path[1024]; + HashDataOut cdhash; + uint32 hashLength; + mach_msg_type_number_t attributesCnt; + } __Reply__identifyGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Reply__cshosting_subsystem__defined */ + + +/* union of all replies */ + +#ifndef __ReplyUnion__cshosting_server_cshosting_subsystem__defined +#define __ReplyUnion__cshosting_server_cshosting_subsystem__defined +union __ReplyUnion__cshosting_server_cshosting_subsystem { + __Reply__findGuest_t Reply_findGuest; + __Reply__guestStatus_t Reply_guestStatus; + __Reply__identifyGuest_t Reply_identifyGuest; +}; +#endif /* __RequestUnion__cshosting_server_cshosting_subsystem__defined */ +/* Forward Declarations */ + + +mig_internal novalue _XfindGuest + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XguestStatus + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + +mig_internal novalue _XidentifyGuest + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); + + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__cshosting_subsystem__ +#if !defined(__MIG_check__Request__findGuest_t__defined) +#define __MIG_check__Request__findGuest_t__defined + +mig_internal kern_return_t __MIG_check__Request__findGuest_t(__attribute__((__unused__)) __Request__findGuest_t *In0P) +{ + + typedef __Request__findGuest_t __Request; +#if __MigTypeCheck + if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->msgh_body.msgh_descriptor_count != 1) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->attributes.type != MACH_MSG_OOL_DESCRIPTOR) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (In0P->attributes.size != In0P->attributesCnt) + return MIG_TYPE_ERROR; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__findGuest_t__defined) */ +#endif /* __MIG_check__Request__cshosting_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine findGuest */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t cshosting_server_findGuest +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef host, + XMLBlob attributes, + mach_msg_type_number_t attributesCnt, + GuestChain *guest, + mach_msg_type_number_t *guestCnt, + mach_port_t *subhost +); + +/* Routine findGuest */ +mig_internal novalue _XfindGuest + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + SecGuestRef host; + mach_msg_type_number_t attributesCnt; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__findGuest_t __Request; + typedef __Reply__findGuest_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__findGuest_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__findGuest_t__defined */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t guestTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_port_descriptor_t subhostTemplate = { + /* name = */ MACH_PORT_NULL, + /* pad1 = */ 0, + /* pad2 = */ 0, + /* disp = */ 20, + /* type = */ MACH_MSG_PORT_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + kern_return_t RetCode; + __DeclareRcvRpc(20000, "findGuest") + __BeforeRcvRpc(20000, "findGuest") + +#if defined(__MIG_check__Request__findGuest_t__defined) + check_result = __MIG_check__Request__findGuest_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__findGuest_t__defined) */ + +#if UseStaticTemplates + OutP->guest = guestTemplate; +#else /* UseStaticTemplates */ + OutP->guest.deallocate = FALSE; + OutP->guest.copy = MACH_MSG_VIRTUAL_COPY; + OutP->guest.pad1 = 0; + OutP->guest.type = MACH_MSG_OOL_DESCRIPTOR; +#if defined(KERNEL) && !defined(__LP64__) + OutP->guest.pad_end = 0; +#endif +#endif /* UseStaticTemplates */ + + +#if UseStaticTemplates + OutP->subhost = subhostTemplate; +#else /* UseStaticTemplates */ + OutP->subhost.disposition = 20; +#if !(defined(KERNEL) && defined(__LP64__)) + OutP->subhost.pad1 = 0; +#endif + OutP->subhost.pad2 = 0; + OutP->subhost.type = MACH_MSG_PORT_DESCRIPTOR; +#if defined(KERNEL) + OutP->subhost.pad_end = 0; +#endif +#endif /* UseStaticTemplates */ + + + OutP->guestCnt = 0; + + RetCode = cshosting_server_findGuest(In0P->Head.msgh_request_port, In0P->Head.msgh_reply_port, &OutP->rcode, In0P->host, (XMLBlob)(In0P->attributes.address), In0P->attributes.size, (GuestChain *)&(OutP->guest.address), &OutP->guestCnt, &OutP->subhost.name); + mig_deallocate((vm_offset_t) In0P->attributes.address, In0P->attributes.size); + In0P->attributes.address = (void *) 0; + In0P->attributes.size = (mach_msg_size_t) 0; + if (RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, RetCode); + } + OutP->guest.size = OutP->guestCnt * 4; + + + OutP->NDR = NDR_record; + + + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); + OutP->msgh_body.msgh_descriptor_count = 2; + __AfterRcvRpc(20000, "findGuest") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__cshosting_subsystem__ +#if !defined(__MIG_check__Request__guestStatus_t__defined) +#define __MIG_check__Request__guestStatus_t__defined + +mig_internal kern_return_t __MIG_check__Request__guestStatus_t(__attribute__((__unused__)) __Request__guestStatus_t *In0P) +{ + + typedef __Request__guestStatus_t __Request; +#if __MigTypeCheck + if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__guestStatus_t__defined) */ +#endif /* __MIG_check__Request__cshosting_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine guestStatus */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t cshosting_server_guestStatus +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef guest, + uint32 *status +); + +/* Routine guestStatus */ +mig_internal novalue _XguestStatus + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__guestStatus_t __Request; + typedef __Reply__guestStatus_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; +#ifdef __MIG_check__Request__guestStatus_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__guestStatus_t__defined */ + + __DeclareRcvRpc(20001, "guestStatus") + __BeforeRcvRpc(20001, "guestStatus") + +#if defined(__MIG_check__Request__guestStatus_t__defined) + check_result = __MIG_check__Request__guestStatus_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__guestStatus_t__defined) */ + + OutP->RetCode = cshosting_server_guestStatus(In0P->Head.msgh_request_port, In0P->Head.msgh_reply_port, &OutP->rcode, In0P->guest, &OutP->status); + if (OutP->RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, OutP->RetCode); + } + + OutP->NDR = NDR_record; + + + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); + __AfterRcvRpc(20001, "guestStatus") +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Request__cshosting_subsystem__ +#if !defined(__MIG_check__Request__identifyGuest_t__defined) +#define __MIG_check__Request__identifyGuest_t__defined + +mig_internal kern_return_t __MIG_check__Request__identifyGuest_t(__attribute__((__unused__)) __Request__identifyGuest_t *In0P) +{ + + typedef __Request__identifyGuest_t __Request; +#if __MigTypeCheck + if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) + return MIG_BAD_ARGUMENTS; +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Request__identifyGuest_t__defined) */ +#endif /* __MIG_check__Request__cshosting_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine identifyGuest */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t cshosting_server_identifyGuest +( + mach_port_t sport, + mach_port_t rport, + OSStatus *rcode, + SecGuestRef guest, + FilePathOut path, + HashDataOut cdhash, + uint32 *hashLength, + XMLBlobOut *attributes, + mach_msg_type_number_t *attributesCnt +); + +/* Routine identifyGuest */ +mig_internal novalue _XidentifyGuest + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + mach_msg_trailer_t trailer; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + typedef __Request__identifyGuest_t __Request; + typedef __Reply__identifyGuest_t Reply __attribute__((unused)); + + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + Request *In0P = (Request *) InHeadP; + Reply *OutP = (Reply *) OutHeadP; + unsigned int msgh_size_delta; + +#ifdef __MIG_check__Request__identifyGuest_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Request__identifyGuest_t__defined */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t attributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + kern_return_t RetCode; + HashDataOut cdhash; + uint32 hashLength; + mach_msg_type_number_t attributesCnt; + + __DeclareRcvRpc(20003, "identifyGuest") + __BeforeRcvRpc(20003, "identifyGuest") + +#if defined(__MIG_check__Request__identifyGuest_t__defined) + check_result = __MIG_check__Request__identifyGuest_t((__Request *)In0P); + if (check_result != MACH_MSG_SUCCESS) + { MIG_RETURN_ERROR(OutP, check_result); } +#endif /* defined(__MIG_check__Request__identifyGuest_t__defined) */ + +#if UseStaticTemplates + OutP->attributes = attributesTemplate; +#else /* UseStaticTemplates */ + OutP->attributes.deallocate = FALSE; + OutP->attributes.copy = MACH_MSG_VIRTUAL_COPY; + OutP->attributes.pad1 = 0; + OutP->attributes.type = MACH_MSG_OOL_DESCRIPTOR; +#if defined(KERNEL) && !defined(__LP64__) + OutP->attributes.pad_end = 0; +#endif +#endif /* UseStaticTemplates */ + + + attributesCnt = 0; + + RetCode = cshosting_server_identifyGuest(In0P->Head.msgh_request_port, In0P->Head.msgh_reply_port, &OutP->rcode, In0P->guest, OutP->path, cdhash, &hashLength, (XMLBlobOut *)&(OutP->attributes.address), &attributesCnt); + if (RetCode != KERN_SUCCESS) { + MIG_RETURN_ERROR(OutP, RetCode); + } + OutP->attributes.size = attributesCnt; + + + OutP->NDR = NDR_record; + +#ifdef __LP64__ + { + size_t strLength = strlen(OutP->path) + 1; + if (strLength > 0xffffffff) + MIG_RETURN_ERROR(OutP, MIG_BAD_ARGUMENTS); + OutP->pathCnt = (mach_msg_type_number_t) strLength; + } +#else + OutP->pathCnt = (mach_msg_type_number_t) strlen(OutP->path) + 1; +#endif /* __LP64__ */ + msgh_size_delta = _WALIGN_((OutP->pathCnt + 3) & ~3); + OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 1024) + msgh_size_delta; + OutP = (Reply *) ((pointer_t) OutP + msgh_size_delta - 1024); + { typedef struct { char data[64]; } *sp; + * (sp) OutP->cdhash = * (sp) cdhash; + } + OutP->hashLength = hashLength; + OutP->attributesCnt = attributesCnt; + + OutP = (Reply *) OutHeadP; + OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX; + OutP->msgh_body.msgh_descriptor_count = 1; + __AfterRcvRpc(20003, "identifyGuest") +} + + +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +boolean_t cshosting_server( + mach_msg_header_t *InHeadP, + mach_msg_header_t *OutHeadP); + +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +mig_routine_t cshosting_server_routine( + mach_msg_header_t *InHeadP); + + +/* Description of this subsystem, for use in direct RPC */ +const struct cshosting_server_cshosting_subsystem { + mig_server_routine_t server; /* Server routine */ + mach_msg_id_t start; /* Min routine number */ + mach_msg_id_t end; /* Max routine number + 1 */ + unsigned int maxsize; /* Max msg size */ + vm_address_t reserved; /* Reserved */ + struct routine_descriptor /*Array of routine descriptors */ + routine[4]; +} cshosting_server_cshosting_subsystem = { + cshosting_server_routine, + 20000, + 20004, + (mach_msg_size_t)sizeof(union __ReplyUnion__cshosting_server_cshosting_subsystem), + (vm_address_t)0, + { + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XfindGuest, 9, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__findGuest_t)}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XguestStatus, 5, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__guestStatus_t)}, + {0, 0, 0, 0, 0, 0}, + { (mig_impl_routine_t) 0, + (mig_stub_routine_t) _XidentifyGuest, 9, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__identifyGuest_t)}, + } +}; + +mig_external boolean_t cshosting_server + (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) +{ + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + register mig_routine_t routine; + + OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); + OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; + /* Minimal size: routine() will update it if different */ + OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); + OutHeadP->msgh_local_port = MACH_PORT_NULL; + OutHeadP->msgh_id = InHeadP->msgh_id + 100; + OutHeadP->msgh_reserved = 0; + + if ((InHeadP->msgh_id > 20003) || (InHeadP->msgh_id < 20000) || + ((routine = cshosting_server_cshosting_subsystem.routine[InHeadP->msgh_id - 20000].stub_routine) == 0)) { + ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; + ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; + return FALSE; + } + (*routine) (InHeadP, OutHeadP); + return TRUE; +} + +mig_external mig_routine_t cshosting_server_routine + (mach_msg_header_t *InHeadP) +{ + register int msgh_id; + + msgh_id = InHeadP->msgh_id - 20000; + + if ((msgh_id > 3) || (msgh_id < 0)) + return 0; + + return cshosting_server_cshosting_subsystem.routine[msgh_id].stub_routine; +} diff --git a/OSX/libsecurityd/mig/ucsp.h b/OSX/libsecurityd/mig/ucsp.h new file mode 100755 index 00000000..c2fb5091 --- /dev/null +++ b/OSX/libsecurityd/mig/ucsp.h @@ -0,0 +1,4362 @@ +#ifndef _ucsp_user_ +#define _ucsp_user_ + +/* Module ucsp */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* BEGIN VOUCHER CODE */ + +#ifndef KERNEL +#if defined(__has_include) +#if __has_include() +#ifndef USING_VOUCHERS +#define USING_VOUCHERS +#endif +#ifndef __VOUCHER_FORWARD_TYPE_DECLS__ +#define __VOUCHER_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif // __VOUCHER_FORWARD_TYPE_DECLS__ +#endif // __has_include() +#endif // __has_include +#endif // !KERNEL + +/* END VOUCHER CODE */ + + +/* BEGIN MIG_STRNCPY_ZEROFILL CODE */ + +#if defined(__has_include) +#if __has_include() +#ifndef USING_MIG_STRNCPY_ZEROFILL +#define USING_MIG_STRNCPY_ZEROFILL +#endif +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ +#endif /* __has_include() */ +#endif /* __has_include */ + +/* END MIG_STRNCPY_ZEROFILL CODE */ + + +#ifdef AUTOTEST +#ifndef FUNCTION_PTR_T +#define FUNCTION_PTR_T +typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); +typedef struct { + char *name; + function_ptr_t function; +} function_table_entry; +typedef function_table_entry *function_table_t; +#endif /* FUNCTION_PTR_T */ +#endif /* AUTOTEST */ + +#ifndef ucsp_MSG_COUNT +#define ucsp_MSG_COUNT 99 +#endif /* ucsp_MSG_COUNT */ + +#include +#include +#include +#include +#include +#include + +#ifdef __BeforeMigUserHeader +__BeforeMigUserHeader +#endif /* __BeforeMigUserHeader */ + +#include +__BEGIN_DECLS + + +/* Routine setup */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_setup +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + mach_port_t tport, + ClientSetupInfo info, + FilePath FilePath +); + +/* Routine setupThread */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_setupThread +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + mach_port_t tport +); + +/* Routine authenticateDb */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_authenticateDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + CSSM_DB_ACCESS_TYPE accessType, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt +); + +/* Routine releaseDb */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_releaseDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +); + +/* Routine getDbName */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getDbName +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + FilePathOut name +); + +/* Routine setDbName */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_setDbName +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + FilePath name +); + +/* Routine openToken */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_openToken +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + FilePath name, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + IPCDbHandle *db +); + +/* Routine findFirst */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_findFirst +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data query, + mach_msg_type_number_t queryCnt, + Data inAttributes, + mach_msg_type_number_t inAttributesCnt, + Data *outAttributes, + mach_msg_type_number_t *outAttributesCnt, + boolean_t getData, + Data *data, + mach_msg_type_number_t *dataCnt, + IPCKeyHandle *key, + IPCSearchHandle *search, + IPCRecordHandle *record +); + +/* Routine findNext */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_findNext +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCSearchHandle search, + Data inAttributes, + mach_msg_type_number_t inAttributesCnt, + Data *outAttributes, + mach_msg_type_number_t *outAttributesCnt, + boolean_t getData, + Data *data, + mach_msg_type_number_t *dataCnt, + IPCKeyHandle *key, + IPCRecordHandle *record +); + +/* Routine findRecordHandle */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_findRecordHandle +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCRecordHandle record, + Data inAttributes, + mach_msg_type_number_t inAttributesCnt, + Data *outAttributes, + mach_msg_type_number_t *outAttributesCnt, + boolean_t getData, + Data *data, + mach_msg_type_number_t *dataCnt, + IPCKeyHandle *key +); + +/* Routine insertRecord */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_insertRecord +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + CSSM_DB_RECORDTYPE recordType, + Data attributes, + mach_msg_type_number_t attributesCnt, + Data data, + mach_msg_type_number_t dataCnt, + IPCRecordHandle *record +); + +/* Routine deleteRecord */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_deleteRecord +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + IPCRecordHandle record +); + +/* Routine modifyRecord */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_modifyRecord +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + IPCRecordHandle *record, + CSSM_DB_RECORDTYPE recordType, + Data attributes, + mach_msg_type_number_t attributesCnt, + boolean_t setData, + Data data, + mach_msg_type_number_t dataCnt, + CSSM_DB_MODIFY_MODE modifyMode +); + +/* Routine releaseSearch */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_releaseSearch +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCSearchHandle search +); + +/* Routine releaseRecord */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_releaseRecord +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCRecordHandle record +); + +/* Routine createDb */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_createDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle *db, + Data ident, + mach_msg_type_number_t identCnt, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + DBParameters params +); + +/* Routine decodeDb */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_decodeDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle *db, + Data ident, + mach_msg_type_number_t identCnt, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Pointer blob, + mach_msg_type_number_t blobCnt +); + +/* Routine encodeDb */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_encodeDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Pointer *blob, + mach_msg_type_number_t *blobCnt +); + +/* Routine setDbParameters */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_setDbParameters +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + DBParameters params +); + +/* Routine getDbParameters */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getDbParameters +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + DBParameters *params +); + +/* Routine changePassphrase */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_changePassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt +); + +/* Routine lockAll */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_lockAll +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + boolean_t forSleep +); + +/* Routine unlockDb */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_unlockDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +); + +/* Routine unlockDbWithPassphrase */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_unlockDbWithPassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data passPhrase, + mach_msg_type_number_t passPhraseCnt +); + +/* Routine isLocked */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_isLocked +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + boolean_t *locked +); + +/* Routine encodeKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_encodeKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle key, + Pointer *blob, + mach_msg_type_number_t *blobCnt, + boolean_t wantUid, + Data *uid, + mach_msg_type_number_t *uidCnt +); + +/* Routine decodeKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_decodeKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle *key, + Data *header, + mach_msg_type_number_t *headerCnt, + IPCDbHandle db, + Pointer blob, + mach_msg_type_number_t blobCnt +); + +/* Routine recodeKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_recodeKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle oldDb, + IPCKeyHandle key, + IPCDbHandle newDb, + Pointer *newBlob, + mach_msg_type_number_t *newBlobCnt +); + +/* Routine releaseKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_releaseKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle key +); + +/* Routine queryKeySizeInBits */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_queryKeySizeInBits +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle key, + CSSM_KEY_SIZE *length +); + +/* Routine getOutputSize */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getOutputSize +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + uint32 inputSize, + boolean_t encrypt, + uint32 *outputSize +); + +/* Routine getKeyDigest */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getKeyDigest +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle key, + Data *digest, + mach_msg_type_number_t *digestCnt +); + +/* Routine generateSignature */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_generateSignature +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + CSSM_ALGORITHMS signOnlyAlgorithm, + Data data, + mach_msg_type_number_t dataCnt, + Data *signature, + mach_msg_type_number_t *signatureCnt +); + +/* Routine verifySignature */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_verifySignature +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + CSSM_ALGORITHMS signOnlyAlgorithm, + Data data, + mach_msg_type_number_t dataCnt, + Data signature, + mach_msg_type_number_t signatureCnt +); + +/* Routine generateMac */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_generateMac +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data data, + mach_msg_type_number_t dataCnt, + Data *signature, + mach_msg_type_number_t *signatureCnt +); + +/* Routine verifyMac */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_verifyMac +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data data, + mach_msg_type_number_t dataCnt, + Data signature, + mach_msg_type_number_t signatureCnt +); + +/* Routine encrypt */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_encrypt +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data clear, + mach_msg_type_number_t clearCnt, + Data *cipher, + mach_msg_type_number_t *cipherCnt +); + +/* Routine decrypt */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_decrypt +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data cipher, + mach_msg_type_number_t cipherCnt, + Data *clear, + mach_msg_type_number_t *clearCnt +); + +/* Routine generateKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_generateKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + uint32 keyUsage, + uint32 keyAttrs, + IPCKeyHandle *key, + Data *header, + mach_msg_type_number_t *headerCnt +); + +/* Routine generateKeyPair */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_generateKeyPair +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + uint32 pubUsage, + uint32 pubAttrs, + uint32 privUsage, + uint32 privAttrs, + IPCKeyHandle *pubKey, + Data *pubHeader, + mach_msg_type_number_t *pubHeaderCnt, + IPCKeyHandle *privKey, + Data *privHeader, + mach_msg_type_number_t *privHeaderCnt +); + +/* Routine wrapKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_wrapKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + IPCKeyHandle keyToBeWrapped, + Data descriptiveData, + mach_msg_type_number_t descriptiveDataCnt, + Data *wrappedKey, + mach_msg_type_number_t *wrappedKeyCnt +); + +/* Routine unwrapKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_unwrapKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + IPCKeyHandle publicKey, + Data wrappedKey, + mach_msg_type_number_t wrappedKeyCnt, + uint32 usage, + uint32 attributes, + Data *data, + mach_msg_type_number_t *dataCnt, + IPCKeyHandle *resultKey, + Data *header, + mach_msg_type_number_t *headerCnt +); + +/* Routine deriveKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_deriveKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle baseKey, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + Data paramInput, + mach_msg_type_number_t paramInputCnt, + Data *paramOutput, + mach_msg_type_number_t *paramOutputCnt, + uint32 keyUsage, + uint32 keyAttrs, + IPCKeyHandle *key, + Data *header, + mach_msg_type_number_t *headerCnt +); + +/* Routine generateRandom */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_generateRandom +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + Data context, + mach_msg_type_number_t contextCnt, + Data *data, + mach_msg_type_number_t *dataCnt +); + +/* Routine getOwner */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getOwner +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + AclKind kind, + IPCGenericHandle key, + Data *proto, + mach_msg_type_number_t *protoCnt +); + +/* Routine setOwner */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_setOwner +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + AclKind kind, + IPCGenericHandle key, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclOwnerPrototype, + mach_msg_type_number_t aclOwnerPrototypeCnt +); + +/* Routine getAcl */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getAcl +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + AclKind kind, + IPCGenericHandle key, + boolean_t haveTag, + CssmString tag, + uint32 *count, + Data *acls, + mach_msg_type_number_t *aclsCnt +); + +/* Routine changeAcl */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_changeAcl +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + AclKind kind, + IPCGenericHandle key, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + CSSM_ACL_EDIT_MODE mode, + IPCGenericHandle handle, + Data aclEntryInput, + mach_msg_type_number_t aclEntryInputCnt +); + +/* Routine login */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_login +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data name, + mach_msg_type_number_t nameCnt +); + +/* Routine logout */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_logout +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode +); + +/* Routine getStatistics */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getStatistics +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + CSSM_CSP_OPERATIONAL_STATISTICS *statistics +); + +/* Routine getTime */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getTime +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + CSSM_ALGORITHMS algorithm, + Data *data, + mach_msg_type_number_t *dataCnt +); + +/* Routine getCounter */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getCounter +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + Data *data, + mach_msg_type_number_t *dataCnt +); + +/* Routine selfVerify */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_selfVerify +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid +); + +/* Routine cspPassThrough */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_cspPassThrough +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + uint32 id, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle hKey, + Data inData, + mach_msg_type_number_t inDataCnt, + Data *outData, + mach_msg_type_number_t *outDataCnt +); + +/* Routine dlPassThrough */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_dlPassThrough +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + uint32 id, + Data inData, + mach_msg_type_number_t inDataCnt, + Data *outData, + mach_msg_type_number_t *outDataCnt +); + +/* Routine postNotification */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_postNotification +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 domain, + uint32 event, + Data data, + mach_msg_type_number_t dataCnt, + uint32 sequence +); + +/* Routine extractMasterKey */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_extractMasterKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + IPCDbHandle sourceDb, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + uint32 keyUsage, + uint32 keyAttrs, + IPCKeyHandle *key, + Data *header, + mach_msg_type_number_t *headerCnt +); + +/* SimpleRoutine childCheckIn */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_childCheckIn +( + mach_port_t sport, + mach_port_t servicePort, + mach_port_t task_port +); + +/* Routine commitDbForSync */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_commitDbForSync +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle srcDb, + IPCDbHandle cloneDb, + Pointer *blob, + mach_msg_type_number_t *blobCnt +); + +/* Routine registerHosting */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_registerHosting +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + mach_port_t hostingPort, + uint32 flags +); + +/* Routine hostingPort */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_hostingPort +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + pid_t hostPid, + mach_port_t *hostingPort +); + +/* Routine setGuest */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_setGuest +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + SecGuestRef guest, + uint32 flags +); + +/* Routine createGuest */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_createGuest +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + SecGuestRef host, + uint32_t status, + FilePath path, + HashData cdhash, + mach_msg_type_number_t cdhashCnt, + Data attributes, + mach_msg_type_number_t attributesCnt, + uint32 flags, + SecGuestRef *guest +); + +/* Routine setGuestStatus */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_setGuestStatus +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + SecGuestRef guest, + uint32_t status, + Data attributes, + mach_msg_type_number_t attributesCnt +); + +/* Routine removeGuest */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_removeGuest +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + SecGuestRef host, + SecGuestRef guest +); + +/* Routine helpCheckLoad */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_helpCheckLoad +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + FilePath path, + uint32_t addType +); + +/* Routine recodeDbForSync */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_recodeDbForSync +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle dbToClone, + IPCDbHandle srcDb, + IPCDbHandle *newDb +); + +/* Routine authenticateDbsForSync */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_authenticateDbsForSync +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data ipcDbHandleArray, + mach_msg_type_number_t ipcDbHandleArrayCnt, + Data agentData, + mach_msg_type_number_t agentDataCnt, + IPCDbHandle *newDb +); + +/* Routine verifyPrivileged */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_verifyPrivileged +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode +); + +/* Routine verifyPrivileged2 */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_verifyPrivileged2 +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + mach_port_t *originPort +); + +/* Routine stashDb */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_stashDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +); + +/* Routine stashDbCheck */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_stashDbCheck +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +); + +/* Routine verifyKeyStorePassphrase */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_verifyKeyStorePassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32_t retries +); + +/* Routine resetKeyStorePassphrase */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_resetKeyStorePassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data passPhrase, + mach_msg_type_number_t passPhraseCnt +); + +/* Routine changeKeyStorePassphrase */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_changeKeyStorePassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode +); + +/* Routine recodeDbToVersion */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_recodeDbToVersion +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 newVersion, + IPCDbHandle srcDb, + IPCDbHandle *newDb +); + +/* Routine cloneDb */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_cloneDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle srcDb, + Data ident, + mach_msg_type_number_t identCnt, + IPCDbHandle *newDb +); + +/* Routine recodeFinished */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_recodeFinished +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +); + +/* Routine getUserPromptAttempts */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_client_getUserPromptAttempts +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32_t *attempts +); + +__END_DECLS + +/********************** Caution **************************/ +/* The following data types should be used to calculate */ +/* maximum message sizes only. The actual message may be */ +/* smaller, and the position of the arguments within the */ +/* message layout may vary from what is presented here. */ +/* For example, if any of the arguments are variable- */ +/* sized, and less than the maximum is sent, the data */ +/* will be packed tight in the actual message to reduce */ +/* the presence of holes. */ +/********************** Caution **************************/ + +/* typedefs for all requests */ + +#ifndef __Request__ucsp_subsystem__defined +#define __Request__ucsp_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t tport; + /* end of the kernel processed data */ + NDR_record_t NDR; + ClientSetupInfo info; + mach_msg_type_number_t FilePathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t FilePathCnt; + char FilePath[1024]; + } __Request__setup_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t tport; + /* end of the kernel processed data */ + } __Request__setupThread_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + CSSM_DB_ACCESS_TYPE accessType; + mach_msg_type_number_t accessCredentialsCnt; + } __Request__authenticateDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__releaseDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__getDbName_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t nameOffset; /* MiG doesn't use it */ + mach_msg_type_number_t nameCnt; + char name[1024]; + } __Request__setDbName_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 ssid; + mach_msg_type_number_t nameOffset; /* MiG doesn't use it */ + mach_msg_type_number_t nameCnt; + char name[1024]; + mach_msg_type_number_t accessCredentialsCnt; + } __Request__openToken_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t query; + mach_msg_ool_descriptor_t inAttributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t queryCnt; + mach_msg_type_number_t inAttributesCnt; + boolean_t getData; + } __Request__findFirst_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t inAttributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCSearchHandle search; + mach_msg_type_number_t inAttributesCnt; + boolean_t getData; + } __Request__findNext_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t inAttributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCRecordHandle record; + mach_msg_type_number_t inAttributesCnt; + boolean_t getData; + } __Request__findRecordHandle_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + CSSM_DB_RECORDTYPE recordType; + mach_msg_type_number_t attributesCnt; + mach_msg_type_number_t dataCnt; + } __Request__insertRecord_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + IPCRecordHandle record; + } __Request__deleteRecord_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + IPCRecordHandle record; + CSSM_DB_RECORDTYPE recordType; + mach_msg_type_number_t attributesCnt; + boolean_t setData; + mach_msg_type_number_t dataCnt; + CSSM_DB_MODIFY_MODE modifyMode; + } __Request__modifyRecord_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCSearchHandle search; + } __Request__releaseSearch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCRecordHandle record; + } __Request__releaseRecord_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ident; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t identCnt; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + DBParameters params; + } __Request__createDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ident; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t identCnt; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t blobCnt; + } __Request__decodeDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__encodeDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + DBParameters params; + } __Request__setDbParameters_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__getDbParameters_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t accessCredentialsCnt; + } __Request__changePassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + boolean_t forSleep; + } __Request__lockAll_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__unlockDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t passPhrase; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t passPhraseCnt; + } __Request__unlockDbWithPassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__isLocked_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCKeyHandle key; + boolean_t wantUid; + } __Request__encodeKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t blobCnt; + } __Request__decodeKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle oldDb; + IPCKeyHandle key; + IPCDbHandle newDb; + } __Request__recodeKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCKeyHandle key; + } __Request__releaseKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCKeyHandle key; + } __Request__queryKeySizeInBits_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + uint32 inputSize; + boolean_t encrypt; + } __Request__getOutputSize_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCKeyHandle key; + } __Request__getKeyDigest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + CSSM_ALGORITHMS signOnlyAlgorithm; + mach_msg_type_number_t dataCnt; + } __Request__generateSignature_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t data; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + CSSM_ALGORITHMS signOnlyAlgorithm; + mach_msg_type_number_t dataCnt; + mach_msg_type_number_t signatureCnt; + } __Request__verifySignature_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t dataCnt; + } __Request__generateMac_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t data; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t dataCnt; + mach_msg_type_number_t signatureCnt; + } __Request__verifyMac_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t clear; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t clearCnt; + } __Request__encrypt_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t cipher; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t cipherCnt; + } __Request__decrypt_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + uint32 keyUsage; + uint32 keyAttrs; + } __Request__generateKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + uint32 pubUsage; + uint32 pubAttrs; + uint32 privUsage; + uint32 privAttrs; + } __Request__generateKeyPair_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t descriptiveData; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t accessCredentialsCnt; + IPCKeyHandle keyToBeWrapped; + mach_msg_type_number_t descriptiveDataCnt; + } __Request__wrapKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + mach_msg_ool_descriptor_t wrappedKey; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + IPCKeyHandle publicKey; + mach_msg_type_number_t wrappedKeyCnt; + uint32 usage; + uint32 attributes; + } __Request__unwrapKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + mach_msg_ool_descriptor_t paramInput; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + IPCKeyHandle baseKey; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + mach_msg_type_number_t paramInputCnt; + uint32 keyUsage; + uint32 keyAttrs; + } __Request__deriveKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 ssid; + mach_msg_type_number_t contextCnt; + } __Request__generateRandom_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + AclKind kind; + IPCGenericHandle key; + } __Request__getOwner_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclOwnerPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + AclKind kind; + IPCGenericHandle key; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclOwnerPrototypeCnt; + } __Request__setOwner_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + AclKind kind; + IPCGenericHandle key; + boolean_t haveTag; + mach_msg_type_number_t tagOffset; /* MiG doesn't use it */ + mach_msg_type_number_t tagCnt; + char tag[68]; + } __Request__getAcl_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryInput; + /* end of the kernel processed data */ + NDR_record_t NDR; + AclKind kind; + IPCGenericHandle key; + mach_msg_type_number_t accessCredentialsCnt; + CSSM_ACL_EDIT_MODE mode; + IPCGenericHandle handle; + mach_msg_type_number_t aclEntryInputCnt; + } __Request__changeAcl_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t name; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t nameCnt; + } __Request__login_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__logout_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 ssid; + } __Request__getStatistics_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 ssid; + CSSM_ALGORITHMS algorithm; + } __Request__getTime_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 ssid; + } __Request__getCounter_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 ssid; + } __Request__selfVerify_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t inData; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 ssid; + uint32 id; + mach_msg_type_number_t contextCnt; + IPCKeyHandle hKey; + mach_msg_type_number_t inDataCnt; + } __Request__cspPassThrough_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t inData; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 ssid; + uint32 id; + mach_msg_type_number_t inDataCnt; + } __Request__dlPassThrough_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 domain; + uint32 event; + mach_msg_type_number_t dataCnt; + uint32 sequence; + } __Request__postNotification_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + IPCDbHandle sourceDb; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + uint32 keyUsage; + uint32 keyAttrs; + } __Request__extractMasterKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t servicePort; + mach_msg_port_descriptor_t task_port; + /* end of the kernel processed data */ + } __Request__childCheckIn_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle srcDb; + IPCDbHandle cloneDb; + } __Request__commitDbForSync_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t hostingPort; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 flags; + } __Request__registerHosting_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + pid_t hostPid; + } __Request__hostingPort_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + uint32 flags; + } __Request__setGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + SecGuestRef host; + uint32_t status; + mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t pathCnt; + char path[1024]; + mach_msg_type_number_t cdhashCnt; + char cdhash[64]; + mach_msg_type_number_t attributesCnt; + uint32 flags; + } __Request__createGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + SecGuestRef guest; + uint32_t status; + mach_msg_type_number_t attributesCnt; + } __Request__setGuestStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef host; + SecGuestRef guest; + } __Request__removeGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t pathCnt; + char path[1024]; + uint32_t addType; + } __Request__helpCheckLoad_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle dbToClone; + IPCDbHandle srcDb; + } __Request__recodeDbForSync_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ipcDbHandleArray; + mach_msg_ool_descriptor_t agentData; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ipcDbHandleArrayCnt; + mach_msg_type_number_t agentDataCnt; + } __Request__authenticateDbsForSync_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__verifyPrivileged_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__verifyPrivileged2_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__stashDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__stashDbCheck_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t retries; + } __Request__verifyKeyStorePassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t passPhrase; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t passPhraseCnt; + } __Request__resetKeyStorePassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__changeKeyStorePassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 newVersion; + IPCDbHandle srcDb; + } __Request__recodeDbToVersion_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ident; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle srcDb; + mach_msg_type_number_t identCnt; + } __Request__cloneDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } __Request__recodeFinished_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } __Request__getUserPromptAttempts_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Request__ucsp_subsystem__defined */ + +/* union of all requests */ + +#ifndef __RequestUnion__ucsp_client_ucsp_subsystem__defined +#define __RequestUnion__ucsp_client_ucsp_subsystem__defined +union __RequestUnion__ucsp_client_ucsp_subsystem { + __Request__setup_t Request_ucsp_client_setup; + __Request__setupThread_t Request_ucsp_client_setupThread; + __Request__authenticateDb_t Request_ucsp_client_authenticateDb; + __Request__releaseDb_t Request_ucsp_client_releaseDb; + __Request__getDbName_t Request_ucsp_client_getDbName; + __Request__setDbName_t Request_ucsp_client_setDbName; + __Request__openToken_t Request_ucsp_client_openToken; + __Request__findFirst_t Request_ucsp_client_findFirst; + __Request__findNext_t Request_ucsp_client_findNext; + __Request__findRecordHandle_t Request_ucsp_client_findRecordHandle; + __Request__insertRecord_t Request_ucsp_client_insertRecord; + __Request__deleteRecord_t Request_ucsp_client_deleteRecord; + __Request__modifyRecord_t Request_ucsp_client_modifyRecord; + __Request__releaseSearch_t Request_ucsp_client_releaseSearch; + __Request__releaseRecord_t Request_ucsp_client_releaseRecord; + __Request__createDb_t Request_ucsp_client_createDb; + __Request__decodeDb_t Request_ucsp_client_decodeDb; + __Request__encodeDb_t Request_ucsp_client_encodeDb; + __Request__setDbParameters_t Request_ucsp_client_setDbParameters; + __Request__getDbParameters_t Request_ucsp_client_getDbParameters; + __Request__changePassphrase_t Request_ucsp_client_changePassphrase; + __Request__lockAll_t Request_ucsp_client_lockAll; + __Request__unlockDb_t Request_ucsp_client_unlockDb; + __Request__unlockDbWithPassphrase_t Request_ucsp_client_unlockDbWithPassphrase; + __Request__isLocked_t Request_ucsp_client_isLocked; + __Request__encodeKey_t Request_ucsp_client_encodeKey; + __Request__decodeKey_t Request_ucsp_client_decodeKey; + __Request__recodeKey_t Request_ucsp_client_recodeKey; + __Request__releaseKey_t Request_ucsp_client_releaseKey; + __Request__queryKeySizeInBits_t Request_ucsp_client_queryKeySizeInBits; + __Request__getOutputSize_t Request_ucsp_client_getOutputSize; + __Request__getKeyDigest_t Request_ucsp_client_getKeyDigest; + __Request__generateSignature_t Request_ucsp_client_generateSignature; + __Request__verifySignature_t Request_ucsp_client_verifySignature; + __Request__generateMac_t Request_ucsp_client_generateMac; + __Request__verifyMac_t Request_ucsp_client_verifyMac; + __Request__encrypt_t Request_ucsp_client_encrypt; + __Request__decrypt_t Request_ucsp_client_decrypt; + __Request__generateKey_t Request_ucsp_client_generateKey; + __Request__generateKeyPair_t Request_ucsp_client_generateKeyPair; + __Request__wrapKey_t Request_ucsp_client_wrapKey; + __Request__unwrapKey_t Request_ucsp_client_unwrapKey; + __Request__deriveKey_t Request_ucsp_client_deriveKey; + __Request__generateRandom_t Request_ucsp_client_generateRandom; + __Request__getOwner_t Request_ucsp_client_getOwner; + __Request__setOwner_t Request_ucsp_client_setOwner; + __Request__getAcl_t Request_ucsp_client_getAcl; + __Request__changeAcl_t Request_ucsp_client_changeAcl; + __Request__login_t Request_ucsp_client_login; + __Request__logout_t Request_ucsp_client_logout; + __Request__getStatistics_t Request_ucsp_client_getStatistics; + __Request__getTime_t Request_ucsp_client_getTime; + __Request__getCounter_t Request_ucsp_client_getCounter; + __Request__selfVerify_t Request_ucsp_client_selfVerify; + __Request__cspPassThrough_t Request_ucsp_client_cspPassThrough; + __Request__dlPassThrough_t Request_ucsp_client_dlPassThrough; + __Request__postNotification_t Request_ucsp_client_postNotification; + __Request__extractMasterKey_t Request_ucsp_client_extractMasterKey; + __Request__childCheckIn_t Request_ucsp_client_childCheckIn; + __Request__commitDbForSync_t Request_ucsp_client_commitDbForSync; + __Request__registerHosting_t Request_ucsp_client_registerHosting; + __Request__hostingPort_t Request_ucsp_client_hostingPort; + __Request__setGuest_t Request_ucsp_client_setGuest; + __Request__createGuest_t Request_ucsp_client_createGuest; + __Request__setGuestStatus_t Request_ucsp_client_setGuestStatus; + __Request__removeGuest_t Request_ucsp_client_removeGuest; + __Request__helpCheckLoad_t Request_ucsp_client_helpCheckLoad; + __Request__recodeDbForSync_t Request_ucsp_client_recodeDbForSync; + __Request__authenticateDbsForSync_t Request_ucsp_client_authenticateDbsForSync; + __Request__verifyPrivileged_t Request_ucsp_client_verifyPrivileged; + __Request__verifyPrivileged2_t Request_ucsp_client_verifyPrivileged2; + __Request__stashDb_t Request_ucsp_client_stashDb; + __Request__stashDbCheck_t Request_ucsp_client_stashDbCheck; + __Request__verifyKeyStorePassphrase_t Request_ucsp_client_verifyKeyStorePassphrase; + __Request__resetKeyStorePassphrase_t Request_ucsp_client_resetKeyStorePassphrase; + __Request__changeKeyStorePassphrase_t Request_ucsp_client_changeKeyStorePassphrase; + __Request__recodeDbToVersion_t Request_ucsp_client_recodeDbToVersion; + __Request__cloneDb_t Request_ucsp_client_cloneDb; + __Request__recodeFinished_t Request_ucsp_client_recodeFinished; + __Request__getUserPromptAttempts_t Request_ucsp_client_getUserPromptAttempts; +}; +#endif /* !__RequestUnion__ucsp_client_ucsp_subsystem__defined */ +/* typedefs for all replies */ + +#ifndef __Reply__ucsp_subsystem__defined +#define __Reply__ucsp_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__setup_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__setupThread_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__authenticateDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__releaseDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_type_number_t nameOffset; /* MiG doesn't use it */ + mach_msg_type_number_t nameCnt; + char name[1024]; + } __Reply__getDbName_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__setDbName_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + } __Reply__openToken_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + IPCSearchHandle search; + IPCRecordHandle record; + } __Reply__findFirst_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + IPCRecordHandle record; + } __Reply__findNext_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + } __Reply__findRecordHandle_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCRecordHandle record; + } __Reply__insertRecord_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__deleteRecord_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCRecordHandle record; + } __Reply__modifyRecord_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__releaseSearch_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__releaseRecord_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + } __Reply__createDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + } __Reply__decodeDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + } __Reply__encodeDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__setDbParameters_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + DBParameters params; + } __Reply__getDbParameters_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__changePassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__lockAll_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__unlockDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__unlockDbWithPassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + boolean_t locked; + } __Reply__isLocked_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + mach_msg_ool_descriptor_t uid; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + mach_msg_type_number_t uidCnt; + } __Reply__encodeKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + } __Reply__decodeKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t newBlob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t newBlobCnt; + } __Reply__recodeKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__releaseKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + CSSM_KEY_SIZE length; + } __Reply__queryKeySizeInBits_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + uint32 outputSize; + } __Reply__getOutputSize_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t digest; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t digestCnt; + } __Reply__getKeyDigest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t signatureCnt; + } __Reply__generateSignature_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__verifySignature_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t signatureCnt; + } __Reply__generateMac_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__verifyMac_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cipher; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t cipherCnt; + } __Reply__encrypt_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t clear; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t clearCnt; + } __Reply__decrypt_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + } __Reply__generateKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t pubHeader; + mach_msg_ool_descriptor_t privHeader; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle pubKey; + mach_msg_type_number_t pubHeaderCnt; + IPCKeyHandle privKey; + mach_msg_type_number_t privHeaderCnt; + } __Reply__generateKeyPair_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t wrappedKey; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t wrappedKeyCnt; + } __Reply__wrapKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + IPCKeyHandle resultKey; + mach_msg_type_number_t headerCnt; + } __Reply__unwrapKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t paramOutput; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t paramOutputCnt; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + } __Reply__deriveKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + } __Reply__generateRandom_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t proto; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t protoCnt; + } __Reply__getOwner_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__setOwner_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t acls; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + uint32 count; + mach_msg_type_number_t aclsCnt; + } __Reply__getAcl_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__changeAcl_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__login_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__logout_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + CSSM_CSP_OPERATIONAL_STATISTICS statistics; + } __Reply__getStatistics_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + } __Reply__getTime_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + } __Reply__getCounter_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__selfVerify_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outData; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outDataCnt; + } __Reply__cspPassThrough_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outData; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outDataCnt; + } __Reply__dlPassThrough_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__postNotification_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + } __Reply__extractMasterKey_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__childCheckIn_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + } __Reply__commitDbForSync_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__registerHosting_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t hostingPort; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + } __Reply__hostingPort_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__setGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + SecGuestRef guest; + } __Reply__createGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__setGuestStatus_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__removeGuest_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__helpCheckLoad_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + } __Reply__recodeDbForSync_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + } __Reply__authenticateDbsForSync_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__verifyPrivileged_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t originPort; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + } __Reply__verifyPrivileged2_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__stashDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__stashDbCheck_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__verifyKeyStorePassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__resetKeyStorePassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__changeKeyStorePassphrase_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + } __Reply__recodeDbToVersion_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + } __Reply__cloneDb_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply__recodeFinished_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + uint32_t attempts; + } __Reply__getUserPromptAttempts_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Reply__ucsp_subsystem__defined */ + +/* union of all replies */ + +#ifndef __ReplyUnion__ucsp_client_ucsp_subsystem__defined +#define __ReplyUnion__ucsp_client_ucsp_subsystem__defined +union __ReplyUnion__ucsp_client_ucsp_subsystem { + __Reply__setup_t Reply_ucsp_client_setup; + __Reply__setupThread_t Reply_ucsp_client_setupThread; + __Reply__authenticateDb_t Reply_ucsp_client_authenticateDb; + __Reply__releaseDb_t Reply_ucsp_client_releaseDb; + __Reply__getDbName_t Reply_ucsp_client_getDbName; + __Reply__setDbName_t Reply_ucsp_client_setDbName; + __Reply__openToken_t Reply_ucsp_client_openToken; + __Reply__findFirst_t Reply_ucsp_client_findFirst; + __Reply__findNext_t Reply_ucsp_client_findNext; + __Reply__findRecordHandle_t Reply_ucsp_client_findRecordHandle; + __Reply__insertRecord_t Reply_ucsp_client_insertRecord; + __Reply__deleteRecord_t Reply_ucsp_client_deleteRecord; + __Reply__modifyRecord_t Reply_ucsp_client_modifyRecord; + __Reply__releaseSearch_t Reply_ucsp_client_releaseSearch; + __Reply__releaseRecord_t Reply_ucsp_client_releaseRecord; + __Reply__createDb_t Reply_ucsp_client_createDb; + __Reply__decodeDb_t Reply_ucsp_client_decodeDb; + __Reply__encodeDb_t Reply_ucsp_client_encodeDb; + __Reply__setDbParameters_t Reply_ucsp_client_setDbParameters; + __Reply__getDbParameters_t Reply_ucsp_client_getDbParameters; + __Reply__changePassphrase_t Reply_ucsp_client_changePassphrase; + __Reply__lockAll_t Reply_ucsp_client_lockAll; + __Reply__unlockDb_t Reply_ucsp_client_unlockDb; + __Reply__unlockDbWithPassphrase_t Reply_ucsp_client_unlockDbWithPassphrase; + __Reply__isLocked_t Reply_ucsp_client_isLocked; + __Reply__encodeKey_t Reply_ucsp_client_encodeKey; + __Reply__decodeKey_t Reply_ucsp_client_decodeKey; + __Reply__recodeKey_t Reply_ucsp_client_recodeKey; + __Reply__releaseKey_t Reply_ucsp_client_releaseKey; + __Reply__queryKeySizeInBits_t Reply_ucsp_client_queryKeySizeInBits; + __Reply__getOutputSize_t Reply_ucsp_client_getOutputSize; + __Reply__getKeyDigest_t Reply_ucsp_client_getKeyDigest; + __Reply__generateSignature_t Reply_ucsp_client_generateSignature; + __Reply__verifySignature_t Reply_ucsp_client_verifySignature; + __Reply__generateMac_t Reply_ucsp_client_generateMac; + __Reply__verifyMac_t Reply_ucsp_client_verifyMac; + __Reply__encrypt_t Reply_ucsp_client_encrypt; + __Reply__decrypt_t Reply_ucsp_client_decrypt; + __Reply__generateKey_t Reply_ucsp_client_generateKey; + __Reply__generateKeyPair_t Reply_ucsp_client_generateKeyPair; + __Reply__wrapKey_t Reply_ucsp_client_wrapKey; + __Reply__unwrapKey_t Reply_ucsp_client_unwrapKey; + __Reply__deriveKey_t Reply_ucsp_client_deriveKey; + __Reply__generateRandom_t Reply_ucsp_client_generateRandom; + __Reply__getOwner_t Reply_ucsp_client_getOwner; + __Reply__setOwner_t Reply_ucsp_client_setOwner; + __Reply__getAcl_t Reply_ucsp_client_getAcl; + __Reply__changeAcl_t Reply_ucsp_client_changeAcl; + __Reply__login_t Reply_ucsp_client_login; + __Reply__logout_t Reply_ucsp_client_logout; + __Reply__getStatistics_t Reply_ucsp_client_getStatistics; + __Reply__getTime_t Reply_ucsp_client_getTime; + __Reply__getCounter_t Reply_ucsp_client_getCounter; + __Reply__selfVerify_t Reply_ucsp_client_selfVerify; + __Reply__cspPassThrough_t Reply_ucsp_client_cspPassThrough; + __Reply__dlPassThrough_t Reply_ucsp_client_dlPassThrough; + __Reply__postNotification_t Reply_ucsp_client_postNotification; + __Reply__extractMasterKey_t Reply_ucsp_client_extractMasterKey; + __Reply__childCheckIn_t Reply_ucsp_client_childCheckIn; + __Reply__commitDbForSync_t Reply_ucsp_client_commitDbForSync; + __Reply__registerHosting_t Reply_ucsp_client_registerHosting; + __Reply__hostingPort_t Reply_ucsp_client_hostingPort; + __Reply__setGuest_t Reply_ucsp_client_setGuest; + __Reply__createGuest_t Reply_ucsp_client_createGuest; + __Reply__setGuestStatus_t Reply_ucsp_client_setGuestStatus; + __Reply__removeGuest_t Reply_ucsp_client_removeGuest; + __Reply__helpCheckLoad_t Reply_ucsp_client_helpCheckLoad; + __Reply__recodeDbForSync_t Reply_ucsp_client_recodeDbForSync; + __Reply__authenticateDbsForSync_t Reply_ucsp_client_authenticateDbsForSync; + __Reply__verifyPrivileged_t Reply_ucsp_client_verifyPrivileged; + __Reply__verifyPrivileged2_t Reply_ucsp_client_verifyPrivileged2; + __Reply__stashDb_t Reply_ucsp_client_stashDb; + __Reply__stashDbCheck_t Reply_ucsp_client_stashDbCheck; + __Reply__verifyKeyStorePassphrase_t Reply_ucsp_client_verifyKeyStorePassphrase; + __Reply__resetKeyStorePassphrase_t Reply_ucsp_client_resetKeyStorePassphrase; + __Reply__changeKeyStorePassphrase_t Reply_ucsp_client_changeKeyStorePassphrase; + __Reply__recodeDbToVersion_t Reply_ucsp_client_recodeDbToVersion; + __Reply__cloneDb_t Reply_ucsp_client_cloneDb; + __Reply__recodeFinished_t Reply_ucsp_client_recodeFinished; + __Reply__getUserPromptAttempts_t Reply_ucsp_client_getUserPromptAttempts; +}; +#endif /* !__RequestUnion__ucsp_client_ucsp_subsystem__defined */ + +#ifndef subsystem_to_name_map_ucsp +#define subsystem_to_name_map_ucsp \ + { "setup", 1000 },\ + { "setupThread", 1002 },\ + { "authenticateDb", 1003 },\ + { "releaseDb", 1004 },\ + { "getDbName", 1005 },\ + { "setDbName", 1006 },\ + { "openToken", 1007 },\ + { "findFirst", 1008 },\ + { "findNext", 1009 },\ + { "findRecordHandle", 1010 },\ + { "insertRecord", 1011 },\ + { "deleteRecord", 1012 },\ + { "modifyRecord", 1013 },\ + { "releaseSearch", 1014 },\ + { "releaseRecord", 1015 },\ + { "createDb", 1016 },\ + { "decodeDb", 1018 },\ + { "encodeDb", 1019 },\ + { "setDbParameters", 1020 },\ + { "getDbParameters", 1021 },\ + { "changePassphrase", 1022 },\ + { "lockAll", 1023 },\ + { "unlockDb", 1024 },\ + { "unlockDbWithPassphrase", 1025 },\ + { "isLocked", 1026 },\ + { "encodeKey", 1027 },\ + { "decodeKey", 1028 },\ + { "recodeKey", 1029 },\ + { "releaseKey", 1030 },\ + { "queryKeySizeInBits", 1031 },\ + { "getOutputSize", 1032 },\ + { "getKeyDigest", 1033 },\ + { "generateSignature", 1034 },\ + { "verifySignature", 1035 },\ + { "generateMac", 1036 },\ + { "verifyMac", 1037 },\ + { "encrypt", 1038 },\ + { "decrypt", 1039 },\ + { "generateKey", 1040 },\ + { "generateKeyPair", 1041 },\ + { "wrapKey", 1042 },\ + { "unwrapKey", 1043 },\ + { "deriveKey", 1044 },\ + { "generateRandom", 1045 },\ + { "getOwner", 1046 },\ + { "setOwner", 1047 },\ + { "getAcl", 1048 },\ + { "changeAcl", 1049 },\ + { "login", 1050 },\ + { "logout", 1051 },\ + { "getStatistics", 1052 },\ + { "getTime", 1053 },\ + { "getCounter", 1054 },\ + { "selfVerify", 1055 },\ + { "cspPassThrough", 1056 },\ + { "dlPassThrough", 1057 },\ + { "postNotification", 1069 },\ + { "extractMasterKey", 1070 },\ + { "childCheckIn", 1077 },\ + { "commitDbForSync", 1078 },\ + { "registerHosting", 1079 },\ + { "hostingPort", 1080 },\ + { "setGuest", 1081 },\ + { "createGuest", 1082 },\ + { "setGuestStatus", 1083 },\ + { "removeGuest", 1084 },\ + { "helpCheckLoad", 1085 },\ + { "recodeDbForSync", 1086 },\ + { "authenticateDbsForSync", 1087 },\ + { "verifyPrivileged", 1088 },\ + { "verifyPrivileged2", 1089 },\ + { "stashDb", 1090 },\ + { "stashDbCheck", 1091 },\ + { "verifyKeyStorePassphrase", 1092 },\ + { "resetKeyStorePassphrase", 1093 },\ + { "changeKeyStorePassphrase", 1094 },\ + { "recodeDbToVersion", 1095 },\ + { "cloneDb", 1096 },\ + { "recodeFinished", 1097 },\ + { "getUserPromptAttempts", 1098 } +#endif + +#ifdef __AfterMigUserHeader +__AfterMigUserHeader +#endif /* __AfterMigUserHeader */ + +#endif /* _ucsp_user_ */ diff --git a/OSX/libsecurityd/mig/ucspClient.cpp b/OSX/libsecurityd/mig/ucspClient.cpp new file mode 100755 index 00000000..1b80341f --- /dev/null +++ b/OSX/libsecurityd/mig/ucspClient.cpp @@ -0,0 +1,17388 @@ +/* + * IDENTIFICATION: + * stub generated Mon Jul 3 19:46:45 2017 + * with a MiG generated by bootstrap_cmds-96.20.2 + * OPTIONS: + */ +#define __MIG_check__Reply__ucsp_subsystem__ 1 + +#include "ucsp.h" + + +#ifndef mig_internal +#define mig_internal static __inline__ +#endif /* mig_internal */ + +#ifndef mig_external +#define mig_external +#endif /* mig_external */ + +#if !defined(__MigTypeCheck) && defined(TypeCheck) +#define __MigTypeCheck TypeCheck /* Legacy setting */ +#endif /* !defined(__MigTypeCheck) */ + +#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) +#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ +#endif /* !defined(__MigKernelSpecificCode) */ + +#ifndef LimitCheck +#define LimitCheck 0 +#endif /* LimitCheck */ + +#ifndef min +#define min(a,b) ( ((a) < (b))? (a): (b) ) +#endif /* min */ + +#if !defined(_WALIGN_) +#define _WALIGN_(x) (((x) + 3) & ~3) +#endif /* !defined(_WALIGN_) */ + +#if !defined(_WALIGNSZ_) +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) +#endif /* !defined(_WALIGNSZ_) */ + +#ifndef UseStaticTemplates +#define UseStaticTemplates 0 +#endif /* UseStaticTemplates */ + +#ifndef __MachMsgErrorWithTimeout +#define __MachMsgErrorWithTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_DATA: \ + case MACH_SEND_INVALID_DEST: \ + case MACH_SEND_INVALID_HEADER: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + break; \ + case MACH_SEND_TIMED_OUT: \ + case MACH_RCV_TIMED_OUT: \ + default: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithTimeout */ + +#ifndef __MachMsgErrorWithoutTimeout +#define __MachMsgErrorWithoutTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_DATA: \ + case MACH_SEND_INVALID_DEST: \ + case MACH_SEND_INVALID_HEADER: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + break; \ + default: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithoutTimeout */ + +#ifndef __DeclareSendRpc +#define __DeclareSendRpc(_NUM_, _NAME_) +#endif /* __DeclareSendRpc */ + +#ifndef __BeforeSendRpc +#define __BeforeSendRpc(_NUM_, _NAME_) +#endif /* __BeforeSendRpc */ + +#ifndef __AfterSendRpc +#define __AfterSendRpc(_NUM_, _NAME_) +#endif /* __AfterSendRpc */ + +#ifndef __DeclareSendSimple +#define __DeclareSendSimple(_NUM_, _NAME_) +#endif /* __DeclareSendSimple */ + +#ifndef __BeforeSendSimple +#define __BeforeSendSimple(_NUM_, _NAME_) +#endif /* __BeforeSendSimple */ + +#ifndef __AfterSendSimple +#define __AfterSendSimple(_NUM_, _NAME_) +#endif /* __AfterSendSimple */ + +#define msgh_request_port msgh_remote_port +#define msgh_reply_port msgh_local_port + + + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__setup_t__defined) +#define __MIG_check__Reply__setup_t__defined + +mig_internal kern_return_t __MIG_check__Reply__setup_t(__Reply__setup_t *Out0P) +{ + + typedef __Reply__setup_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1100) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__setup_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine setup */ +mig_external kern_return_t ucsp_client_setup +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + mach_port_t tport, + ClientSetupInfo info, + FilePath FilePath +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t tport; + /* end of the kernel processed data */ + NDR_record_t NDR; + ClientSetupInfo info; + mach_msg_type_number_t FilePathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t FilePathCnt; + char FilePath[1024]; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + unsigned int msgh_size; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__setup_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__setup_t__defined */ + + __DeclareSendRpc(1000, "setup") + +#if UseStaticTemplates + const static mach_msg_port_descriptor_t tportTemplate = { + /* name = */ MACH_PORT_NULL, + /* pad1 = */ 0, + /* pad2 = */ 0, + /* disp = */ 19, + /* type = */ MACH_MSG_PORT_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->tport = tportTemplate; + InP->tport.name = tport; +#else /* UseStaticTemplates */ + InP->tport.name = tport; + InP->tport.disposition = 19; + InP->tport.type = MACH_MSG_PORT_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->info = info; + +#ifdef USING_MIG_STRNCPY_ZEROFILL + if (mig_strncpy_zerofill != NULL) { + InP->FilePathCnt = mig_strncpy_zerofill(InP->FilePath, FilePath, 1024); + } else { +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + InP->FilePathCnt = mig_strncpy(InP->FilePath, FilePath, 1024); +#ifdef USING_MIG_STRNCPY_ZEROFILL + } +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + + msgh_size = (mach_msg_size_t)(sizeof(Request) - 1024) + (_WALIGN_(InP->FilePathCnt)); + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1000; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1000, "setup") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1000, "setup") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__setup_t__defined) + check_result = __MIG_check__Reply__setup_t((__Reply__setup_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__setup_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__setupThread_t__defined) +#define __MIG_check__Reply__setupThread_t__defined + +mig_internal kern_return_t __MIG_check__Reply__setupThread_t(__Reply__setupThread_t *Out0P) +{ + + typedef __Reply__setupThread_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1102) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__setupThread_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine setupThread */ +mig_external kern_return_t ucsp_client_setupThread +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + mach_port_t tport +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t tport; + /* end of the kernel processed data */ + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__setupThread_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__setupThread_t__defined */ + + __DeclareSendRpc(1002, "setupThread") + +#if UseStaticTemplates + const static mach_msg_port_descriptor_t tportTemplate = { + /* name = */ MACH_PORT_NULL, + /* pad1 = */ 0, + /* pad2 = */ 0, + /* disp = */ 19, + /* type = */ MACH_MSG_PORT_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->tport = tportTemplate; + InP->tport.name = tport; +#else /* UseStaticTemplates */ + InP->tport.name = tport; + InP->tport.disposition = 19; + InP->tport.type = MACH_MSG_PORT_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1002; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1002, "setupThread") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1002, "setupThread") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__setupThread_t__defined) + check_result = __MIG_check__Reply__setupThread_t((__Reply__setupThread_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__setupThread_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__authenticateDb_t__defined) +#define __MIG_check__Reply__authenticateDb_t__defined + +mig_internal kern_return_t __MIG_check__Reply__authenticateDb_t(__Reply__authenticateDb_t *Out0P) +{ + + typedef __Reply__authenticateDb_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1103) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__authenticateDb_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine authenticateDb */ +mig_external kern_return_t ucsp_client_authenticateDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + CSSM_DB_ACCESS_TYPE accessType, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + CSSM_DB_ACCESS_TYPE accessType; + mach_msg_type_number_t accessCredentialsCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__authenticateDb_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__authenticateDb_t__defined */ + + __DeclareSendRpc(1003, "authenticateDb") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->accessType = accessType; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1003; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1003, "authenticateDb") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1003, "authenticateDb") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__authenticateDb_t__defined) + check_result = __MIG_check__Reply__authenticateDb_t((__Reply__authenticateDb_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__authenticateDb_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__releaseDb_t__defined) +#define __MIG_check__Reply__releaseDb_t__defined + +mig_internal kern_return_t __MIG_check__Reply__releaseDb_t(__Reply__releaseDb_t *Out0P) +{ + + typedef __Reply__releaseDb_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1104) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__releaseDb_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine releaseDb */ +mig_external kern_return_t ucsp_client_releaseDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__releaseDb_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__releaseDb_t__defined */ + + __DeclareSendRpc(1004, "releaseDb") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1004; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1004, "releaseDb") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1004, "releaseDb") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__releaseDb_t__defined) + check_result = __MIG_check__Reply__releaseDb_t((__Reply__releaseDb_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__releaseDb_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getDbName_t__defined) +#define __MIG_check__Reply__getDbName_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getDbName_t(__Reply__getDbName_t *Out0P) +{ + + typedef __Reply__getDbName_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + + if (Out0P->Head.msgh_id != 1105) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size > (mach_msg_size_t)sizeof(__Reply) || msgh_size < (mach_msg_size_t)(sizeof(__Reply) - 1024)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if ( Out0P->nameCnt > 1024 ) + return MIG_TYPE_ERROR; + if (((msgh_size - (mach_msg_size_t)(sizeof(__Reply) - 1024))< Out0P->nameCnt) || + (msgh_size != (mach_msg_size_t)(sizeof(__Reply) - 1024) + _WALIGN_(Out0P->nameCnt))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getDbName_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getDbName */ +mig_external kern_return_t ucsp_client_getDbName +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + FilePathOut name +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_type_number_t nameOffset; /* MiG doesn't use it */ + mach_msg_type_number_t nameCnt; + char name[1024]; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_type_number_t nameOffset; /* MiG doesn't use it */ + mach_msg_type_number_t nameCnt; + char name[1024]; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getDbName_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getDbName_t__defined */ + + __DeclareSendRpc(1005, "getDbName") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1005; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1005, "getDbName") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1005, "getDbName") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getDbName_t__defined) + check_result = __MIG_check__Reply__getDbName_t((__Reply__getDbName_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getDbName_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + (void) mig_strncpy(name, Out0P->name, 1024); + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__setDbName_t__defined) +#define __MIG_check__Reply__setDbName_t__defined + +mig_internal kern_return_t __MIG_check__Reply__setDbName_t(__Reply__setDbName_t *Out0P) +{ + + typedef __Reply__setDbName_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1106) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__setDbName_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine setDbName */ +mig_external kern_return_t ucsp_client_setDbName +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + FilePath name +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t nameOffset; /* MiG doesn't use it */ + mach_msg_type_number_t nameCnt; + char name[1024]; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + unsigned int msgh_size; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__setDbName_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__setDbName_t__defined */ + + __DeclareSendRpc(1006, "setDbName") + + InP->NDR = NDR_record; + + InP->db = db; + +#ifdef USING_MIG_STRNCPY_ZEROFILL + if (mig_strncpy_zerofill != NULL) { + InP->nameCnt = mig_strncpy_zerofill(InP->name, name, 1024); + } else { +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + InP->nameCnt = mig_strncpy(InP->name, name, 1024); +#ifdef USING_MIG_STRNCPY_ZEROFILL + } +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + + msgh_size = (mach_msg_size_t)(sizeof(Request) - 1024) + (_WALIGN_(InP->nameCnt)); + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1006; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1006, "setDbName") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1006, "setDbName") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__setDbName_t__defined) + check_result = __MIG_check__Reply__setDbName_t((__Reply__setDbName_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__setDbName_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__openToken_t__defined) +#define __MIG_check__Reply__openToken_t__defined + +mig_internal kern_return_t __MIG_check__Reply__openToken_t(__Reply__openToken_t *Out0P) +{ + + typedef __Reply__openToken_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1107) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__openToken_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine openToken */ +mig_external kern_return_t ucsp_client_openToken +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + FilePath name, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + IPCDbHandle *db +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 ssid; + mach_msg_type_number_t nameOffset; /* MiG doesn't use it */ + mach_msg_type_number_t nameCnt; + char name[1024]; + mach_msg_type_number_t accessCredentialsCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + unsigned int msgh_size; + unsigned int msgh_size_delta; + + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__openToken_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__openToken_t__defined */ + + __DeclareSendRpc(1007, "openToken") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->ssid = ssid; + +#ifdef USING_MIG_STRNCPY_ZEROFILL + if (mig_strncpy_zerofill != NULL) { + InP->nameCnt = mig_strncpy_zerofill(InP->name, name, 1024); + } else { +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + InP->nameCnt = mig_strncpy(InP->name, name, 1024); +#ifdef USING_MIG_STRNCPY_ZEROFILL + } +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + + msgh_size_delta = _WALIGN_(InP->nameCnt); + msgh_size = (mach_msg_size_t)(sizeof(Request) - 1024) + msgh_size_delta; + InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024); + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP = &Mess.In; + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1007; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1007, "openToken") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1007, "openToken") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__openToken_t__defined) + check_result = __MIG_check__Reply__openToken_t((__Reply__openToken_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__openToken_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *db = Out0P->db; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__findFirst_t__defined) +#define __MIG_check__Reply__findFirst_t__defined + +mig_internal kern_return_t __MIG_check__Reply__findFirst_t(__Reply__findFirst_t *Out0P) +{ + + typedef __Reply__findFirst_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1108) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->outAttributes.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (Out0P->data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__findFirst_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine findFirst */ +mig_external kern_return_t ucsp_client_findFirst +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data query, + mach_msg_type_number_t queryCnt, + Data inAttributes, + mach_msg_type_number_t inAttributesCnt, + Data *outAttributes, + mach_msg_type_number_t *outAttributesCnt, + boolean_t getData, + Data *data, + mach_msg_type_number_t *dataCnt, + IPCKeyHandle *key, + IPCSearchHandle *search, + IPCRecordHandle *record +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t query; + mach_msg_ool_descriptor_t inAttributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t queryCnt; + mach_msg_type_number_t inAttributesCnt; + boolean_t getData; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + IPCSearchHandle search; + IPCRecordHandle record; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + IPCSearchHandle search; + IPCRecordHandle record; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__findFirst_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__findFirst_t__defined */ + + __DeclareSendRpc(1008, "findFirst") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t queryTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t inAttributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->query = queryTemplate; + InP->query.address = (void *)(query); + InP->query.size = queryCnt; +#else /* UseStaticTemplates */ + InP->query.address = (void *)(query); + InP->query.size = queryCnt; + InP->query.deallocate = FALSE; + InP->query.copy = MACH_MSG_VIRTUAL_COPY; + InP->query.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->inAttributes = inAttributesTemplate; + InP->inAttributes.address = (void *)(inAttributes); + InP->inAttributes.size = inAttributesCnt; +#else /* UseStaticTemplates */ + InP->inAttributes.address = (void *)(inAttributes); + InP->inAttributes.size = inAttributesCnt; + InP->inAttributes.deallocate = FALSE; + InP->inAttributes.copy = MACH_MSG_VIRTUAL_COPY; + InP->inAttributes.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->queryCnt = queryCnt; + + InP->inAttributesCnt = inAttributesCnt; + + InP->getData = getData; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1008; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1008, "findFirst") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1008, "findFirst") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__findFirst_t__defined) + check_result = __MIG_check__Reply__findFirst_t((__Reply__findFirst_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__findFirst_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *outAttributes = (Data)(Out0P->outAttributes.address); + *outAttributesCnt = Out0P->outAttributesCnt; + + *data = (Data)(Out0P->data.address); + *dataCnt = Out0P->dataCnt; + + *key = Out0P->key; + + *search = Out0P->search; + + *record = Out0P->record; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__findNext_t__defined) +#define __MIG_check__Reply__findNext_t__defined + +mig_internal kern_return_t __MIG_check__Reply__findNext_t(__Reply__findNext_t *Out0P) +{ + + typedef __Reply__findNext_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1109) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->outAttributes.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (Out0P->data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__findNext_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine findNext */ +mig_external kern_return_t ucsp_client_findNext +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCSearchHandle search, + Data inAttributes, + mach_msg_type_number_t inAttributesCnt, + Data *outAttributes, + mach_msg_type_number_t *outAttributesCnt, + boolean_t getData, + Data *data, + mach_msg_type_number_t *dataCnt, + IPCKeyHandle *key, + IPCRecordHandle *record +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t inAttributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCSearchHandle search; + mach_msg_type_number_t inAttributesCnt; + boolean_t getData; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + IPCRecordHandle record; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + IPCRecordHandle record; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__findNext_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__findNext_t__defined */ + + __DeclareSendRpc(1009, "findNext") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t inAttributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->inAttributes = inAttributesTemplate; + InP->inAttributes.address = (void *)(inAttributes); + InP->inAttributes.size = inAttributesCnt; +#else /* UseStaticTemplates */ + InP->inAttributes.address = (void *)(inAttributes); + InP->inAttributes.size = inAttributesCnt; + InP->inAttributes.deallocate = FALSE; + InP->inAttributes.copy = MACH_MSG_VIRTUAL_COPY; + InP->inAttributes.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->search = search; + + InP->inAttributesCnt = inAttributesCnt; + + InP->getData = getData; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1009; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1009, "findNext") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1009, "findNext") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__findNext_t__defined) + check_result = __MIG_check__Reply__findNext_t((__Reply__findNext_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__findNext_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *outAttributes = (Data)(Out0P->outAttributes.address); + *outAttributesCnt = Out0P->outAttributesCnt; + + *data = (Data)(Out0P->data.address); + *dataCnt = Out0P->dataCnt; + + *key = Out0P->key; + + *record = Out0P->record; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__findRecordHandle_t__defined) +#define __MIG_check__Reply__findRecordHandle_t__defined + +mig_internal kern_return_t __MIG_check__Reply__findRecordHandle_t(__Reply__findRecordHandle_t *Out0P) +{ + + typedef __Reply__findRecordHandle_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1110) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->outAttributes.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (Out0P->data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__findRecordHandle_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine findRecordHandle */ +mig_external kern_return_t ucsp_client_findRecordHandle +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCRecordHandle record, + Data inAttributes, + mach_msg_type_number_t inAttributesCnt, + Data *outAttributes, + mach_msg_type_number_t *outAttributesCnt, + boolean_t getData, + Data *data, + mach_msg_type_number_t *dataCnt, + IPCKeyHandle *key +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t inAttributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCRecordHandle record; + mach_msg_type_number_t inAttributesCnt; + boolean_t getData; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outAttributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outAttributesCnt; + mach_msg_type_number_t dataCnt; + IPCKeyHandle key; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__findRecordHandle_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__findRecordHandle_t__defined */ + + __DeclareSendRpc(1010, "findRecordHandle") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t inAttributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->inAttributes = inAttributesTemplate; + InP->inAttributes.address = (void *)(inAttributes); + InP->inAttributes.size = inAttributesCnt; +#else /* UseStaticTemplates */ + InP->inAttributes.address = (void *)(inAttributes); + InP->inAttributes.size = inAttributesCnt; + InP->inAttributes.deallocate = FALSE; + InP->inAttributes.copy = MACH_MSG_VIRTUAL_COPY; + InP->inAttributes.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->record = record; + + InP->inAttributesCnt = inAttributesCnt; + + InP->getData = getData; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1010; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1010, "findRecordHandle") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1010, "findRecordHandle") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__findRecordHandle_t__defined) + check_result = __MIG_check__Reply__findRecordHandle_t((__Reply__findRecordHandle_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__findRecordHandle_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *outAttributes = (Data)(Out0P->outAttributes.address); + *outAttributesCnt = Out0P->outAttributesCnt; + + *data = (Data)(Out0P->data.address); + *dataCnt = Out0P->dataCnt; + + *key = Out0P->key; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__insertRecord_t__defined) +#define __MIG_check__Reply__insertRecord_t__defined + +mig_internal kern_return_t __MIG_check__Reply__insertRecord_t(__Reply__insertRecord_t *Out0P) +{ + + typedef __Reply__insertRecord_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1111) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__insertRecord_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine insertRecord */ +mig_external kern_return_t ucsp_client_insertRecord +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + CSSM_DB_RECORDTYPE recordType, + Data attributes, + mach_msg_type_number_t attributesCnt, + Data data, + mach_msg_type_number_t dataCnt, + IPCRecordHandle *record +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + CSSM_DB_RECORDTYPE recordType; + mach_msg_type_number_t attributesCnt; + mach_msg_type_number_t dataCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCRecordHandle record; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCRecordHandle record; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__insertRecord_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__insertRecord_t__defined */ + + __DeclareSendRpc(1011, "insertRecord") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t attributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->attributes = attributesTemplate; + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; +#else /* UseStaticTemplates */ + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; + InP->attributes.deallocate = FALSE; + InP->attributes.copy = MACH_MSG_VIRTUAL_COPY; + InP->attributes.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->recordType = recordType; + + InP->attributesCnt = attributesCnt; + + InP->dataCnt = dataCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1011; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1011, "insertRecord") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1011, "insertRecord") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__insertRecord_t__defined) + check_result = __MIG_check__Reply__insertRecord_t((__Reply__insertRecord_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__insertRecord_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *record = Out0P->record; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__deleteRecord_t__defined) +#define __MIG_check__Reply__deleteRecord_t__defined + +mig_internal kern_return_t __MIG_check__Reply__deleteRecord_t(__Reply__deleteRecord_t *Out0P) +{ + + typedef __Reply__deleteRecord_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1112) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__deleteRecord_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine deleteRecord */ +mig_external kern_return_t ucsp_client_deleteRecord +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + IPCRecordHandle record +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + IPCRecordHandle record; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__deleteRecord_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__deleteRecord_t__defined */ + + __DeclareSendRpc(1012, "deleteRecord") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->record = record; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1012; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1012, "deleteRecord") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1012, "deleteRecord") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__deleteRecord_t__defined) + check_result = __MIG_check__Reply__deleteRecord_t((__Reply__deleteRecord_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__deleteRecord_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__modifyRecord_t__defined) +#define __MIG_check__Reply__modifyRecord_t__defined + +mig_internal kern_return_t __MIG_check__Reply__modifyRecord_t(__Reply__modifyRecord_t *Out0P) +{ + + typedef __Reply__modifyRecord_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1113) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__modifyRecord_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine modifyRecord */ +mig_external kern_return_t ucsp_client_modifyRecord +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + IPCRecordHandle *record, + CSSM_DB_RECORDTYPE recordType, + Data attributes, + mach_msg_type_number_t attributesCnt, + boolean_t setData, + Data data, + mach_msg_type_number_t dataCnt, + CSSM_DB_MODIFY_MODE modifyMode +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + IPCRecordHandle record; + CSSM_DB_RECORDTYPE recordType; + mach_msg_type_number_t attributesCnt; + boolean_t setData; + mach_msg_type_number_t dataCnt; + CSSM_DB_MODIFY_MODE modifyMode; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCRecordHandle record; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCRecordHandle record; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__modifyRecord_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__modifyRecord_t__defined */ + + __DeclareSendRpc(1013, "modifyRecord") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t attributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->attributes = attributesTemplate; + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; +#else /* UseStaticTemplates */ + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; + InP->attributes.deallocate = FALSE; + InP->attributes.copy = MACH_MSG_VIRTUAL_COPY; + InP->attributes.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->record = *record; + + InP->recordType = recordType; + + InP->attributesCnt = attributesCnt; + + InP->setData = setData; + + InP->dataCnt = dataCnt; + + InP->modifyMode = modifyMode; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1013; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1013, "modifyRecord") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1013, "modifyRecord") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__modifyRecord_t__defined) + check_result = __MIG_check__Reply__modifyRecord_t((__Reply__modifyRecord_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__modifyRecord_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *record = Out0P->record; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__releaseSearch_t__defined) +#define __MIG_check__Reply__releaseSearch_t__defined + +mig_internal kern_return_t __MIG_check__Reply__releaseSearch_t(__Reply__releaseSearch_t *Out0P) +{ + + typedef __Reply__releaseSearch_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1114) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__releaseSearch_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine releaseSearch */ +mig_external kern_return_t ucsp_client_releaseSearch +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCSearchHandle search +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCSearchHandle search; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__releaseSearch_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__releaseSearch_t__defined */ + + __DeclareSendRpc(1014, "releaseSearch") + + InP->NDR = NDR_record; + + InP->search = search; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1014; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1014, "releaseSearch") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1014, "releaseSearch") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__releaseSearch_t__defined) + check_result = __MIG_check__Reply__releaseSearch_t((__Reply__releaseSearch_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__releaseSearch_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__releaseRecord_t__defined) +#define __MIG_check__Reply__releaseRecord_t__defined + +mig_internal kern_return_t __MIG_check__Reply__releaseRecord_t(__Reply__releaseRecord_t *Out0P) +{ + + typedef __Reply__releaseRecord_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1115) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__releaseRecord_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine releaseRecord */ +mig_external kern_return_t ucsp_client_releaseRecord +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCRecordHandle record +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCRecordHandle record; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__releaseRecord_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__releaseRecord_t__defined */ + + __DeclareSendRpc(1015, "releaseRecord") + + InP->NDR = NDR_record; + + InP->record = record; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1015; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1015, "releaseRecord") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1015, "releaseRecord") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__releaseRecord_t__defined) + check_result = __MIG_check__Reply__releaseRecord_t((__Reply__releaseRecord_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__releaseRecord_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__createDb_t__defined) +#define __MIG_check__Reply__createDb_t__defined + +mig_internal kern_return_t __MIG_check__Reply__createDb_t(__Reply__createDb_t *Out0P) +{ + + typedef __Reply__createDb_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1116) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__createDb_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine createDb */ +mig_external kern_return_t ucsp_client_createDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle *db, + Data ident, + mach_msg_type_number_t identCnt, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + DBParameters params +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ident; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t identCnt; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + DBParameters params; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__createDb_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__createDb_t__defined */ + + __DeclareSendRpc(1016, "createDb") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t identTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t aclEntryPrototypeTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->ident = identTemplate; + InP->ident.address = (void *)(ident); + InP->ident.size = identCnt; +#else /* UseStaticTemplates */ + InP->ident.address = (void *)(ident); + InP->ident.size = identCnt; + InP->ident.deallocate = FALSE; + InP->ident.copy = MACH_MSG_VIRTUAL_COPY; + InP->ident.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->aclEntryPrototype = aclEntryPrototypeTemplate; + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; +#else /* UseStaticTemplates */ + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; + InP->aclEntryPrototype.deallocate = FALSE; + InP->aclEntryPrototype.copy = MACH_MSG_VIRTUAL_COPY; + InP->aclEntryPrototype.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->identCnt = identCnt; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->aclEntryPrototypeCnt = aclEntryPrototypeCnt; + + InP->params = params; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1016; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1016, "createDb") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1016, "createDb") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__createDb_t__defined) + check_result = __MIG_check__Reply__createDb_t((__Reply__createDb_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__createDb_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *db = Out0P->db; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__decodeDb_t__defined) +#define __MIG_check__Reply__decodeDb_t__defined + +mig_internal kern_return_t __MIG_check__Reply__decodeDb_t(__Reply__decodeDb_t *Out0P) +{ + + typedef __Reply__decodeDb_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1118) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__decodeDb_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine decodeDb */ +mig_external kern_return_t ucsp_client_decodeDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle *db, + Data ident, + mach_msg_type_number_t identCnt, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Pointer blob, + mach_msg_type_number_t blobCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ident; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t identCnt; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t blobCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle db; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__decodeDb_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__decodeDb_t__defined */ + + __DeclareSendRpc(1018, "decodeDb") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t identTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t blobTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->ident = identTemplate; + InP->ident.address = (void *)(ident); + InP->ident.size = identCnt; +#else /* UseStaticTemplates */ + InP->ident.address = (void *)(ident); + InP->ident.size = identCnt; + InP->ident.deallocate = FALSE; + InP->ident.copy = MACH_MSG_VIRTUAL_COPY; + InP->ident.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->blob = blobTemplate; + InP->blob.address = (void *)(blob); + InP->blob.size = blobCnt; +#else /* UseStaticTemplates */ + InP->blob.address = (void *)(blob); + InP->blob.size = blobCnt; + InP->blob.deallocate = FALSE; + InP->blob.copy = MACH_MSG_VIRTUAL_COPY; + InP->blob.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->identCnt = identCnt; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->blobCnt = blobCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1018; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1018, "decodeDb") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1018, "decodeDb") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__decodeDb_t__defined) + check_result = __MIG_check__Reply__decodeDb_t((__Reply__decodeDb_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__decodeDb_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *db = Out0P->db; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__encodeDb_t__defined) +#define __MIG_check__Reply__encodeDb_t__defined + +mig_internal kern_return_t __MIG_check__Reply__encodeDb_t(__Reply__encodeDb_t *Out0P) +{ + + typedef __Reply__encodeDb_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1119) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->blob.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__encodeDb_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine encodeDb */ +mig_external kern_return_t ucsp_client_encodeDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Pointer *blob, + mach_msg_type_number_t *blobCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__encodeDb_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__encodeDb_t__defined */ + + __DeclareSendRpc(1019, "encodeDb") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1019; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1019, "encodeDb") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1019, "encodeDb") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__encodeDb_t__defined) + check_result = __MIG_check__Reply__encodeDb_t((__Reply__encodeDb_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__encodeDb_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *blob = (Pointer)(Out0P->blob.address); + *blobCnt = Out0P->blobCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__setDbParameters_t__defined) +#define __MIG_check__Reply__setDbParameters_t__defined + +mig_internal kern_return_t __MIG_check__Reply__setDbParameters_t(__Reply__setDbParameters_t *Out0P) +{ + + typedef __Reply__setDbParameters_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1120) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__setDbParameters_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine setDbParameters */ +mig_external kern_return_t ucsp_client_setDbParameters +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + DBParameters params +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + DBParameters params; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__setDbParameters_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__setDbParameters_t__defined */ + + __DeclareSendRpc(1020, "setDbParameters") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->params = params; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1020; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1020, "setDbParameters") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1020, "setDbParameters") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__setDbParameters_t__defined) + check_result = __MIG_check__Reply__setDbParameters_t((__Reply__setDbParameters_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__setDbParameters_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getDbParameters_t__defined) +#define __MIG_check__Reply__getDbParameters_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getDbParameters_t(__Reply__getDbParameters_t *Out0P) +{ + + typedef __Reply__getDbParameters_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1121) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getDbParameters_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getDbParameters */ +mig_external kern_return_t ucsp_client_getDbParameters +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + DBParameters *params +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + DBParameters params; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + DBParameters params; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getDbParameters_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getDbParameters_t__defined */ + + __DeclareSendRpc(1021, "getDbParameters") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1021; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1021, "getDbParameters") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1021, "getDbParameters") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getDbParameters_t__defined) + check_result = __MIG_check__Reply__getDbParameters_t((__Reply__getDbParameters_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getDbParameters_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *params = Out0P->params; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__changePassphrase_t__defined) +#define __MIG_check__Reply__changePassphrase_t__defined + +mig_internal kern_return_t __MIG_check__Reply__changePassphrase_t(__Reply__changePassphrase_t *Out0P) +{ + + typedef __Reply__changePassphrase_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1122) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__changePassphrase_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine changePassphrase */ +mig_external kern_return_t ucsp_client_changePassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t accessCredentialsCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__changePassphrase_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__changePassphrase_t__defined */ + + __DeclareSendRpc(1022, "changePassphrase") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1022; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1022, "changePassphrase") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1022, "changePassphrase") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__changePassphrase_t__defined) + check_result = __MIG_check__Reply__changePassphrase_t((__Reply__changePassphrase_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__changePassphrase_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__lockAll_t__defined) +#define __MIG_check__Reply__lockAll_t__defined + +mig_internal kern_return_t __MIG_check__Reply__lockAll_t(__Reply__lockAll_t *Out0P) +{ + + typedef __Reply__lockAll_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1123) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__lockAll_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine lockAll */ +mig_external kern_return_t ucsp_client_lockAll +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + boolean_t forSleep +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + boolean_t forSleep; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__lockAll_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__lockAll_t__defined */ + + __DeclareSendRpc(1023, "lockAll") + + InP->NDR = NDR_record; + + InP->forSleep = forSleep; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1023; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1023, "lockAll") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1023, "lockAll") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__lockAll_t__defined) + check_result = __MIG_check__Reply__lockAll_t((__Reply__lockAll_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__lockAll_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__unlockDb_t__defined) +#define __MIG_check__Reply__unlockDb_t__defined + +mig_internal kern_return_t __MIG_check__Reply__unlockDb_t(__Reply__unlockDb_t *Out0P) +{ + + typedef __Reply__unlockDb_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1124) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__unlockDb_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine unlockDb */ +mig_external kern_return_t ucsp_client_unlockDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__unlockDb_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__unlockDb_t__defined */ + + __DeclareSendRpc(1024, "unlockDb") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1024; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1024, "unlockDb") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1024, "unlockDb") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__unlockDb_t__defined) + check_result = __MIG_check__Reply__unlockDb_t((__Reply__unlockDb_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__unlockDb_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__unlockDbWithPassphrase_t__defined) +#define __MIG_check__Reply__unlockDbWithPassphrase_t__defined + +mig_internal kern_return_t __MIG_check__Reply__unlockDbWithPassphrase_t(__Reply__unlockDbWithPassphrase_t *Out0P) +{ + + typedef __Reply__unlockDbWithPassphrase_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1125) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__unlockDbWithPassphrase_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine unlockDbWithPassphrase */ +mig_external kern_return_t ucsp_client_unlockDbWithPassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data passPhrase, + mach_msg_type_number_t passPhraseCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t passPhrase; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t passPhraseCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__unlockDbWithPassphrase_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__unlockDbWithPassphrase_t__defined */ + + __DeclareSendRpc(1025, "unlockDbWithPassphrase") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t passPhraseTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->passPhrase = passPhraseTemplate; + InP->passPhrase.address = (void *)(passPhrase); + InP->passPhrase.size = passPhraseCnt; +#else /* UseStaticTemplates */ + InP->passPhrase.address = (void *)(passPhrase); + InP->passPhrase.size = passPhraseCnt; + InP->passPhrase.deallocate = FALSE; + InP->passPhrase.copy = MACH_MSG_VIRTUAL_COPY; + InP->passPhrase.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->passPhraseCnt = passPhraseCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1025; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1025, "unlockDbWithPassphrase") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1025, "unlockDbWithPassphrase") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__unlockDbWithPassphrase_t__defined) + check_result = __MIG_check__Reply__unlockDbWithPassphrase_t((__Reply__unlockDbWithPassphrase_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__unlockDbWithPassphrase_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__isLocked_t__defined) +#define __MIG_check__Reply__isLocked_t__defined + +mig_internal kern_return_t __MIG_check__Reply__isLocked_t(__Reply__isLocked_t *Out0P) +{ + + typedef __Reply__isLocked_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1126) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__isLocked_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine isLocked */ +mig_external kern_return_t ucsp_client_isLocked +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + boolean_t *locked +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + boolean_t locked; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + boolean_t locked; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__isLocked_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__isLocked_t__defined */ + + __DeclareSendRpc(1026, "isLocked") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1026; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1026, "isLocked") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1026, "isLocked") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__isLocked_t__defined) + check_result = __MIG_check__Reply__isLocked_t((__Reply__isLocked_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__isLocked_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *locked = Out0P->locked; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__encodeKey_t__defined) +#define __MIG_check__Reply__encodeKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__encodeKey_t(__Reply__encodeKey_t *Out0P) +{ + + typedef __Reply__encodeKey_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1127) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->blob.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (Out0P->uid.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__encodeKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine encodeKey */ +mig_external kern_return_t ucsp_client_encodeKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle key, + Pointer *blob, + mach_msg_type_number_t *blobCnt, + boolean_t wantUid, + Data *uid, + mach_msg_type_number_t *uidCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCKeyHandle key; + boolean_t wantUid; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + mach_msg_ool_descriptor_t uid; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + mach_msg_type_number_t uidCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + mach_msg_ool_descriptor_t uid; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + mach_msg_type_number_t uidCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__encodeKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__encodeKey_t__defined */ + + __DeclareSendRpc(1027, "encodeKey") + + InP->NDR = NDR_record; + + InP->key = key; + + InP->wantUid = wantUid; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1027; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1027, "encodeKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1027, "encodeKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__encodeKey_t__defined) + check_result = __MIG_check__Reply__encodeKey_t((__Reply__encodeKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__encodeKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *blob = (Pointer)(Out0P->blob.address); + *blobCnt = Out0P->blobCnt; + + *uid = (Data)(Out0P->uid.address); + *uidCnt = Out0P->uidCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__decodeKey_t__defined) +#define __MIG_check__Reply__decodeKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__decodeKey_t(__Reply__decodeKey_t *Out0P) +{ + + typedef __Reply__decodeKey_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1128) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->header.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__decodeKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine decodeKey */ +mig_external kern_return_t ucsp_client_decodeKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle *key, + Data *header, + mach_msg_type_number_t *headerCnt, + IPCDbHandle db, + Pointer blob, + mach_msg_type_number_t blobCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t blobCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__decodeKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__decodeKey_t__defined */ + + __DeclareSendRpc(1028, "decodeKey") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t blobTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->blob = blobTemplate; + InP->blob.address = (void *)(blob); + InP->blob.size = blobCnt; +#else /* UseStaticTemplates */ + InP->blob.address = (void *)(blob); + InP->blob.size = blobCnt; + InP->blob.deallocate = FALSE; + InP->blob.copy = MACH_MSG_VIRTUAL_COPY; + InP->blob.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->blobCnt = blobCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1028; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1028, "decodeKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1028, "decodeKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__decodeKey_t__defined) + check_result = __MIG_check__Reply__decodeKey_t((__Reply__decodeKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__decodeKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *key = Out0P->key; + + *header = (Data)(Out0P->header.address); + *headerCnt = Out0P->headerCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__recodeKey_t__defined) +#define __MIG_check__Reply__recodeKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__recodeKey_t(__Reply__recodeKey_t *Out0P) +{ + + typedef __Reply__recodeKey_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1129) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->newBlob.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__recodeKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine recodeKey */ +mig_external kern_return_t ucsp_client_recodeKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle oldDb, + IPCKeyHandle key, + IPCDbHandle newDb, + Pointer *newBlob, + mach_msg_type_number_t *newBlobCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle oldDb; + IPCKeyHandle key; + IPCDbHandle newDb; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t newBlob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t newBlobCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t newBlob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t newBlobCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__recodeKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__recodeKey_t__defined */ + + __DeclareSendRpc(1029, "recodeKey") + + InP->NDR = NDR_record; + + InP->oldDb = oldDb; + + InP->key = key; + + InP->newDb = newDb; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1029; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1029, "recodeKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1029, "recodeKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__recodeKey_t__defined) + check_result = __MIG_check__Reply__recodeKey_t((__Reply__recodeKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__recodeKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *newBlob = (Pointer)(Out0P->newBlob.address); + *newBlobCnt = Out0P->newBlobCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__releaseKey_t__defined) +#define __MIG_check__Reply__releaseKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__releaseKey_t(__Reply__releaseKey_t *Out0P) +{ + + typedef __Reply__releaseKey_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1130) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__releaseKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine releaseKey */ +mig_external kern_return_t ucsp_client_releaseKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle key +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCKeyHandle key; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__releaseKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__releaseKey_t__defined */ + + __DeclareSendRpc(1030, "releaseKey") + + InP->NDR = NDR_record; + + InP->key = key; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1030; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1030, "releaseKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1030, "releaseKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__releaseKey_t__defined) + check_result = __MIG_check__Reply__releaseKey_t((__Reply__releaseKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__releaseKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__queryKeySizeInBits_t__defined) +#define __MIG_check__Reply__queryKeySizeInBits_t__defined + +mig_internal kern_return_t __MIG_check__Reply__queryKeySizeInBits_t(__Reply__queryKeySizeInBits_t *Out0P) +{ + + typedef __Reply__queryKeySizeInBits_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1131) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__queryKeySizeInBits_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine queryKeySizeInBits */ +mig_external kern_return_t ucsp_client_queryKeySizeInBits +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle key, + CSSM_KEY_SIZE *length +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCKeyHandle key; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + CSSM_KEY_SIZE length; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + CSSM_KEY_SIZE length; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__queryKeySizeInBits_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__queryKeySizeInBits_t__defined */ + + __DeclareSendRpc(1031, "queryKeySizeInBits") + + InP->NDR = NDR_record; + + InP->key = key; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1031; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1031, "queryKeySizeInBits") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1031, "queryKeySizeInBits") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__queryKeySizeInBits_t__defined) + check_result = __MIG_check__Reply__queryKeySizeInBits_t((__Reply__queryKeySizeInBits_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__queryKeySizeInBits_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *length = Out0P->length; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getOutputSize_t__defined) +#define __MIG_check__Reply__getOutputSize_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getOutputSize_t(__Reply__getOutputSize_t *Out0P) +{ + + typedef __Reply__getOutputSize_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1132) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getOutputSize_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getOutputSize */ +mig_external kern_return_t ucsp_client_getOutputSize +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + uint32 inputSize, + boolean_t encrypt, + uint32 *outputSize +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + uint32 inputSize; + boolean_t encrypt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + uint32 outputSize; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + uint32 outputSize; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getOutputSize_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getOutputSize_t__defined */ + + __DeclareSendRpc(1032, "getOutputSize") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->inputSize = inputSize; + + InP->encrypt = encrypt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1032; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1032, "getOutputSize") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1032, "getOutputSize") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getOutputSize_t__defined) + check_result = __MIG_check__Reply__getOutputSize_t((__Reply__getOutputSize_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getOutputSize_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *outputSize = Out0P->outputSize; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getKeyDigest_t__defined) +#define __MIG_check__Reply__getKeyDigest_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getKeyDigest_t(__Reply__getKeyDigest_t *Out0P) +{ + + typedef __Reply__getKeyDigest_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1133) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->digest.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getKeyDigest_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getKeyDigest */ +mig_external kern_return_t ucsp_client_getKeyDigest +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCKeyHandle key, + Data *digest, + mach_msg_type_number_t *digestCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCKeyHandle key; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t digest; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t digestCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t digest; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t digestCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getKeyDigest_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getKeyDigest_t__defined */ + + __DeclareSendRpc(1033, "getKeyDigest") + + InP->NDR = NDR_record; + + InP->key = key; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1033; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1033, "getKeyDigest") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1033, "getKeyDigest") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getKeyDigest_t__defined) + check_result = __MIG_check__Reply__getKeyDigest_t((__Reply__getKeyDigest_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getKeyDigest_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *digest = (Data)(Out0P->digest.address); + *digestCnt = Out0P->digestCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__generateSignature_t__defined) +#define __MIG_check__Reply__generateSignature_t__defined + +mig_internal kern_return_t __MIG_check__Reply__generateSignature_t(__Reply__generateSignature_t *Out0P) +{ + + typedef __Reply__generateSignature_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1134) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->signature.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__generateSignature_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine generateSignature */ +mig_external kern_return_t ucsp_client_generateSignature +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + CSSM_ALGORITHMS signOnlyAlgorithm, + Data data, + mach_msg_type_number_t dataCnt, + Data *signature, + mach_msg_type_number_t *signatureCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + CSSM_ALGORITHMS signOnlyAlgorithm; + mach_msg_type_number_t dataCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t signatureCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t signatureCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__generateSignature_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__generateSignature_t__defined */ + + __DeclareSendRpc(1034, "generateSignature") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->signOnlyAlgorithm = signOnlyAlgorithm; + + InP->dataCnt = dataCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1034; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1034, "generateSignature") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1034, "generateSignature") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__generateSignature_t__defined) + check_result = __MIG_check__Reply__generateSignature_t((__Reply__generateSignature_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__generateSignature_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *signature = (Data)(Out0P->signature.address); + *signatureCnt = Out0P->signatureCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__verifySignature_t__defined) +#define __MIG_check__Reply__verifySignature_t__defined + +mig_internal kern_return_t __MIG_check__Reply__verifySignature_t(__Reply__verifySignature_t *Out0P) +{ + + typedef __Reply__verifySignature_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1135) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__verifySignature_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine verifySignature */ +mig_external kern_return_t ucsp_client_verifySignature +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + CSSM_ALGORITHMS signOnlyAlgorithm, + Data data, + mach_msg_type_number_t dataCnt, + Data signature, + mach_msg_type_number_t signatureCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t data; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + CSSM_ALGORITHMS signOnlyAlgorithm; + mach_msg_type_number_t dataCnt; + mach_msg_type_number_t signatureCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__verifySignature_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__verifySignature_t__defined */ + + __DeclareSendRpc(1035, "verifySignature") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t signatureTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->signature = signatureTemplate; + InP->signature.address = (void *)(signature); + InP->signature.size = signatureCnt; +#else /* UseStaticTemplates */ + InP->signature.address = (void *)(signature); + InP->signature.size = signatureCnt; + InP->signature.deallocate = FALSE; + InP->signature.copy = MACH_MSG_VIRTUAL_COPY; + InP->signature.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->signOnlyAlgorithm = signOnlyAlgorithm; + + InP->dataCnt = dataCnt; + + InP->signatureCnt = signatureCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1035; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1035, "verifySignature") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1035, "verifySignature") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__verifySignature_t__defined) + check_result = __MIG_check__Reply__verifySignature_t((__Reply__verifySignature_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__verifySignature_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__generateMac_t__defined) +#define __MIG_check__Reply__generateMac_t__defined + +mig_internal kern_return_t __MIG_check__Reply__generateMac_t(__Reply__generateMac_t *Out0P) +{ + + typedef __Reply__generateMac_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1136) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->signature.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__generateMac_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine generateMac */ +mig_external kern_return_t ucsp_client_generateMac +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data data, + mach_msg_type_number_t dataCnt, + Data *signature, + mach_msg_type_number_t *signatureCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t dataCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t signatureCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t signatureCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__generateMac_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__generateMac_t__defined */ + + __DeclareSendRpc(1036, "generateMac") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->dataCnt = dataCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1036; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1036, "generateMac") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1036, "generateMac") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__generateMac_t__defined) + check_result = __MIG_check__Reply__generateMac_t((__Reply__generateMac_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__generateMac_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *signature = (Data)(Out0P->signature.address); + *signatureCnt = Out0P->signatureCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__verifyMac_t__defined) +#define __MIG_check__Reply__verifyMac_t__defined + +mig_internal kern_return_t __MIG_check__Reply__verifyMac_t(__Reply__verifyMac_t *Out0P) +{ + + typedef __Reply__verifyMac_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1137) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__verifyMac_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine verifyMac */ +mig_external kern_return_t ucsp_client_verifyMac +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data data, + mach_msg_type_number_t dataCnt, + Data signature, + mach_msg_type_number_t signatureCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t data; + mach_msg_ool_descriptor_t signature; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t dataCnt; + mach_msg_type_number_t signatureCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__verifyMac_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__verifyMac_t__defined */ + + __DeclareSendRpc(1037, "verifyMac") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t signatureTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->signature = signatureTemplate; + InP->signature.address = (void *)(signature); + InP->signature.size = signatureCnt; +#else /* UseStaticTemplates */ + InP->signature.address = (void *)(signature); + InP->signature.size = signatureCnt; + InP->signature.deallocate = FALSE; + InP->signature.copy = MACH_MSG_VIRTUAL_COPY; + InP->signature.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->dataCnt = dataCnt; + + InP->signatureCnt = signatureCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1037; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1037, "verifyMac") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1037, "verifyMac") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__verifyMac_t__defined) + check_result = __MIG_check__Reply__verifyMac_t((__Reply__verifyMac_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__verifyMac_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__encrypt_t__defined) +#define __MIG_check__Reply__encrypt_t__defined + +mig_internal kern_return_t __MIG_check__Reply__encrypt_t(__Reply__encrypt_t *Out0P) +{ + + typedef __Reply__encrypt_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1138) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->cipher.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__encrypt_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine encrypt */ +mig_external kern_return_t ucsp_client_encrypt +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data clear, + mach_msg_type_number_t clearCnt, + Data *cipher, + mach_msg_type_number_t *cipherCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t clear; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t clearCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cipher; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t cipherCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t cipher; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t cipherCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__encrypt_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__encrypt_t__defined */ + + __DeclareSendRpc(1038, "encrypt") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t clearTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->clear = clearTemplate; + InP->clear.address = (void *)(clear); + InP->clear.size = clearCnt; +#else /* UseStaticTemplates */ + InP->clear.address = (void *)(clear); + InP->clear.size = clearCnt; + InP->clear.deallocate = FALSE; + InP->clear.copy = MACH_MSG_VIRTUAL_COPY; + InP->clear.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->clearCnt = clearCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1038; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1038, "encrypt") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1038, "encrypt") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__encrypt_t__defined) + check_result = __MIG_check__Reply__encrypt_t((__Reply__encrypt_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__encrypt_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *cipher = (Data)(Out0P->cipher.address); + *cipherCnt = Out0P->cipherCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__decrypt_t__defined) +#define __MIG_check__Reply__decrypt_t__defined + +mig_internal kern_return_t __MIG_check__Reply__decrypt_t(__Reply__decrypt_t *Out0P) +{ + + typedef __Reply__decrypt_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1139) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->clear.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__decrypt_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine decrypt */ +mig_external kern_return_t ucsp_client_decrypt +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data cipher, + mach_msg_type_number_t cipherCnt, + Data *clear, + mach_msg_type_number_t *clearCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t cipher; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t cipherCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t clear; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t clearCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t clear; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t clearCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__decrypt_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__decrypt_t__defined */ + + __DeclareSendRpc(1039, "decrypt") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t cipherTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->cipher = cipherTemplate; + InP->cipher.address = (void *)(cipher); + InP->cipher.size = cipherCnt; +#else /* UseStaticTemplates */ + InP->cipher.address = (void *)(cipher); + InP->cipher.size = cipherCnt; + InP->cipher.deallocate = FALSE; + InP->cipher.copy = MACH_MSG_VIRTUAL_COPY; + InP->cipher.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->cipherCnt = cipherCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1039; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1039, "decrypt") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1039, "decrypt") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__decrypt_t__defined) + check_result = __MIG_check__Reply__decrypt_t((__Reply__decrypt_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__decrypt_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *clear = (Data)(Out0P->clear.address); + *clearCnt = Out0P->clearCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__generateKey_t__defined) +#define __MIG_check__Reply__generateKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__generateKey_t(__Reply__generateKey_t *Out0P) +{ + + typedef __Reply__generateKey_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1140) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->header.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__generateKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine generateKey */ +mig_external kern_return_t ucsp_client_generateKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + uint32 keyUsage, + uint32 keyAttrs, + IPCKeyHandle *key, + Data *header, + mach_msg_type_number_t *headerCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + uint32 keyUsage; + uint32 keyAttrs; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__generateKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__generateKey_t__defined */ + + __DeclareSendRpc(1040, "generateKey") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t aclEntryPrototypeTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->aclEntryPrototype = aclEntryPrototypeTemplate; + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; +#else /* UseStaticTemplates */ + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; + InP->aclEntryPrototype.deallocate = FALSE; + InP->aclEntryPrototype.copy = MACH_MSG_VIRTUAL_COPY; + InP->aclEntryPrototype.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->contextCnt = contextCnt; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->aclEntryPrototypeCnt = aclEntryPrototypeCnt; + + InP->keyUsage = keyUsage; + + InP->keyAttrs = keyAttrs; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1040; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1040, "generateKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1040, "generateKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__generateKey_t__defined) + check_result = __MIG_check__Reply__generateKey_t((__Reply__generateKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__generateKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *key = Out0P->key; + + *header = (Data)(Out0P->header.address); + *headerCnt = Out0P->headerCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__generateKeyPair_t__defined) +#define __MIG_check__Reply__generateKeyPair_t__defined + +mig_internal kern_return_t __MIG_check__Reply__generateKeyPair_t(__Reply__generateKeyPair_t *Out0P) +{ + + typedef __Reply__generateKeyPair_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1141) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->pubHeader.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (Out0P->privHeader.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__generateKeyPair_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine generateKeyPair */ +mig_external kern_return_t ucsp_client_generateKeyPair +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + uint32 pubUsage, + uint32 pubAttrs, + uint32 privUsage, + uint32 privAttrs, + IPCKeyHandle *pubKey, + Data *pubHeader, + mach_msg_type_number_t *pubHeaderCnt, + IPCKeyHandle *privKey, + Data *privHeader, + mach_msg_type_number_t *privHeaderCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + uint32 pubUsage; + uint32 pubAttrs; + uint32 privUsage; + uint32 privAttrs; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t pubHeader; + mach_msg_ool_descriptor_t privHeader; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle pubKey; + mach_msg_type_number_t pubHeaderCnt; + IPCKeyHandle privKey; + mach_msg_type_number_t privHeaderCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t pubHeader; + mach_msg_ool_descriptor_t privHeader; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle pubKey; + mach_msg_type_number_t pubHeaderCnt; + IPCKeyHandle privKey; + mach_msg_type_number_t privHeaderCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__generateKeyPair_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__generateKeyPair_t__defined */ + + __DeclareSendRpc(1041, "generateKeyPair") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t aclEntryPrototypeTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->aclEntryPrototype = aclEntryPrototypeTemplate; + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; +#else /* UseStaticTemplates */ + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; + InP->aclEntryPrototype.deallocate = FALSE; + InP->aclEntryPrototype.copy = MACH_MSG_VIRTUAL_COPY; + InP->aclEntryPrototype.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->contextCnt = contextCnt; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->aclEntryPrototypeCnt = aclEntryPrototypeCnt; + + InP->pubUsage = pubUsage; + + InP->pubAttrs = pubAttrs; + + InP->privUsage = privUsage; + + InP->privAttrs = privAttrs; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1041; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1041, "generateKeyPair") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1041, "generateKeyPair") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__generateKeyPair_t__defined) + check_result = __MIG_check__Reply__generateKeyPair_t((__Reply__generateKeyPair_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__generateKeyPair_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *pubKey = Out0P->pubKey; + + *pubHeader = (Data)(Out0P->pubHeader.address); + *pubHeaderCnt = Out0P->pubHeaderCnt; + + *privKey = Out0P->privKey; + + *privHeader = (Data)(Out0P->privHeader.address); + *privHeaderCnt = Out0P->privHeaderCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__wrapKey_t__defined) +#define __MIG_check__Reply__wrapKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__wrapKey_t(__Reply__wrapKey_t *Out0P) +{ + + typedef __Reply__wrapKey_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1142) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->wrappedKey.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__wrapKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine wrapKey */ +mig_external kern_return_t ucsp_client_wrapKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + IPCKeyHandle keyToBeWrapped, + Data descriptiveData, + mach_msg_type_number_t descriptiveDataCnt, + Data *wrappedKey, + mach_msg_type_number_t *wrappedKeyCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t descriptiveData; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t accessCredentialsCnt; + IPCKeyHandle keyToBeWrapped; + mach_msg_type_number_t descriptiveDataCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t wrappedKey; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t wrappedKeyCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t wrappedKey; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t wrappedKeyCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__wrapKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__wrapKey_t__defined */ + + __DeclareSendRpc(1042, "wrapKey") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t descriptiveDataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->descriptiveData = descriptiveDataTemplate; + InP->descriptiveData.address = (void *)(descriptiveData); + InP->descriptiveData.size = descriptiveDataCnt; +#else /* UseStaticTemplates */ + InP->descriptiveData.address = (void *)(descriptiveData); + InP->descriptiveData.size = descriptiveDataCnt; + InP->descriptiveData.deallocate = FALSE; + InP->descriptiveData.copy = MACH_MSG_VIRTUAL_COPY; + InP->descriptiveData.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->keyToBeWrapped = keyToBeWrapped; + + InP->descriptiveDataCnt = descriptiveDataCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1042; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1042, "wrapKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1042, "wrapKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__wrapKey_t__defined) + check_result = __MIG_check__Reply__wrapKey_t((__Reply__wrapKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__wrapKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *wrappedKey = (Data)(Out0P->wrappedKey.address); + *wrappedKeyCnt = Out0P->wrappedKeyCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__unwrapKey_t__defined) +#define __MIG_check__Reply__unwrapKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__unwrapKey_t(__Reply__unwrapKey_t *Out0P) +{ + + typedef __Reply__unwrapKey_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1143) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (Out0P->header.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__unwrapKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine unwrapKey */ +mig_external kern_return_t ucsp_client_unwrapKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle key, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + IPCKeyHandle publicKey, + Data wrappedKey, + mach_msg_type_number_t wrappedKeyCnt, + uint32 usage, + uint32 attributes, + Data *data, + mach_msg_type_number_t *dataCnt, + IPCKeyHandle *resultKey, + Data *header, + mach_msg_type_number_t *headerCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + mach_msg_ool_descriptor_t wrappedKey; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + IPCKeyHandle key; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + IPCKeyHandle publicKey; + mach_msg_type_number_t wrappedKeyCnt; + uint32 usage; + uint32 attributes; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + IPCKeyHandle resultKey; + mach_msg_type_number_t headerCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + IPCKeyHandle resultKey; + mach_msg_type_number_t headerCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__unwrapKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__unwrapKey_t__defined */ + + __DeclareSendRpc(1043, "unwrapKey") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t aclEntryPrototypeTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t wrappedKeyTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 4; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->aclEntryPrototype = aclEntryPrototypeTemplate; + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; +#else /* UseStaticTemplates */ + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; + InP->aclEntryPrototype.deallocate = FALSE; + InP->aclEntryPrototype.copy = MACH_MSG_VIRTUAL_COPY; + InP->aclEntryPrototype.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->wrappedKey = wrappedKeyTemplate; + InP->wrappedKey.address = (void *)(wrappedKey); + InP->wrappedKey.size = wrappedKeyCnt; +#else /* UseStaticTemplates */ + InP->wrappedKey.address = (void *)(wrappedKey); + InP->wrappedKey.size = wrappedKeyCnt; + InP->wrappedKey.deallocate = FALSE; + InP->wrappedKey.copy = MACH_MSG_VIRTUAL_COPY; + InP->wrappedKey.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->contextCnt = contextCnt; + + InP->key = key; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->aclEntryPrototypeCnt = aclEntryPrototypeCnt; + + InP->publicKey = publicKey; + + InP->wrappedKeyCnt = wrappedKeyCnt; + + InP->usage = usage; + + InP->attributes = attributes; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1043; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1043, "unwrapKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1043, "unwrapKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__unwrapKey_t__defined) + check_result = __MIG_check__Reply__unwrapKey_t((__Reply__unwrapKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__unwrapKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *data = (Data)(Out0P->data.address); + *dataCnt = Out0P->dataCnt; + + *resultKey = Out0P->resultKey; + + *header = (Data)(Out0P->header.address); + *headerCnt = Out0P->headerCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__deriveKey_t__defined) +#define __MIG_check__Reply__deriveKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__deriveKey_t(__Reply__deriveKey_t *Out0P) +{ + + typedef __Reply__deriveKey_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1144) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 2 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->paramOutput.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + +#if __MigTypeCheck + if (Out0P->header.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__deriveKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine deriveKey */ +mig_external kern_return_t ucsp_client_deriveKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle baseKey, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + Data paramInput, + mach_msg_type_number_t paramInputCnt, + Data *paramOutput, + mach_msg_type_number_t *paramOutputCnt, + uint32 keyUsage, + uint32 keyAttrs, + IPCKeyHandle *key, + Data *header, + mach_msg_type_number_t *headerCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + mach_msg_ool_descriptor_t paramInput; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + IPCKeyHandle baseKey; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + mach_msg_type_number_t paramInputCnt; + uint32 keyUsage; + uint32 keyAttrs; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t paramOutput; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t paramOutputCnt; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t paramOutput; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t paramOutputCnt; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__deriveKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__deriveKey_t__defined */ + + __DeclareSendRpc(1044, "deriveKey") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t aclEntryPrototypeTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t paramInputTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 4; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->aclEntryPrototype = aclEntryPrototypeTemplate; + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; +#else /* UseStaticTemplates */ + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; + InP->aclEntryPrototype.deallocate = FALSE; + InP->aclEntryPrototype.copy = MACH_MSG_VIRTUAL_COPY; + InP->aclEntryPrototype.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->paramInput = paramInputTemplate; + InP->paramInput.address = (void *)(paramInput); + InP->paramInput.size = paramInputCnt; +#else /* UseStaticTemplates */ + InP->paramInput.address = (void *)(paramInput); + InP->paramInput.size = paramInputCnt; + InP->paramInput.deallocate = FALSE; + InP->paramInput.copy = MACH_MSG_VIRTUAL_COPY; + InP->paramInput.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->contextCnt = contextCnt; + + InP->baseKey = baseKey; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->aclEntryPrototypeCnt = aclEntryPrototypeCnt; + + InP->paramInputCnt = paramInputCnt; + + InP->keyUsage = keyUsage; + + InP->keyAttrs = keyAttrs; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1044; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1044, "deriveKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1044, "deriveKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__deriveKey_t__defined) + check_result = __MIG_check__Reply__deriveKey_t((__Reply__deriveKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__deriveKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *paramOutput = (Data)(Out0P->paramOutput.address); + *paramOutputCnt = Out0P->paramOutputCnt; + + *key = Out0P->key; + + *header = (Data)(Out0P->header.address); + *headerCnt = Out0P->headerCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__generateRandom_t__defined) +#define __MIG_check__Reply__generateRandom_t__defined + +mig_internal kern_return_t __MIG_check__Reply__generateRandom_t(__Reply__generateRandom_t *Out0P) +{ + + typedef __Reply__generateRandom_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1145) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__generateRandom_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine generateRandom */ +mig_external kern_return_t ucsp_client_generateRandom +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + Data context, + mach_msg_type_number_t contextCnt, + Data *data, + mach_msg_type_number_t *dataCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 ssid; + mach_msg_type_number_t contextCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__generateRandom_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__generateRandom_t__defined */ + + __DeclareSendRpc(1045, "generateRandom") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->ssid = ssid; + + InP->contextCnt = contextCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1045; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1045, "generateRandom") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1045, "generateRandom") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__generateRandom_t__defined) + check_result = __MIG_check__Reply__generateRandom_t((__Reply__generateRandom_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__generateRandom_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *data = (Data)(Out0P->data.address); + *dataCnt = Out0P->dataCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getOwner_t__defined) +#define __MIG_check__Reply__getOwner_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getOwner_t(__Reply__getOwner_t *Out0P) +{ + + typedef __Reply__getOwner_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1146) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->proto.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getOwner_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getOwner */ +mig_external kern_return_t ucsp_client_getOwner +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + AclKind kind, + IPCGenericHandle key, + Data *proto, + mach_msg_type_number_t *protoCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + AclKind kind; + IPCGenericHandle key; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t proto; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t protoCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t proto; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t protoCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getOwner_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getOwner_t__defined */ + + __DeclareSendRpc(1046, "getOwner") + + InP->NDR = NDR_record; + + InP->kind = kind; + + InP->key = key; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1046; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1046, "getOwner") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1046, "getOwner") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getOwner_t__defined) + check_result = __MIG_check__Reply__getOwner_t((__Reply__getOwner_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getOwner_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *proto = (Data)(Out0P->proto.address); + *protoCnt = Out0P->protoCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__setOwner_t__defined) +#define __MIG_check__Reply__setOwner_t__defined + +mig_internal kern_return_t __MIG_check__Reply__setOwner_t(__Reply__setOwner_t *Out0P) +{ + + typedef __Reply__setOwner_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1147) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__setOwner_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine setOwner */ +mig_external kern_return_t ucsp_client_setOwner +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + AclKind kind, + IPCGenericHandle key, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclOwnerPrototype, + mach_msg_type_number_t aclOwnerPrototypeCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclOwnerPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + AclKind kind; + IPCGenericHandle key; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclOwnerPrototypeCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__setOwner_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__setOwner_t__defined */ + + __DeclareSendRpc(1047, "setOwner") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t aclOwnerPrototypeTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->aclOwnerPrototype = aclOwnerPrototypeTemplate; + InP->aclOwnerPrototype.address = (void *)(aclOwnerPrototype); + InP->aclOwnerPrototype.size = aclOwnerPrototypeCnt; +#else /* UseStaticTemplates */ + InP->aclOwnerPrototype.address = (void *)(aclOwnerPrototype); + InP->aclOwnerPrototype.size = aclOwnerPrototypeCnt; + InP->aclOwnerPrototype.deallocate = FALSE; + InP->aclOwnerPrototype.copy = MACH_MSG_VIRTUAL_COPY; + InP->aclOwnerPrototype.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->kind = kind; + + InP->key = key; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->aclOwnerPrototypeCnt = aclOwnerPrototypeCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1047; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1047, "setOwner") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1047, "setOwner") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__setOwner_t__defined) + check_result = __MIG_check__Reply__setOwner_t((__Reply__setOwner_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__setOwner_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getAcl_t__defined) +#define __MIG_check__Reply__getAcl_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getAcl_t(__Reply__getAcl_t *Out0P) +{ + + typedef __Reply__getAcl_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1148) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->acls.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getAcl_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getAcl */ +mig_external kern_return_t ucsp_client_getAcl +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + AclKind kind, + IPCGenericHandle key, + boolean_t haveTag, + CssmString tag, + uint32 *count, + Data *acls, + mach_msg_type_number_t *aclsCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + AclKind kind; + IPCGenericHandle key; + boolean_t haveTag; + mach_msg_type_number_t tagOffset; /* MiG doesn't use it */ + mach_msg_type_number_t tagCnt; + char tag[68]; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t acls; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + uint32 count; + mach_msg_type_number_t aclsCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t acls; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + uint32 count; + mach_msg_type_number_t aclsCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + unsigned int msgh_size; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getAcl_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getAcl_t__defined */ + + __DeclareSendRpc(1048, "getAcl") + + InP->NDR = NDR_record; + + InP->kind = kind; + + InP->key = key; + + InP->haveTag = haveTag; + +#ifdef USING_MIG_STRNCPY_ZEROFILL + if (mig_strncpy_zerofill != NULL) { + InP->tagCnt = mig_strncpy_zerofill(InP->tag, tag, 68); + } else { +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + InP->tagCnt = mig_strncpy(InP->tag, tag, 68); +#ifdef USING_MIG_STRNCPY_ZEROFILL + } +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + + msgh_size = (mach_msg_size_t)(sizeof(Request) - 68) + (_WALIGN_(InP->tagCnt)); + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1048; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1048, "getAcl") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1048, "getAcl") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getAcl_t__defined) + check_result = __MIG_check__Reply__getAcl_t((__Reply__getAcl_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getAcl_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *count = Out0P->count; + + *acls = (Data)(Out0P->acls.address); + *aclsCnt = Out0P->aclsCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__changeAcl_t__defined) +#define __MIG_check__Reply__changeAcl_t__defined + +mig_internal kern_return_t __MIG_check__Reply__changeAcl_t(__Reply__changeAcl_t *Out0P) +{ + + typedef __Reply__changeAcl_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1149) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__changeAcl_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine changeAcl */ +mig_external kern_return_t ucsp_client_changeAcl +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + AclKind kind, + IPCGenericHandle key, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + CSSM_ACL_EDIT_MODE mode, + IPCGenericHandle handle, + Data aclEntryInput, + mach_msg_type_number_t aclEntryInputCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryInput; + /* end of the kernel processed data */ + NDR_record_t NDR; + AclKind kind; + IPCGenericHandle key; + mach_msg_type_number_t accessCredentialsCnt; + CSSM_ACL_EDIT_MODE mode; + IPCGenericHandle handle; + mach_msg_type_number_t aclEntryInputCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__changeAcl_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__changeAcl_t__defined */ + + __DeclareSendRpc(1049, "changeAcl") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t aclEntryInputTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->aclEntryInput = aclEntryInputTemplate; + InP->aclEntryInput.address = (void *)(aclEntryInput); + InP->aclEntryInput.size = aclEntryInputCnt; +#else /* UseStaticTemplates */ + InP->aclEntryInput.address = (void *)(aclEntryInput); + InP->aclEntryInput.size = aclEntryInputCnt; + InP->aclEntryInput.deallocate = FALSE; + InP->aclEntryInput.copy = MACH_MSG_VIRTUAL_COPY; + InP->aclEntryInput.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->kind = kind; + + InP->key = key; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->mode = mode; + + InP->handle = handle; + + InP->aclEntryInputCnt = aclEntryInputCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1049; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1049, "changeAcl") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1049, "changeAcl") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__changeAcl_t__defined) + check_result = __MIG_check__Reply__changeAcl_t((__Reply__changeAcl_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__changeAcl_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__login_t__defined) +#define __MIG_check__Reply__login_t__defined + +mig_internal kern_return_t __MIG_check__Reply__login_t(__Reply__login_t *Out0P) +{ + + typedef __Reply__login_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1150) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__login_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine login */ +mig_external kern_return_t ucsp_client_login +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data name, + mach_msg_type_number_t nameCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t name; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t nameCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__login_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__login_t__defined */ + + __DeclareSendRpc(1050, "login") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t nameTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->name = nameTemplate; + InP->name.address = (void *)(name); + InP->name.size = nameCnt; +#else /* UseStaticTemplates */ + InP->name.address = (void *)(name); + InP->name.size = nameCnt; + InP->name.deallocate = FALSE; + InP->name.copy = MACH_MSG_VIRTUAL_COPY; + InP->name.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->nameCnt = nameCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1050; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1050, "login") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1050, "login") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__login_t__defined) + check_result = __MIG_check__Reply__login_t((__Reply__login_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__login_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__logout_t__defined) +#define __MIG_check__Reply__logout_t__defined + +mig_internal kern_return_t __MIG_check__Reply__logout_t(__Reply__logout_t *Out0P) +{ + + typedef __Reply__logout_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1151) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__logout_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine logout */ +mig_external kern_return_t ucsp_client_logout +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__logout_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__logout_t__defined */ + + __DeclareSendRpc(1051, "logout") + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1051; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1051, "logout") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1051, "logout") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__logout_t__defined) + check_result = __MIG_check__Reply__logout_t((__Reply__logout_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__logout_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getStatistics_t__defined) +#define __MIG_check__Reply__getStatistics_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getStatistics_t(__Reply__getStatistics_t *Out0P) +{ + + typedef __Reply__getStatistics_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1152) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getStatistics_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getStatistics */ +mig_external kern_return_t ucsp_client_getStatistics +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + CSSM_CSP_OPERATIONAL_STATISTICS *statistics +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 ssid; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + CSSM_CSP_OPERATIONAL_STATISTICS statistics; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + CSSM_CSP_OPERATIONAL_STATISTICS statistics; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getStatistics_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getStatistics_t__defined */ + + __DeclareSendRpc(1052, "getStatistics") + + InP->NDR = NDR_record; + + InP->ssid = ssid; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1052; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1052, "getStatistics") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1052, "getStatistics") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getStatistics_t__defined) + check_result = __MIG_check__Reply__getStatistics_t((__Reply__getStatistics_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getStatistics_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *statistics = Out0P->statistics; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getTime_t__defined) +#define __MIG_check__Reply__getTime_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getTime_t(__Reply__getTime_t *Out0P) +{ + + typedef __Reply__getTime_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1153) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getTime_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getTime */ +mig_external kern_return_t ucsp_client_getTime +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + CSSM_ALGORITHMS algorithm, + Data *data, + mach_msg_type_number_t *dataCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 ssid; + CSSM_ALGORITHMS algorithm; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getTime_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getTime_t__defined */ + + __DeclareSendRpc(1053, "getTime") + + InP->NDR = NDR_record; + + InP->ssid = ssid; + + InP->algorithm = algorithm; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1053; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1053, "getTime") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1053, "getTime") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getTime_t__defined) + check_result = __MIG_check__Reply__getTime_t((__Reply__getTime_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getTime_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *data = (Data)(Out0P->data.address); + *dataCnt = Out0P->dataCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getCounter_t__defined) +#define __MIG_check__Reply__getCounter_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getCounter_t(__Reply__getCounter_t *Out0P) +{ + + typedef __Reply__getCounter_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1154) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->data.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getCounter_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getCounter */ +mig_external kern_return_t ucsp_client_getCounter +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + Data *data, + mach_msg_type_number_t *dataCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 ssid; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t dataCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getCounter_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getCounter_t__defined */ + + __DeclareSendRpc(1054, "getCounter") + + InP->NDR = NDR_record; + + InP->ssid = ssid; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1054; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1054, "getCounter") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1054, "getCounter") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getCounter_t__defined) + check_result = __MIG_check__Reply__getCounter_t((__Reply__getCounter_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getCounter_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *data = (Data)(Out0P->data.address); + *dataCnt = Out0P->dataCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__selfVerify_t__defined) +#define __MIG_check__Reply__selfVerify_t__defined + +mig_internal kern_return_t __MIG_check__Reply__selfVerify_t(__Reply__selfVerify_t *Out0P) +{ + + typedef __Reply__selfVerify_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1155) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__selfVerify_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine selfVerify */ +mig_external kern_return_t ucsp_client_selfVerify +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 ssid; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__selfVerify_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__selfVerify_t__defined */ + + __DeclareSendRpc(1055, "selfVerify") + + InP->NDR = NDR_record; + + InP->ssid = ssid; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1055; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1055, "selfVerify") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1055, "selfVerify") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__selfVerify_t__defined) + check_result = __MIG_check__Reply__selfVerify_t((__Reply__selfVerify_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__selfVerify_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__cspPassThrough_t__defined) +#define __MIG_check__Reply__cspPassThrough_t__defined + +mig_internal kern_return_t __MIG_check__Reply__cspPassThrough_t(__Reply__cspPassThrough_t *Out0P) +{ + + typedef __Reply__cspPassThrough_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1156) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->outData.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__cspPassThrough_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine cspPassThrough */ +mig_external kern_return_t ucsp_client_cspPassThrough +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + uint32 id, + Data context, + mach_msg_type_number_t contextCnt, + IPCKeyHandle hKey, + Data inData, + mach_msg_type_number_t inDataCnt, + Data *outData, + mach_msg_type_number_t *outDataCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t inData; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 ssid; + uint32 id; + mach_msg_type_number_t contextCnt; + IPCKeyHandle hKey; + mach_msg_type_number_t inDataCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outData; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outDataCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outData; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outDataCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__cspPassThrough_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__cspPassThrough_t__defined */ + + __DeclareSendRpc(1056, "cspPassThrough") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t inDataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->inData = inDataTemplate; + InP->inData.address = (void *)(inData); + InP->inData.size = inDataCnt; +#else /* UseStaticTemplates */ + InP->inData.address = (void *)(inData); + InP->inData.size = inDataCnt; + InP->inData.deallocate = FALSE; + InP->inData.copy = MACH_MSG_VIRTUAL_COPY; + InP->inData.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->ssid = ssid; + + InP->id = id; + + InP->contextCnt = contextCnt; + + InP->hKey = hKey; + + InP->inDataCnt = inDataCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1056; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1056, "cspPassThrough") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1056, "cspPassThrough") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__cspPassThrough_t__defined) + check_result = __MIG_check__Reply__cspPassThrough_t((__Reply__cspPassThrough_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__cspPassThrough_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *outData = (Data)(Out0P->outData.address); + *outDataCnt = Out0P->outDataCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__dlPassThrough_t__defined) +#define __MIG_check__Reply__dlPassThrough_t__defined + +mig_internal kern_return_t __MIG_check__Reply__dlPassThrough_t(__Reply__dlPassThrough_t *Out0P) +{ + + typedef __Reply__dlPassThrough_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1157) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->outData.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__dlPassThrough_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine dlPassThrough */ +mig_external kern_return_t ucsp_client_dlPassThrough +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 ssid, + uint32 id, + Data inData, + mach_msg_type_number_t inDataCnt, + Data *outData, + mach_msg_type_number_t *outDataCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t inData; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 ssid; + uint32 id; + mach_msg_type_number_t inDataCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outData; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outDataCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t outData; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t outDataCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__dlPassThrough_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__dlPassThrough_t__defined */ + + __DeclareSendRpc(1057, "dlPassThrough") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t inDataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->inData = inDataTemplate; + InP->inData.address = (void *)(inData); + InP->inData.size = inDataCnt; +#else /* UseStaticTemplates */ + InP->inData.address = (void *)(inData); + InP->inData.size = inDataCnt; + InP->inData.deallocate = FALSE; + InP->inData.copy = MACH_MSG_VIRTUAL_COPY; + InP->inData.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->ssid = ssid; + + InP->id = id; + + InP->inDataCnt = inDataCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1057; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1057, "dlPassThrough") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1057, "dlPassThrough") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__dlPassThrough_t__defined) + check_result = __MIG_check__Reply__dlPassThrough_t((__Reply__dlPassThrough_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__dlPassThrough_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *outData = (Data)(Out0P->outData.address); + *outDataCnt = Out0P->outDataCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__postNotification_t__defined) +#define __MIG_check__Reply__postNotification_t__defined + +mig_internal kern_return_t __MIG_check__Reply__postNotification_t(__Reply__postNotification_t *Out0P) +{ + + typedef __Reply__postNotification_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1169) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__postNotification_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine postNotification */ +mig_external kern_return_t ucsp_client_postNotification +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 domain, + uint32 event, + Data data, + mach_msg_type_number_t dataCnt, + uint32 sequence +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 domain; + uint32 event; + mach_msg_type_number_t dataCnt; + uint32 sequence; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__postNotification_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__postNotification_t__defined */ + + __DeclareSendRpc(1069, "postNotification") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->domain = domain; + + InP->event = event; + + InP->dataCnt = dataCnt; + + InP->sequence = sequence; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1069; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1069, "postNotification") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1069, "postNotification") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__postNotification_t__defined) + check_result = __MIG_check__Reply__postNotification_t((__Reply__postNotification_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__postNotification_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__extractMasterKey_t__defined) +#define __MIG_check__Reply__extractMasterKey_t__defined + +mig_internal kern_return_t __MIG_check__Reply__extractMasterKey_t(__Reply__extractMasterKey_t *Out0P) +{ + + typedef __Reply__extractMasterKey_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1170) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->header.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__extractMasterKey_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine extractMasterKey */ +mig_external kern_return_t ucsp_client_extractMasterKey +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db, + Data context, + mach_msg_type_number_t contextCnt, + IPCDbHandle sourceDb, + Data accessCredentials, + mach_msg_type_number_t accessCredentialsCnt, + Data aclEntryPrototype, + mach_msg_type_number_t aclEntryPrototypeCnt, + uint32 keyUsage, + uint32 keyAttrs, + IPCKeyHandle *key, + Data *header, + mach_msg_type_number_t *headerCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t context; + mach_msg_ool_descriptor_t accessCredentials; + mach_msg_ool_descriptor_t aclEntryPrototype; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle db; + mach_msg_type_number_t contextCnt; + IPCDbHandle sourceDb; + mach_msg_type_number_t accessCredentialsCnt; + mach_msg_type_number_t aclEntryPrototypeCnt; + uint32 keyUsage; + uint32 keyAttrs; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t header; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + IPCKeyHandle key; + mach_msg_type_number_t headerCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__extractMasterKey_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__extractMasterKey_t__defined */ + + __DeclareSendRpc(1070, "extractMasterKey") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t contextTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t accessCredentialsTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t aclEntryPrototypeTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 3; +#if UseStaticTemplates + InP->context = contextTemplate; + InP->context.address = (void *)(context); + InP->context.size = contextCnt; +#else /* UseStaticTemplates */ + InP->context.address = (void *)(context); + InP->context.size = contextCnt; + InP->context.deallocate = FALSE; + InP->context.copy = MACH_MSG_VIRTUAL_COPY; + InP->context.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->accessCredentials = accessCredentialsTemplate; + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; +#else /* UseStaticTemplates */ + InP->accessCredentials.address = (void *)(accessCredentials); + InP->accessCredentials.size = accessCredentialsCnt; + InP->accessCredentials.deallocate = FALSE; + InP->accessCredentials.copy = MACH_MSG_VIRTUAL_COPY; + InP->accessCredentials.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->aclEntryPrototype = aclEntryPrototypeTemplate; + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; +#else /* UseStaticTemplates */ + InP->aclEntryPrototype.address = (void *)(aclEntryPrototype); + InP->aclEntryPrototype.size = aclEntryPrototypeCnt; + InP->aclEntryPrototype.deallocate = FALSE; + InP->aclEntryPrototype.copy = MACH_MSG_VIRTUAL_COPY; + InP->aclEntryPrototype.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->db = db; + + InP->contextCnt = contextCnt; + + InP->sourceDb = sourceDb; + + InP->accessCredentialsCnt = accessCredentialsCnt; + + InP->aclEntryPrototypeCnt = aclEntryPrototypeCnt; + + InP->keyUsage = keyUsage; + + InP->keyAttrs = keyAttrs; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1070; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1070, "extractMasterKey") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1070, "extractMasterKey") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__extractMasterKey_t__defined) + check_result = __MIG_check__Reply__extractMasterKey_t((__Reply__extractMasterKey_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__extractMasterKey_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *key = Out0P->key; + + *header = (Data)(Out0P->header.address); + *headerCnt = Out0P->headerCnt; + + return KERN_SUCCESS; +} + +/* SimpleRoutine childCheckIn */ +mig_external kern_return_t ucsp_client_childCheckIn +( + mach_port_t sport, + mach_port_t servicePort, + mach_port_t task_port +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t servicePort; + mach_msg_port_descriptor_t task_port; + /* end of the kernel processed data */ + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + } Mess; + + Request *InP = &Mess.In; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__childCheckIn_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__childCheckIn_t__defined */ + + __DeclareSendSimple(1077, "childCheckIn") + +#if UseStaticTemplates + const static mach_msg_port_descriptor_t servicePortTemplate = { + /* name = */ MACH_PORT_NULL, + /* pad1 = */ 0, + /* pad2 = */ 0, + /* disp = */ 20, + /* type = */ MACH_MSG_PORT_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_port_descriptor_t task_portTemplate = { + /* name = */ MACH_PORT_NULL, + /* pad1 = */ 0, + /* pad2 = */ 0, + /* disp = */ 19, + /* type = */ MACH_MSG_PORT_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->servicePort = servicePortTemplate; + InP->servicePort.name = servicePort; +#else /* UseStaticTemplates */ + InP->servicePort.name = servicePort; + InP->servicePort.disposition = 20; + InP->servicePort.type = MACH_MSG_PORT_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->task_port = task_portTemplate; + InP->task_port.name = task_port; +#else /* UseStaticTemplates */ + InP->task_port.name = task_port; + InP->task_port.disposition = 19; + InP->task_port.type = MACH_MSG_PORT_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 0); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = MACH_PORT_NULL; + InP->Head.msgh_id = 1077; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendSimple(1077, "childCheckIn") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendSimple(1077, "childCheckIn") + return msg_result; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__commitDbForSync_t__defined) +#define __MIG_check__Reply__commitDbForSync_t__defined + +mig_internal kern_return_t __MIG_check__Reply__commitDbForSync_t(__Reply__commitDbForSync_t *Out0P) +{ + + typedef __Reply__commitDbForSync_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1178) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->blob.type != MACH_MSG_OOL_DESCRIPTOR) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__commitDbForSync_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine commitDbForSync */ +mig_external kern_return_t ucsp_client_commitDbForSync +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle srcDb, + IPCDbHandle cloneDb, + Pointer *blob, + mach_msg_type_number_t *blobCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle srcDb; + IPCDbHandle cloneDb; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t blob; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_type_number_t blobCnt; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__commitDbForSync_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__commitDbForSync_t__defined */ + + __DeclareSendRpc(1078, "commitDbForSync") + + InP->NDR = NDR_record; + + InP->srcDb = srcDb; + + InP->cloneDb = cloneDb; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1078; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1078, "commitDbForSync") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1078, "commitDbForSync") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__commitDbForSync_t__defined) + check_result = __MIG_check__Reply__commitDbForSync_t((__Reply__commitDbForSync_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__commitDbForSync_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *blob = (Pointer)(Out0P->blob.address); + *blobCnt = Out0P->blobCnt; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__registerHosting_t__defined) +#define __MIG_check__Reply__registerHosting_t__defined + +mig_internal kern_return_t __MIG_check__Reply__registerHosting_t(__Reply__registerHosting_t *Out0P) +{ + + typedef __Reply__registerHosting_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1179) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__registerHosting_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine registerHosting */ +mig_external kern_return_t ucsp_client_registerHosting +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + mach_port_t hostingPort, + uint32 flags +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t hostingPort; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 flags; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__registerHosting_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__registerHosting_t__defined */ + + __DeclareSendRpc(1079, "registerHosting") + +#if UseStaticTemplates + const static mach_msg_port_descriptor_t hostingPortTemplate = { + /* name = */ MACH_PORT_NULL, + /* pad1 = */ 0, + /* pad2 = */ 0, + /* disp = */ 20, + /* type = */ MACH_MSG_PORT_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->hostingPort = hostingPortTemplate; + InP->hostingPort.name = hostingPort; +#else /* UseStaticTemplates */ + InP->hostingPort.name = hostingPort; + InP->hostingPort.disposition = 20; + InP->hostingPort.type = MACH_MSG_PORT_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->flags = flags; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1079; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1079, "registerHosting") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1079, "registerHosting") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__registerHosting_t__defined) + check_result = __MIG_check__Reply__registerHosting_t((__Reply__registerHosting_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__registerHosting_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__hostingPort_t__defined) +#define __MIG_check__Reply__hostingPort_t__defined + +mig_internal kern_return_t __MIG_check__Reply__hostingPort_t(__Reply__hostingPort_t *Out0P) +{ + + typedef __Reply__hostingPort_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1180) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->hostingPort.type != MACH_MSG_PORT_DESCRIPTOR || + Out0P->hostingPort.disposition != 17) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__hostingPort_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine hostingPort */ +mig_external kern_return_t ucsp_client_hostingPort +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + pid_t hostPid, + mach_port_t *hostingPort +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + pid_t hostPid; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t hostingPort; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t hostingPort; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__hostingPort_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__hostingPort_t__defined */ + + __DeclareSendRpc(1080, "hostingPort") + + InP->NDR = NDR_record; + + InP->hostPid = hostPid; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1080; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1080, "hostingPort") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1080, "hostingPort") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__hostingPort_t__defined) + check_result = __MIG_check__Reply__hostingPort_t((__Reply__hostingPort_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__hostingPort_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *hostingPort = Out0P->hostingPort.name; + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__setGuest_t__defined) +#define __MIG_check__Reply__setGuest_t__defined + +mig_internal kern_return_t __MIG_check__Reply__setGuest_t(__Reply__setGuest_t *Out0P) +{ + + typedef __Reply__setGuest_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1181) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__setGuest_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine setGuest */ +mig_external kern_return_t ucsp_client_setGuest +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + SecGuestRef guest, + uint32 flags +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef guest; + uint32 flags; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__setGuest_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__setGuest_t__defined */ + + __DeclareSendRpc(1081, "setGuest") + + InP->NDR = NDR_record; + + InP->guest = guest; + + InP->flags = flags; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1081; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1081, "setGuest") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1081, "setGuest") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__setGuest_t__defined) + check_result = __MIG_check__Reply__setGuest_t((__Reply__setGuest_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__setGuest_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__createGuest_t__defined) +#define __MIG_check__Reply__createGuest_t__defined + +mig_internal kern_return_t __MIG_check__Reply__createGuest_t(__Reply__createGuest_t *Out0P) +{ + + typedef __Reply__createGuest_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1182) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__createGuest_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine createGuest */ +mig_external kern_return_t ucsp_client_createGuest +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + SecGuestRef host, + uint32_t status, + FilePath path, + HashData cdhash, + mach_msg_type_number_t cdhashCnt, + Data attributes, + mach_msg_type_number_t attributesCnt, + uint32 flags, + SecGuestRef *guest +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + SecGuestRef host; + uint32_t status; + mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t pathCnt; + char path[1024]; + mach_msg_type_number_t cdhashCnt; + char cdhash[64]; + mach_msg_type_number_t attributesCnt; + uint32 flags; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + SecGuestRef guest; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + SecGuestRef guest; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + unsigned int msgh_size; + unsigned int msgh_size_delta; + + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__createGuest_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__createGuest_t__defined */ + + __DeclareSendRpc(1082, "createGuest") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t attributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->attributes = attributesTemplate; + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; +#else /* UseStaticTemplates */ + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; + InP->attributes.deallocate = FALSE; + InP->attributes.copy = MACH_MSG_VIRTUAL_COPY; + InP->attributes.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->host = host; + + InP->status = status; + +#ifdef USING_MIG_STRNCPY_ZEROFILL + if (mig_strncpy_zerofill != NULL) { + InP->pathCnt = mig_strncpy_zerofill(InP->path, path, 1024); + } else { +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + InP->pathCnt = mig_strncpy(InP->path, path, 1024); +#ifdef USING_MIG_STRNCPY_ZEROFILL + } +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + + msgh_size_delta = _WALIGN_(InP->pathCnt); + msgh_size = (mach_msg_size_t)(sizeof(Request) - 1088) + msgh_size_delta; + InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024); + + if (cdhashCnt > 64) { + { return MIG_ARRAY_TOO_LARGE; } + } + (void)memcpy((char *) InP->cdhash, (const char *) cdhash, cdhashCnt); + + InP->cdhashCnt = cdhashCnt; + + msgh_size_delta = _WALIGN_(cdhashCnt); + msgh_size += msgh_size_delta; + InP = (Request *) ((pointer_t) InP + msgh_size_delta - 64); + + InP->attributesCnt = attributesCnt; + + InP->flags = flags; + + InP = &Mess.In; + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1082; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1082, "createGuest") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1082, "createGuest") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__createGuest_t__defined) + check_result = __MIG_check__Reply__createGuest_t((__Reply__createGuest_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__createGuest_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *guest = Out0P->guest; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__setGuestStatus_t__defined) +#define __MIG_check__Reply__setGuestStatus_t__defined + +mig_internal kern_return_t __MIG_check__Reply__setGuestStatus_t(__Reply__setGuestStatus_t *Out0P) +{ + + typedef __Reply__setGuestStatus_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1183) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__setGuestStatus_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine setGuestStatus */ +mig_external kern_return_t ucsp_client_setGuestStatus +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + SecGuestRef guest, + uint32_t status, + Data attributes, + mach_msg_type_number_t attributesCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t attributes; + /* end of the kernel processed data */ + NDR_record_t NDR; + SecGuestRef guest; + uint32_t status; + mach_msg_type_number_t attributesCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__setGuestStatus_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__setGuestStatus_t__defined */ + + __DeclareSendRpc(1083, "setGuestStatus") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t attributesTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->attributes = attributesTemplate; + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; +#else /* UseStaticTemplates */ + InP->attributes.address = (void *)(attributes); + InP->attributes.size = attributesCnt; + InP->attributes.deallocate = FALSE; + InP->attributes.copy = MACH_MSG_VIRTUAL_COPY; + InP->attributes.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->guest = guest; + + InP->status = status; + + InP->attributesCnt = attributesCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1083; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1083, "setGuestStatus") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1083, "setGuestStatus") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__setGuestStatus_t__defined) + check_result = __MIG_check__Reply__setGuestStatus_t((__Reply__setGuestStatus_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__setGuestStatus_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__removeGuest_t__defined) +#define __MIG_check__Reply__removeGuest_t__defined + +mig_internal kern_return_t __MIG_check__Reply__removeGuest_t(__Reply__removeGuest_t *Out0P) +{ + + typedef __Reply__removeGuest_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1184) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__removeGuest_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine removeGuest */ +mig_external kern_return_t ucsp_client_removeGuest +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + SecGuestRef host, + SecGuestRef guest +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + SecGuestRef host; + SecGuestRef guest; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__removeGuest_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__removeGuest_t__defined */ + + __DeclareSendRpc(1084, "removeGuest") + + InP->NDR = NDR_record; + + InP->host = host; + + InP->guest = guest; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1084; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1084, "removeGuest") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1084, "removeGuest") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__removeGuest_t__defined) + check_result = __MIG_check__Reply__removeGuest_t((__Reply__removeGuest_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__removeGuest_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__helpCheckLoad_t__defined) +#define __MIG_check__Reply__helpCheckLoad_t__defined + +mig_internal kern_return_t __MIG_check__Reply__helpCheckLoad_t(__Reply__helpCheckLoad_t *Out0P) +{ + + typedef __Reply__helpCheckLoad_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1185) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__helpCheckLoad_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine helpCheckLoad */ +mig_external kern_return_t ucsp_client_helpCheckLoad +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + FilePath path, + uint32_t addType +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + mach_msg_type_number_t pathOffset; /* MiG doesn't use it */ + mach_msg_type_number_t pathCnt; + char path[1024]; + uint32_t addType; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + unsigned int msgh_size; + unsigned int msgh_size_delta; + + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__helpCheckLoad_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__helpCheckLoad_t__defined */ + + __DeclareSendRpc(1085, "helpCheckLoad") + + InP->NDR = NDR_record; + +#ifdef USING_MIG_STRNCPY_ZEROFILL + if (mig_strncpy_zerofill != NULL) { + InP->pathCnt = mig_strncpy_zerofill(InP->path, path, 1024); + } else { +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + InP->pathCnt = mig_strncpy(InP->path, path, 1024); +#ifdef USING_MIG_STRNCPY_ZEROFILL + } +#endif /* USING_MIG_STRNCPY_ZEROFILL */ + + msgh_size_delta = _WALIGN_(InP->pathCnt); + msgh_size = (mach_msg_size_t)(sizeof(Request) - 1024) + msgh_size_delta; + InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024); + + InP->addType = addType; + + InP = &Mess.In; + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1085; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1085, "helpCheckLoad") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), msgh_size, (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1085, "helpCheckLoad") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__helpCheckLoad_t__defined) + check_result = __MIG_check__Reply__helpCheckLoad_t((__Reply__helpCheckLoad_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__helpCheckLoad_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__recodeDbForSync_t__defined) +#define __MIG_check__Reply__recodeDbForSync_t__defined + +mig_internal kern_return_t __MIG_check__Reply__recodeDbForSync_t(__Reply__recodeDbForSync_t *Out0P) +{ + + typedef __Reply__recodeDbForSync_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1186) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__recodeDbForSync_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine recodeDbForSync */ +mig_external kern_return_t ucsp_client_recodeDbForSync +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle dbToClone, + IPCDbHandle srcDb, + IPCDbHandle *newDb +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle dbToClone; + IPCDbHandle srcDb; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__recodeDbForSync_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__recodeDbForSync_t__defined */ + + __DeclareSendRpc(1086, "recodeDbForSync") + + InP->NDR = NDR_record; + + InP->dbToClone = dbToClone; + + InP->srcDb = srcDb; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1086; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1086, "recodeDbForSync") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1086, "recodeDbForSync") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__recodeDbForSync_t__defined) + check_result = __MIG_check__Reply__recodeDbForSync_t((__Reply__recodeDbForSync_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__recodeDbForSync_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *newDb = Out0P->newDb; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__authenticateDbsForSync_t__defined) +#define __MIG_check__Reply__authenticateDbsForSync_t__defined + +mig_internal kern_return_t __MIG_check__Reply__authenticateDbsForSync_t(__Reply__authenticateDbsForSync_t *Out0P) +{ + + typedef __Reply__authenticateDbsForSync_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1187) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__authenticateDbsForSync_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine authenticateDbsForSync */ +mig_external kern_return_t ucsp_client_authenticateDbsForSync +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data ipcDbHandleArray, + mach_msg_type_number_t ipcDbHandleArrayCnt, + Data agentData, + mach_msg_type_number_t agentDataCnt, + IPCDbHandle *newDb +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ipcDbHandleArray; + mach_msg_ool_descriptor_t agentData; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t ipcDbHandleArrayCnt; + mach_msg_type_number_t agentDataCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__authenticateDbsForSync_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__authenticateDbsForSync_t__defined */ + + __DeclareSendRpc(1087, "authenticateDbsForSync") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t ipcDbHandleArrayTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t agentDataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 2; +#if UseStaticTemplates + InP->ipcDbHandleArray = ipcDbHandleArrayTemplate; + InP->ipcDbHandleArray.address = (void *)(ipcDbHandleArray); + InP->ipcDbHandleArray.size = ipcDbHandleArrayCnt; +#else /* UseStaticTemplates */ + InP->ipcDbHandleArray.address = (void *)(ipcDbHandleArray); + InP->ipcDbHandleArray.size = ipcDbHandleArrayCnt; + InP->ipcDbHandleArray.deallocate = FALSE; + InP->ipcDbHandleArray.copy = MACH_MSG_VIRTUAL_COPY; + InP->ipcDbHandleArray.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + +#if UseStaticTemplates + InP->agentData = agentDataTemplate; + InP->agentData.address = (void *)(agentData); + InP->agentData.size = agentDataCnt; +#else /* UseStaticTemplates */ + InP->agentData.address = (void *)(agentData); + InP->agentData.size = agentDataCnt; + InP->agentData.deallocate = FALSE; + InP->agentData.copy = MACH_MSG_VIRTUAL_COPY; + InP->agentData.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->ipcDbHandleArrayCnt = ipcDbHandleArrayCnt; + + InP->agentDataCnt = agentDataCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1087; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1087, "authenticateDbsForSync") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1087, "authenticateDbsForSync") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__authenticateDbsForSync_t__defined) + check_result = __MIG_check__Reply__authenticateDbsForSync_t((__Reply__authenticateDbsForSync_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__authenticateDbsForSync_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *newDb = Out0P->newDb; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__verifyPrivileged_t__defined) +#define __MIG_check__Reply__verifyPrivileged_t__defined + +mig_internal kern_return_t __MIG_check__Reply__verifyPrivileged_t(__Reply__verifyPrivileged_t *Out0P) +{ + + typedef __Reply__verifyPrivileged_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1188) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__verifyPrivileged_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine verifyPrivileged */ +mig_external kern_return_t ucsp_client_verifyPrivileged +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__verifyPrivileged_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__verifyPrivileged_t__defined */ + + __DeclareSendRpc(1088, "verifyPrivileged") + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1088; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1088, "verifyPrivileged") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1088, "verifyPrivileged") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__verifyPrivileged_t__defined) + check_result = __MIG_check__Reply__verifyPrivileged_t((__Reply__verifyPrivileged_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__verifyPrivileged_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__verifyPrivileged2_t__defined) +#define __MIG_check__Reply__verifyPrivileged2_t__defined + +mig_internal kern_return_t __MIG_check__Reply__verifyPrivileged2_t(__Reply__verifyPrivileged2_t *Out0P) +{ + + typedef __Reply__verifyPrivileged2_t __Reply __attribute__((unused)); + boolean_t msgh_simple; +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1189) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + + msgh_simple = !(Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX); +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((msgh_simple || Out0P->msgh_body.msgh_descriptor_count != 1 || + msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (!msgh_simple || msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + ((mig_reply_error_t *)Out0P)->RetCode == KERN_SUCCESS)) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (msgh_simple) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + +#if __MigTypeCheck + if (Out0P->originPort.type != MACH_MSG_PORT_DESCRIPTOR || + Out0P->originPort.disposition != 17) { + return MIG_TYPE_ERROR; + } +#endif /* __MigTypeCheck */ + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__verifyPrivileged2_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine verifyPrivileged2 */ +mig_external kern_return_t ucsp_client_verifyPrivileged2 +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + mach_port_t *originPort +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t originPort; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_port_descriptor_t originPort; + /* end of the kernel processed data */ + NDR_record_t NDR; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__verifyPrivileged2_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__verifyPrivileged2_t__defined */ + + __DeclareSendRpc(1089, "verifyPrivileged2") + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1089; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1089, "verifyPrivileged2") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1089, "verifyPrivileged2") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__verifyPrivileged2_t__defined) + check_result = __MIG_check__Reply__verifyPrivileged2_t((__Reply__verifyPrivileged2_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__verifyPrivileged2_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *originPort = Out0P->originPort.name; + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__stashDb_t__defined) +#define __MIG_check__Reply__stashDb_t__defined + +mig_internal kern_return_t __MIG_check__Reply__stashDb_t(__Reply__stashDb_t *Out0P) +{ + + typedef __Reply__stashDb_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1190) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__stashDb_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine stashDb */ +mig_external kern_return_t ucsp_client_stashDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__stashDb_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__stashDb_t__defined */ + + __DeclareSendRpc(1090, "stashDb") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1090; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1090, "stashDb") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1090, "stashDb") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__stashDb_t__defined) + check_result = __MIG_check__Reply__stashDb_t((__Reply__stashDb_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__stashDb_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__stashDbCheck_t__defined) +#define __MIG_check__Reply__stashDbCheck_t__defined + +mig_internal kern_return_t __MIG_check__Reply__stashDbCheck_t(__Reply__stashDbCheck_t *Out0P) +{ + + typedef __Reply__stashDbCheck_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1191) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__stashDbCheck_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine stashDbCheck */ +mig_external kern_return_t ucsp_client_stashDbCheck +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__stashDbCheck_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__stashDbCheck_t__defined */ + + __DeclareSendRpc(1091, "stashDbCheck") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1091; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1091, "stashDbCheck") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1091, "stashDbCheck") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__stashDbCheck_t__defined) + check_result = __MIG_check__Reply__stashDbCheck_t((__Reply__stashDbCheck_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__stashDbCheck_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__verifyKeyStorePassphrase_t__defined) +#define __MIG_check__Reply__verifyKeyStorePassphrase_t__defined + +mig_internal kern_return_t __MIG_check__Reply__verifyKeyStorePassphrase_t(__Reply__verifyKeyStorePassphrase_t *Out0P) +{ + + typedef __Reply__verifyKeyStorePassphrase_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1192) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__verifyKeyStorePassphrase_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine verifyKeyStorePassphrase */ +mig_external kern_return_t ucsp_client_verifyKeyStorePassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32_t retries +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32_t retries; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__verifyKeyStorePassphrase_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__verifyKeyStorePassphrase_t__defined */ + + __DeclareSendRpc(1092, "verifyKeyStorePassphrase") + + InP->NDR = NDR_record; + + InP->retries = retries; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1092; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1092, "verifyKeyStorePassphrase") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1092, "verifyKeyStorePassphrase") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__verifyKeyStorePassphrase_t__defined) + check_result = __MIG_check__Reply__verifyKeyStorePassphrase_t((__Reply__verifyKeyStorePassphrase_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__verifyKeyStorePassphrase_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__resetKeyStorePassphrase_t__defined) +#define __MIG_check__Reply__resetKeyStorePassphrase_t__defined + +mig_internal kern_return_t __MIG_check__Reply__resetKeyStorePassphrase_t(__Reply__resetKeyStorePassphrase_t *Out0P) +{ + + typedef __Reply__resetKeyStorePassphrase_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1193) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__resetKeyStorePassphrase_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine resetKeyStorePassphrase */ +mig_external kern_return_t ucsp_client_resetKeyStorePassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + Data passPhrase, + mach_msg_type_number_t passPhraseCnt +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t passPhrase; + /* end of the kernel processed data */ + NDR_record_t NDR; + mach_msg_type_number_t passPhraseCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__resetKeyStorePassphrase_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__resetKeyStorePassphrase_t__defined */ + + __DeclareSendRpc(1093, "resetKeyStorePassphrase") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t passPhraseTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->passPhrase = passPhraseTemplate; + InP->passPhrase.address = (void *)(passPhrase); + InP->passPhrase.size = passPhraseCnt; +#else /* UseStaticTemplates */ + InP->passPhrase.address = (void *)(passPhrase); + InP->passPhrase.size = passPhraseCnt; + InP->passPhrase.deallocate = FALSE; + InP->passPhrase.copy = MACH_MSG_VIRTUAL_COPY; + InP->passPhrase.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->passPhraseCnt = passPhraseCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1093; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1093, "resetKeyStorePassphrase") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1093, "resetKeyStorePassphrase") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__resetKeyStorePassphrase_t__defined) + check_result = __MIG_check__Reply__resetKeyStorePassphrase_t((__Reply__resetKeyStorePassphrase_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__resetKeyStorePassphrase_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__changeKeyStorePassphrase_t__defined) +#define __MIG_check__Reply__changeKeyStorePassphrase_t__defined + +mig_internal kern_return_t __MIG_check__Reply__changeKeyStorePassphrase_t(__Reply__changeKeyStorePassphrase_t *Out0P) +{ + + typedef __Reply__changeKeyStorePassphrase_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1194) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__changeKeyStorePassphrase_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine changeKeyStorePassphrase */ +mig_external kern_return_t ucsp_client_changeKeyStorePassphrase +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__changeKeyStorePassphrase_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__changeKeyStorePassphrase_t__defined */ + + __DeclareSendRpc(1094, "changeKeyStorePassphrase") + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1094; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1094, "changeKeyStorePassphrase") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1094, "changeKeyStorePassphrase") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__changeKeyStorePassphrase_t__defined) + check_result = __MIG_check__Reply__changeKeyStorePassphrase_t((__Reply__changeKeyStorePassphrase_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__changeKeyStorePassphrase_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__recodeDbToVersion_t__defined) +#define __MIG_check__Reply__recodeDbToVersion_t__defined + +mig_internal kern_return_t __MIG_check__Reply__recodeDbToVersion_t(__Reply__recodeDbToVersion_t *Out0P) +{ + + typedef __Reply__recodeDbToVersion_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1195) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__recodeDbToVersion_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine recodeDbToVersion */ +mig_external kern_return_t ucsp_client_recodeDbToVersion +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32 newVersion, + IPCDbHandle srcDb, + IPCDbHandle *newDb +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + uint32 newVersion; + IPCDbHandle srcDb; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__recodeDbToVersion_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__recodeDbToVersion_t__defined */ + + __DeclareSendRpc(1095, "recodeDbToVersion") + + InP->NDR = NDR_record; + + InP->newVersion = newVersion; + + InP->srcDb = srcDb; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1095; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1095, "recodeDbToVersion") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1095, "recodeDbToVersion") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__recodeDbToVersion_t__defined) + check_result = __MIG_check__Reply__recodeDbToVersion_t((__Reply__recodeDbToVersion_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__recodeDbToVersion_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *newDb = Out0P->newDb; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__cloneDb_t__defined) +#define __MIG_check__Reply__cloneDb_t__defined + +mig_internal kern_return_t __MIG_check__Reply__cloneDb_t(__Reply__cloneDb_t *Out0P) +{ + + typedef __Reply__cloneDb_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1196) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__cloneDb_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine cloneDb */ +mig_external kern_return_t ucsp_client_cloneDb +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle srcDb, + Data ident, + mach_msg_type_number_t identCnt, + IPCDbHandle *newDb +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t ident; + /* end of the kernel processed data */ + NDR_record_t NDR; + IPCDbHandle srcDb; + mach_msg_type_number_t identCnt; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + IPCDbHandle newDb; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__cloneDb_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__cloneDb_t__defined */ + + __DeclareSendRpc(1096, "cloneDb") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t identTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->ident = identTemplate; + InP->ident.address = (void *)(ident); + InP->ident.size = identCnt; +#else /* UseStaticTemplates */ + InP->ident.address = (void *)(ident); + InP->ident.size = identCnt; + InP->ident.deallocate = FALSE; + InP->ident.copy = MACH_MSG_VIRTUAL_COPY; + InP->ident.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->srcDb = srcDb; + + InP->identCnt = identCnt; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1096; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1096, "cloneDb") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1096, "cloneDb") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__cloneDb_t__defined) + check_result = __MIG_check__Reply__cloneDb_t((__Reply__cloneDb_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__cloneDb_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *newDb = Out0P->newDb; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__recodeFinished_t__defined) +#define __MIG_check__Reply__recodeFinished_t__defined + +mig_internal kern_return_t __MIG_check__Reply__recodeFinished_t(__Reply__recodeFinished_t *Out0P) +{ + + typedef __Reply__recodeFinished_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1197) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__recodeFinished_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine recodeFinished */ +mig_external kern_return_t ucsp_client_recodeFinished +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + IPCDbHandle db +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + IPCDbHandle db; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__recodeFinished_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__recodeFinished_t__defined */ + + __DeclareSendRpc(1097, "recodeFinished") + + InP->NDR = NDR_record; + + InP->db = db; + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1097; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1097, "recodeFinished") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1097, "recodeFinished") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__recodeFinished_t__defined) + check_result = __MIG_check__Reply__recodeFinished_t((__Reply__recodeFinished_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__recodeFinished_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + return KERN_SUCCESS; +} + +#if ( __MigTypeCheck ) +#if __MIG_check__Reply__ucsp_subsystem__ +#if !defined(__MIG_check__Reply__getUserPromptAttempts_t__defined) +#define __MIG_check__Reply__getUserPromptAttempts_t__defined + +mig_internal kern_return_t __MIG_check__Reply__getUserPromptAttempts_t(__Reply__getUserPromptAttempts_t *Out0P) +{ + + typedef __Reply__getUserPromptAttempts_t __Reply __attribute__((unused)); +#if __MigTypeCheck + unsigned int msgh_size; +#endif /* __MigTypeCheck */ + if (Out0P->Head.msgh_id != 1198) { + if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) + { return MIG_SERVER_DIED; } + else + { return MIG_REPLY_MISMATCH; } + } + +#if __MigTypeCheck + msgh_size = Out0P->Head.msgh_size; + + if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || + ((msgh_size != (mach_msg_size_t)sizeof(__Reply)) && + (msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) || + Out0P->RetCode == KERN_SUCCESS))) + { return MIG_TYPE_ERROR ; } +#endif /* __MigTypeCheck */ + + if (Out0P->RetCode != KERN_SUCCESS) { + return ((mig_reply_error_t *)Out0P)->RetCode; + } + + return MACH_MSG_SUCCESS; +} +#endif /* !defined(__MIG_check__Reply__getUserPromptAttempts_t__defined) */ +#endif /* __MIG_check__Reply__ucsp_subsystem__ */ +#endif /* ( __MigTypeCheck ) */ + + +/* Routine getUserPromptAttempts */ +mig_external kern_return_t ucsp_client_getUserPromptAttempts +( + mach_port_t sport, + mach_port_t rport, + security_token_t *securitydCreds, + CSSM_RETURN *rcode, + uint32_t *attempts +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + uint32_t attempts; + mach_msg_max_trailer_t trailer; + } Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + CSSM_RETURN rcode; + uint32_t attempts; + } __Reply __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + Reply Out; + } Mess; + + Request *InP = &Mess.In; + Reply *Out0P = &Mess.Out; + + mach_msg_return_t msg_result; + mach_msg_max_trailer_t *TrailerP; +#if __MigTypeCheck + unsigned int trailer_size; +#endif /* __MigTypeCheck */ + +#ifdef __MIG_check__Reply__getUserPromptAttempts_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__getUserPromptAttempts_t__defined */ + + __DeclareSendRpc(1098, "getUserPromptAttempts") + + InP->Head.msgh_bits = + MACH_MSGH_BITS(19, 20); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = sport; + InP->Head.msgh_reply_port = rport; + InP->Head.msgh_id = 1098; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendRpc(1098, "getUserPromptAttempts") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|MACH_MSG_OPTION_NONE|MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_SENDER), (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + __AfterSendRpc(1098, "getUserPromptAttempts") + if (msg_result != MACH_MSG_SUCCESS) { + { return msg_result; } + } + + +#if defined(__MIG_check__Reply__getUserPromptAttempts_t__defined) + check_result = __MIG_check__Reply__getUserPromptAttempts_t((__Reply__getUserPromptAttempts_t *)Out0P); + if (check_result != MACH_MSG_SUCCESS) + { return check_result; } +#endif /* defined(__MIG_check__Reply__getUserPromptAttempts_t__defined) */ + + TrailerP = (mach_msg_max_trailer_t *)((vm_offset_t)Out0P + + round_msg(Out0P->Head.msgh_size)); + if (TrailerP->msgh_trailer_type != MACH_MSG_TRAILER_FORMAT_0) + { return MIG_TRAILER_ERROR ; } +#if __MigTypeCheck + trailer_size = TrailerP->msgh_trailer_size - + (mach_msg_size_t)(sizeof(mach_msg_trailer_type_t) - sizeof(mach_msg_trailer_size_t)); +#endif /* __MigTypeCheck */ +#if __MigTypeCheck + if (trailer_size < (mach_msg_size_t)sizeof(security_token_t)) + { return MIG_TRAILER_ERROR ; } + trailer_size -= (mach_msg_size_t)sizeof(security_token_t); +#endif /* __MigTypeCheck */ + + *securitydCreds = TrailerP->msgh_sender; + + *rcode = Out0P->rcode; + + *attempts = Out0P->attempts; + + return KERN_SUCCESS; +} diff --git a/OSX/libsecurityd/mig/ucspNotify.h b/OSX/libsecurityd/mig/ucspNotify.h new file mode 100755 index 00000000..1460d4a2 --- /dev/null +++ b/OSX/libsecurityd/mig/ucspNotify.h @@ -0,0 +1,192 @@ +#ifndef _ucsp_notify_user_ +#define _ucsp_notify_user_ + +/* Module ucsp_notify */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* BEGIN VOUCHER CODE */ + +#ifndef KERNEL +#if defined(__has_include) +#if __has_include() +#ifndef USING_VOUCHERS +#define USING_VOUCHERS +#endif +#ifndef __VOUCHER_FORWARD_TYPE_DECLS__ +#define __VOUCHER_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif // __VOUCHER_FORWARD_TYPE_DECLS__ +#endif // __has_include() +#endif // __has_include +#endif // !KERNEL + +/* END VOUCHER CODE */ + + +/* BEGIN MIG_STRNCPY_ZEROFILL CODE */ + +#if defined(__has_include) +#if __has_include() +#ifndef USING_MIG_STRNCPY_ZEROFILL +#define USING_MIG_STRNCPY_ZEROFILL +#endif +#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ +#ifdef __cplusplus +extern "C" { +#endif + extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); +#ifdef __cplusplus +} +#endif +#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ +#endif /* __has_include() */ +#endif /* __has_include */ + +/* END MIG_STRNCPY_ZEROFILL CODE */ + + +#ifdef AUTOTEST +#ifndef FUNCTION_PTR_T +#define FUNCTION_PTR_T +typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); +typedef struct { + char *name; + function_ptr_t function; +} function_table_entry; +typedef function_table_entry *function_table_t; +#endif /* FUNCTION_PTR_T */ +#endif /* AUTOTEST */ + +#ifndef ucsp_notify_MSG_COUNT +#define ucsp_notify_MSG_COUNT 1 +#endif /* ucsp_notify_MSG_COUNT */ + +#include +#include +#include +#include +#include + +#ifdef __BeforeMigUserHeader +__BeforeMigUserHeader +#endif /* __BeforeMigUserHeader */ + +#include +__BEGIN_DECLS + + +/* SimpleRoutine notify */ +#ifdef mig_external +mig_external +#else +extern +#endif /* mig_external */ +kern_return_t ucsp_notify_sender_notify +( + mach_port_t receiver, + uint32 domain, + uint32 event, + Data data, + mach_msg_type_number_t dataCnt, + uint32 sender +); + +__END_DECLS + +/********************** Caution **************************/ +/* The following data types should be used to calculate */ +/* maximum message sizes only. The actual message may be */ +/* smaller, and the position of the arguments within the */ +/* message layout may vary from what is presented here. */ +/* For example, if any of the arguments are variable- */ +/* sized, and less than the maximum is sent, the data */ +/* will be packed tight in the actual message to reduce */ +/* the presence of holes. */ +/********************** Caution **************************/ + +/* typedefs for all requests */ + +#ifndef __Request__ucsp_notify_subsystem__defined +#define __Request__ucsp_notify_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 domain; + uint32 event; + mach_msg_type_number_t dataCnt; + uint32 sender; + } __Request__notify_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Request__ucsp_notify_subsystem__defined */ + +/* union of all requests */ + +#ifndef __RequestUnion__ucsp_notify_sender_ucsp_notify_subsystem__defined +#define __RequestUnion__ucsp_notify_sender_ucsp_notify_subsystem__defined +union __RequestUnion__ucsp_notify_sender_ucsp_notify_subsystem { + __Request__notify_t Request_ucsp_notify_sender_notify; +}; +#endif /* !__RequestUnion__ucsp_notify_sender_ucsp_notify_subsystem__defined */ +/* typedefs for all replies */ + +#ifndef __Reply__ucsp_notify_subsystem__defined +#define __Reply__ucsp_notify_subsystem__defined + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + NDR_record_t NDR; + kern_return_t RetCode; + } __Reply__notify_t __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif +#endif /* !__Reply__ucsp_notify_subsystem__defined */ + +/* union of all replies */ + +#ifndef __ReplyUnion__ucsp_notify_sender_ucsp_notify_subsystem__defined +#define __ReplyUnion__ucsp_notify_sender_ucsp_notify_subsystem__defined +union __ReplyUnion__ucsp_notify_sender_ucsp_notify_subsystem { + __Reply__notify_t Reply_ucsp_notify_sender_notify; +}; +#endif /* !__RequestUnion__ucsp_notify_sender_ucsp_notify_subsystem__defined */ + +#ifndef subsystem_to_name_map_ucsp_notify +#define subsystem_to_name_map_ucsp_notify \ + { "notify", 10000 } +#endif + +#ifdef __AfterMigUserHeader +__AfterMigUserHeader +#endif /* __AfterMigUserHeader */ + +#endif /* _ucsp_notify_user_ */ diff --git a/OSX/libsecurityd/mig/ucspNotifySender.cpp b/OSX/libsecurityd/mig/ucspNotifySender.cpp new file mode 100755 index 00000000..3577c165 --- /dev/null +++ b/OSX/libsecurityd/mig/ucspNotifySender.cpp @@ -0,0 +1,221 @@ +/* + * IDENTIFICATION: + * stub generated Mon Jul 3 19:46:45 2017 + * with a MiG generated by bootstrap_cmds-96.20.2 + * OPTIONS: + */ +#define __MIG_check__Reply__ucsp_notify_subsystem__ 1 + +#include "ucspNotify.h" + + +#ifndef mig_internal +#define mig_internal static __inline__ +#endif /* mig_internal */ + +#ifndef mig_external +#define mig_external +#endif /* mig_external */ + +#if !defined(__MigTypeCheck) && defined(TypeCheck) +#define __MigTypeCheck TypeCheck /* Legacy setting */ +#endif /* !defined(__MigTypeCheck) */ + +#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) +#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ +#endif /* !defined(__MigKernelSpecificCode) */ + +#ifndef LimitCheck +#define LimitCheck 0 +#endif /* LimitCheck */ + +#ifndef min +#define min(a,b) ( ((a) < (b))? (a): (b) ) +#endif /* min */ + +#if !defined(_WALIGN_) +#define _WALIGN_(x) (((x) + 3) & ~3) +#endif /* !defined(_WALIGN_) */ + +#if !defined(_WALIGNSZ_) +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) +#endif /* !defined(_WALIGNSZ_) */ + +#ifndef UseStaticTemplates +#define UseStaticTemplates 0 +#endif /* UseStaticTemplates */ + +#ifndef __MachMsgErrorWithTimeout +#define __MachMsgErrorWithTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_DATA: \ + case MACH_SEND_INVALID_DEST: \ + case MACH_SEND_INVALID_HEADER: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + break; \ + case MACH_SEND_TIMED_OUT: \ + case MACH_RCV_TIMED_OUT: \ + default: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithTimeout */ + +#ifndef __MachMsgErrorWithoutTimeout +#define __MachMsgErrorWithoutTimeout(_R_) { \ + switch (_R_) { \ + case MACH_SEND_INVALID_DATA: \ + case MACH_SEND_INVALID_DEST: \ + case MACH_SEND_INVALID_HEADER: \ + mig_put_reply_port(InP->Head.msgh_reply_port); \ + break; \ + default: \ + mig_dealloc_reply_port(InP->Head.msgh_reply_port); \ + } \ +} +#endif /* __MachMsgErrorWithoutTimeout */ + +#ifndef __DeclareSendRpc +#define __DeclareSendRpc(_NUM_, _NAME_) +#endif /* __DeclareSendRpc */ + +#ifndef __BeforeSendRpc +#define __BeforeSendRpc(_NUM_, _NAME_) +#endif /* __BeforeSendRpc */ + +#ifndef __AfterSendRpc +#define __AfterSendRpc(_NUM_, _NAME_) +#endif /* __AfterSendRpc */ + +#ifndef __DeclareSendSimple +#define __DeclareSendSimple(_NUM_, _NAME_) +#endif /* __DeclareSendSimple */ + +#ifndef __BeforeSendSimple +#define __BeforeSendSimple(_NUM_, _NAME_) +#endif /* __BeforeSendSimple */ + +#ifndef __AfterSendSimple +#define __AfterSendSimple(_NUM_, _NAME_) +#endif /* __AfterSendSimple */ + +#define msgh_request_port msgh_remote_port +#define msgh_reply_port msgh_local_port + + + +/* SimpleRoutine notify */ +mig_external kern_return_t ucsp_notify_sender_notify +( + mach_port_t receiver, + uint32 domain, + uint32 event, + Data data, + mach_msg_type_number_t dataCnt, + uint32 sender +) +{ + +#ifdef __MigPackStructs +#pragma pack(4) +#endif + typedef struct { + mach_msg_header_t Head; + /* start of the kernel processed data */ + mach_msg_body_t msgh_body; + mach_msg_ool_descriptor_t data; + /* end of the kernel processed data */ + NDR_record_t NDR; + uint32 domain; + uint32 event; + mach_msg_type_number_t dataCnt; + uint32 sender; + } Request __attribute__((unused)); +#ifdef __MigPackStructs +#pragma pack() +#endif + /* + * typedef struct { + * mach_msg_header_t Head; + * NDR_record_t NDR; + * kern_return_t RetCode; + * } mig_reply_error_t; + */ + + union { + Request In; + } Mess; + + Request *InP = &Mess.In; + + mach_msg_return_t msg_result; + +#ifdef __MIG_check__Reply__notify_t__defined + kern_return_t check_result; +#endif /* __MIG_check__Reply__notify_t__defined */ + + __DeclareSendSimple(10000, "notify") + +#if UseStaticTemplates + const static mach_msg_ool_descriptor_t dataTemplate = { + /* addr = */ (void *)0, + /* size = */ 0, + /* deal = */ FALSE, + /* copy = */ MACH_MSG_VIRTUAL_COPY, + /* pad2 = */ 0, + /* type = */ MACH_MSG_OOL_DESCRIPTOR, + }; +#endif /* UseStaticTemplates */ + + InP->msgh_body.msgh_descriptor_count = 1; +#if UseStaticTemplates + InP->data = dataTemplate; + InP->data.address = (void *)(data); + InP->data.size = dataCnt; +#else /* UseStaticTemplates */ + InP->data.address = (void *)(data); + InP->data.size = dataCnt; + InP->data.deallocate = FALSE; + InP->data.copy = MACH_MSG_VIRTUAL_COPY; + InP->data.type = MACH_MSG_OOL_DESCRIPTOR; +#endif /* UseStaticTemplates */ + + InP->NDR = NDR_record; + + InP->domain = domain; + + InP->event = event; + + InP->dataCnt = dataCnt; + + InP->sender = sender; + + InP->Head.msgh_bits = MACH_MSGH_BITS_COMPLEX| + MACH_MSGH_BITS(19, 0); + /* msgh_size passed as argument */ + InP->Head.msgh_request_port = receiver; + InP->Head.msgh_reply_port = MACH_PORT_NULL; + InP->Head.msgh_id = 10000; + InP->Head.msgh_reserved = 0; + +/* BEGIN VOUCHER CODE */ + +#ifdef USING_VOUCHERS + if (voucher_mach_msg_set != NULL) { + voucher_mach_msg_set(&InP->Head); + } +#endif // USING_VOUCHERS + +/* END VOUCHER CODE */ + + __BeforeSendSimple(10000, "notify") + msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_SEND_TIMEOUT|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, 0, MACH_PORT_NULL); + __AfterSendSimple(10000, "notify") + + if (msg_result == MACH_SEND_TIMED_OUT) { + if((vm_offset_t) InP->data.address != (vm_offset_t) data) + mig_deallocate((vm_offset_t) InP->data.address, (vm_size_t) InP->data.size); + } + + return msg_result; +} diff --git a/OSX/utilities/CMakeLists.txt b/OSX/utilities/CMakeLists.txt new file mode 100644 index 00000000..98914be2 --- /dev/null +++ b/OSX/utilities/CMakeLists.txt @@ -0,0 +1,41 @@ +add_compile_options( + -fobjc-arc +) + +add_library(libutilities OBJECT + src/debugging.c + src/der_dictionary.c + src/iCloudKeychainTrace.c + src/SecCFWrappers.c + src/SecADWrapper.c + src/der_date.c + src/fileIo.c + src/SecFileLocations.c + src/SecDb.c + src/SecCoreCrypto.c + src/SecAppleAnchor.c + src/iOSforOSX-SecAttr.c + src/SecTrace.c + src/der_plist_internal.c + src/SecSCTUtils.c + src/der_number.c + src/iOSforOSX-SecRandom.c + src/SecCFError.c + src/der_plist.c + src/SecCertificateTrace.c + src/SecAKSWrappers.c + src/der_array.c + src/SecCFCCWrappers.c + src/NSURL+SOSPlistStore.m + src/der_string.c + src/der_boolean.c + src/der_data.c + src/der_null.c + src/der_set.c + src/simulate_crash.c + src/SecBuffer.c + src/SecXPCError.c + SecurityTool/not_on_this_platorm.c + SecurityTool/readline.c +) +make_fat(libutilities) diff --git a/include/Security/SecRandomP.h b/include/Security/SecRandomP.h new file mode 120000 index 00000000..aa7fa911 --- /dev/null +++ b/include/Security/SecRandomP.h @@ -0,0 +1 @@ +../../OSX/libsecurity_keychain/lib/SecRandomP.h \ No newline at end of file diff --git a/include/Security/sslTypes.h b/include/Security/sslTypes.h new file mode 120000 index 00000000..0436edfb --- /dev/null +++ b/include/Security/sslTypes.h @@ -0,0 +1 @@ +../../OSX/libsecurity_ssl/lib/sslTypes.h \ No newline at end of file diff --git a/include/Security/tsaTemplates.h b/include/Security/tsaTemplates.h new file mode 120000 index 00000000..a0a5b1bf --- /dev/null +++ b/include/Security/tsaTemplates.h @@ -0,0 +1 @@ +../../OSX/libsecurity_smime/lib/tsaTemplates.h \ No newline at end of file diff --git a/internal-include/msgtracer_client.h b/internal-include/msgtracer_client.h new file mode 100644 index 00000000..8a3c8fa7 --- /dev/null +++ b/internal-include/msgtracer_client.h @@ -0,0 +1,8 @@ +#ifndef __MSGTRACER_CLIENT_H__ +#define __MSGTRACER_CLIENT_H__ + +#include + +extern void _msgtracer_log_with_keys(char *key1, int value1, char *key2, char *value2, char *key3, char *value3, void *end); + +#endif