]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_apple_csp/lib/AppleCSP.h
Security-59306.11.20.tar.gz
[apple/security.git] / OSX / libsecurity_apple_csp / lib / AppleCSP.h
1 /*
2 * Copyright (c) 2000-2001,2011,2014 Apple Inc. All Rights Reserved.
3 *
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
8 * using this file.
9 *
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.
16 */
17
18
19 //
20 // AppleCSP.h - top-level plugin and session classes
21 //
22 #ifndef _APPLE_CSP_H_
23 #define _APPLE_CSP_H_
24
25 #include <security_cdsa_plugin/cssmplugin.h>
26 #include <security_cdsa_plugin/pluginsession.h>
27 #include <security_cdsa_plugin/CSPsession.h>
28
29 class AppleCSPSession;
30 class AppleCSPContext;
31
32 /*
33 * AppleCSP-specific algorithm factory.
34 */
35 class AppleCSPAlgorithmFactory {
36 public:
37 AppleCSPAlgorithmFactory() {};
38 virtual ~AppleCSPAlgorithmFactory() { };
39
40 // set ctx and return true if you can handle this
41 virtual bool setup(
42 AppleCSPSession &session,
43 CSPFullPluginSession::CSPContext * &cspCtx,
44 const Context &context) = 0;
45
46 /* probably other setup methods, e.g. by CSSM_ALGORITHMS instead of
47 * context */
48 };
49
50 class AppleCSPPlugin : public CssmPlugin {
51 friend class AppleCSPSession;
52 friend class AppleCSPContext;
53
54 public:
55 AppleCSPPlugin();
56 ~AppleCSPPlugin();
57
58 PluginSession *makeSession(CSSM_MODULE_HANDLE handle,
59 const CSSM_VERSION &version,
60 uint32 subserviceId,
61 CSSM_SERVICE_TYPE subserviceType,
62 CSSM_ATTACH_FLAGS attachFlags,
63 const CSSM_UPCALLS &upcalls);
64
65 Allocator &normAlloc() {return normAllocator; }
66 Allocator &privAlloc() {return privAllocator; }
67
68 private:
69 Allocator &normAllocator;
70 Allocator &privAllocator;
71 #ifdef CRYPTKIT_CSP_ENABLE
72 AppleCSPAlgorithmFactory *cryptKitFactory;
73 #endif
74 AppleCSPAlgorithmFactory *miscAlgFactory;
75 #ifdef ASC_CSP_ENABLE
76 AppleCSPAlgorithmFactory *ascAlgFactory;
77 #endif
78 AppleCSPAlgorithmFactory *rsaDsaAlgFactory;
79 AppleCSPAlgorithmFactory *dhAlgFactory;
80 };
81
82
83 #endif //_APPLE_CSP_H_