2 * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
25 * dotMacTpAttach.cpp - attach/detach to/from loadable .mac TP
28 #include "dotMacTpAttach.h"
29 #include <Security/Security.h>
31 /* SPI; the framework actually contains a static lib we link against */
32 #include <security_cdsa_utils/cuCdsaUtils.h>
34 static CSSM_VERSION vers
= {2, 0};
35 static const CSSM_GUID dummyGuid
= { 0xFADE, 0, 0, { 1,2,3,4,5,6,7,0 }};
37 static CSSM_API_MEMORY_FUNCS memFuncs
= {
45 /* load & attach; returns 0 on error */
46 CSSM_TP_HANDLE
dotMacTpAttach()
48 CSSM_TP_HANDLE tpHand
;
51 if(cuCssmStartup() == CSSM_FALSE
) {
54 crtn
= CSSM_ModuleLoad(&gGuidAppleDotMacTP
,
55 CSSM_KEY_HIERARCHY_NONE
,
57 NULL
); // AppNotifyCallbackCtx
59 cuPrintError("CSSM_ModuleLoad(AppleTP)", crtn
);
62 crtn
= CSSM_ModuleAttach (&gGuidAppleDotMacTP
,
64 &memFuncs
, // memFuncs
66 CSSM_SERVICE_TP
, // SubserviceFlags
68 CSSM_KEY_HIERARCHY_NONE
,
69 NULL
, // FunctionTable
74 cuPrintError("CSSM_ModuleAttach(AppleTP)", crtn
);
83 void dotMacTpDetach(CSSM_TP_HANDLE tpHand
)
85 CSSM_RETURN crtn
= CSSM_ModuleDetach(tpHand
);
89 CSSM_ModuleUnload(&gGuidAppleDotMacTP
, NULL
, NULL
);