2 * Copyright (c) 2000-2001,2011,2014 Apple Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 // AppleCSP.h - top-level plugin and session classes
25 #include <security_cdsa_plugin/cssmplugin.h>
26 #include <security_cdsa_plugin/pluginsession.h>
27 #include <security_cdsa_plugin/CSPsession.h>
29 class AppleCSPSession
;
30 class AppleCSPContext
;
33 * AppleCSP-specific algorithm factory.
35 class AppleCSPAlgorithmFactory
{
37 AppleCSPAlgorithmFactory() {};
38 virtual ~AppleCSPAlgorithmFactory() { };
40 // set ctx and return true if you can handle this
42 AppleCSPSession
&session
,
43 CSPFullPluginSession::CSPContext
* &cspCtx
,
44 const Context
&context
) = 0;
46 /* probably other setup methods, e.g. by CSSM_ALGORITHMS instead of
50 class AppleCSPPlugin
: public CssmPlugin
{
51 friend class AppleCSPSession
;
52 friend class AppleCSPContext
;
58 PluginSession
*makeSession(CSSM_MODULE_HANDLE handle
,
59 const CSSM_VERSION
&version
,
61 CSSM_SERVICE_TYPE subserviceType
,
62 CSSM_ATTACH_FLAGS attachFlags
,
63 const CSSM_UPCALLS
&upcalls
);
65 Allocator
&normAlloc() {return normAllocator
; }
66 Allocator
&privAlloc() {return privAllocator
; }
69 Allocator
&normAllocator
;
70 Allocator
&privAllocator
;
71 #ifdef BSAFE_CSP_ENABLE
72 AppleCSPAlgorithmFactory
*bSafe4Factory
; // actually subclasses not visible
75 #ifdef CRYPTKIT_CSP_ENABLE
76 AppleCSPAlgorithmFactory
*cryptKitFactory
;
78 AppleCSPAlgorithmFactory
*miscAlgFactory
;
80 AppleCSPAlgorithmFactory
*ascAlgFactory
;
82 AppleCSPAlgorithmFactory
*rsaDsaAlgFactory
;
83 AppleCSPAlgorithmFactory
*dhAlgFactory
;
87 #endif //_APPLE_CSP_H_