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 * AppleX509CLSession.cpp - general CL session support
23 #include "AppleX509CLSession.h"
24 #include <security_utilities/debugging.h>
26 AppleX509CLSession::AppleX509CLSession(
27 CSSM_MODULE_HANDLE theHandle
,
29 const CSSM_VERSION
&version
,
31 CSSM_SERVICE_TYPE subserviceType
,
32 CSSM_ATTACH_FLAGS attachFlags
,
33 const CSSM_UPCALLS
&upcalls
)
34 : CLPluginSession(theHandle
, plug
, version
, subserviceId
,
35 subserviceType
,attachFlags
, upcalls
)
39 AppleX509CLSession::~AppleX509CLSession()
41 /* free leftover contents of cache and query maps */
42 CLCachedEntry
*cachedCert
= cacheMap
.removeFirstEntry();
43 while(cachedCert
!= NULL
) {
44 secinfo("clDetach", "CL detach: deleting a cached Cert\n");
46 cachedCert
= cacheMap
.removeFirstEntry();
48 CLQuery
*query
= queryMap
.removeFirstEntry();
49 while(query
!= NULL
) {
50 secinfo("clDetach", "CL detach: deleting a cached query\n");
52 query
= queryMap
.removeFirstEntry();
57 AppleX509CLSession::lookupCachedCert(CSSM_HANDLE handle
)
59 CLCachedEntry
*entry
= cacheMap
.lookupEntry(handle
);
62 * we rely on this dynamic cast to detect a bogus lookup
63 * of a cert via a CRL's handle
65 return dynamic_cast<CLCachedCert
*>(entry
);
73 AppleX509CLSession::lookupCachedCRL(CSSM_HANDLE handle
)
75 CLCachedEntry
*entry
= cacheMap
.lookupEntry(handle
);
78 * we rely on this dynamic cast to detect a bogus lookup
79 * of a CRL via a cert's handle
81 return dynamic_cast<CLCachedCRL
*>(entry
);