]>
Commit | Line | Data |
---|---|---|
b1ab9ed8 A |
1 | /* |
2 | * Copyright (c) 2000-2001 Apple Computer, 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 BSAFE_CSP_ENABLE | |
72 | AppleCSPAlgorithmFactory *bSafe4Factory; // actually subclasses not visible | |
73 | // in this header | |
74 | #endif | |
75 | #ifdef CRYPTKIT_CSP_ENABLE | |
76 | AppleCSPAlgorithmFactory *cryptKitFactory; | |
77 | #endif | |
78 | AppleCSPAlgorithmFactory *miscAlgFactory; | |
79 | #ifdef ASC_CSP_ENABLE | |
80 | AppleCSPAlgorithmFactory *ascAlgFactory; | |
81 | #endif | |
82 | AppleCSPAlgorithmFactory *rsaDsaAlgFactory; | |
83 | AppleCSPAlgorithmFactory *dhAlgFactory; | |
84 | }; | |
85 | ||
86 | ||
87 | #endif //_APPLE_CSP_H_ |