1/*
2 * Copyright (c) 2007 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*!
25	@header SecCodeHostLib
26	This header provides a subset of the hosting API for Code Signing.
27	This subset functionality is implemented as a static library written
28	entirely in C, and depends on nothing except the system library and the
29	C runtime. It is thus suitable to be used by low-level libraries and
30	other such system facilities. On the other hand, it does not provide the
31	full functionality of <Security/SecCodeHost.h>.
32
33	This file is documented as a delta to <Security/SecCodeHost.h>, which
34	you should consult as a baseline.
35*/
36#ifndef _H_SECCODEHOSTLIB
37#define _H_SECCODEHOSTLIB
38
39#include <Security/SecCodeHost.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45
46/*!
47	@function SecHostLibInit
48	This function must be called first to use the SecCodeHostLib facility.
49 */
50OSStatus SecHostLibInit(SecCSFlags flags);
51
52
53/*!
54	@function SecHostLibCreateGuest
55	This function declares a code host, engages hosting proxy services for it,
56	and creates a guest with given attributes and state.
57
58	NOTE: This version of the function currently only supports dedicated hosting.
59	If you do not pass the kSecCSDedicatedHost flag, the call will fail.
60 */
61OSStatus SecHostLibCreateGuest(SecGuestRef host,
62	uint32_t status, const char *path, const char *attributeXML,
63	SecCSFlags flags, SecGuestRef *newGuest) DEPRECATED_ATTRIBUTE;
64
65OSStatus SecHostLibCreateGuest2(SecGuestRef host,
66	uint32_t status, const char *path, const void *cdhash, size_t cdhashLength, const char *attributeXML,
67	SecCSFlags flags, SecGuestRef *newGuest);
68
69
70/*!
71	@function SecHostLibSetGuestStatus
72	This function can change the state or attributes (or both) of a given guest.
73	It performs all the work of SecHostSetGuestStatus.
74 */
75OSStatus SecHostLibSetGuestStatus(SecGuestRef guestRef,
76	uint32_t status, const char *attributeXML,
77	SecCSFlags flags);
78
79
80/*!
81	@function SecHostLibSetHostingPort
82	Register a Mach port to receive hosting queries on. This enables (and locks)
83	dynamic hosting mode, and is incompatible with all proxy-mode calls.
84	You still must call SecHostLibInit first.
85 */
86OSStatus SecHostSetHostingPort(mach_port_t hostingPort, SecCSFlags flags);
87
88
89/*
90	Functionality from SecCodeHost.h that is genuinely missing here:
91
92OSStatus SecHostRemoveGuest(SecGuestRef host, SecGuestRef guest, SecCSFlags flags);
93
94OSStatus SecHostSelectGuest(SecGuestRef guestRef, SecCSFlags flags);
95
96OSStatus SecHostSelectedGuest(SecCSFlags flags, SecGuestRef *guestRef);
97
98*/
99
100
101/*!
102 */
103OSStatus SecHostLibCheckLoad(const char *path, SecRequirementType type);
104
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif //_H_SECCODEHOSTLIB
111