| OLD | NEW |
| 1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
| 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 3 * | 3 * |
| 4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
| 5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
| 6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
| 7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
| 8 * | 8 * |
| 9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
| 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * under the terms of either the GPL or the LGPL, and not to allow others to | 28 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 29 * use your version of this file under the terms of the MPL, indicate your | 29 * use your version of this file under the terms of the MPL, indicate your |
| 30 * decision by deleting the provisions above and replace them with the notice | 30 * decision by deleting the provisions above and replace them with the notice |
| 31 * and other provisions required by the GPL or the LGPL. If you do not delete | 31 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 32 * the provisions above, a recipient may use your version of this file under | 32 * the provisions above, a recipient may use your version of this file under |
| 33 * the terms of any one of the MPL, the GPL or the LGPL. | 33 * the terms of any one of the MPL, the GPL or the LGPL. |
| 34 * | 34 * |
| 35 * ***** END LICENSE BLOCK ***** */ | 35 * ***** END LICENSE BLOCK ***** */ |
| 36 | 36 |
| 37 #ifdef DEBUG | 37 #ifdef DEBUG |
| 38 static const char CVS_ID[] = "@(#) $RCSfile: devutil.c,v $ $Revision: 1.33 $ $Da
te: 2008/11/19 20:44:35 $"; | 38 static const char CVS_ID[] = "@(#) $RCSfile: devutil.c,v $ $Revision: 1.35 $ $Da
te: 2010/04/11 05:57:47 $"; |
| 39 #endif /* DEBUG */ | 39 #endif /* DEBUG */ |
| 40 | 40 |
| 41 #ifndef DEVM_H | 41 #ifndef DEVM_H |
| 42 #include "devm.h" | 42 #include "devm.h" |
| 43 #endif /* DEVM_H */ | 43 #endif /* DEVM_H */ |
| 44 | 44 |
| 45 #ifndef CKHELPER_H | 45 #ifndef CKHELPER_H |
| 46 #include "ckhelper.h" | 46 #include "ckhelper.h" |
| 47 #endif /* CKHELPER_H */ | 47 #endif /* CKHELPER_H */ |
| 48 | 48 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 rvCache->lock = PZ_NewLock(nssILockOther); /* XXX */ | 257 rvCache->lock = PZ_NewLock(nssILockOther); /* XXX */ |
| 258 if (!rvCache->lock) { | 258 if (!rvCache->lock) { |
| 259 goto loser; | 259 goto loser; |
| 260 } | 260 } |
| 261 rvCache->doObjectType[cachedCerts] = cacheCerts; | 261 rvCache->doObjectType[cachedCerts] = cacheCerts; |
| 262 rvCache->doObjectType[cachedTrust] = cacheTrust; | 262 rvCache->doObjectType[cachedTrust] = cacheTrust; |
| 263 rvCache->doObjectType[cachedCRLs] = cacheCRLs; | 263 rvCache->doObjectType[cachedCRLs] = cacheCRLs; |
| 264 rvCache->token = token; /* cache goes away with token */ | 264 rvCache->token = token; /* cache goes away with token */ |
| 265 return rvCache; | 265 return rvCache; |
| 266 loser: | 266 loser: |
| 267 nssTokenObjectCache_Destroy(rvCache); |
| 267 return (nssTokenObjectCache *)NULL; | 268 return (nssTokenObjectCache *)NULL; |
| 268 } | 269 } |
| 269 | 270 |
| 270 static void | 271 static void |
| 271 clear_cache ( | 272 clear_cache ( |
| 272 nssTokenObjectCache *cache | 273 nssTokenObjectCache *cache |
| 273 ) | 274 ) |
| 274 { | 275 { |
| 275 nssCryptokiObjectAndAttributes **oa; | 276 nssCryptokiObjectAndAttributes **oa; |
| 276 PRUint32 objectType; | 277 PRUint32 objectType; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 302 } | 303 } |
| 303 } | 304 } |
| 304 | 305 |
| 305 NSS_IMPLEMENT void | 306 NSS_IMPLEMENT void |
| 306 nssTokenObjectCache_Destroy ( | 307 nssTokenObjectCache_Destroy ( |
| 307 nssTokenObjectCache *cache | 308 nssTokenObjectCache *cache |
| 308 ) | 309 ) |
| 309 { | 310 { |
| 310 if (cache) { | 311 if (cache) { |
| 311 clear_cache(cache); | 312 clear_cache(cache); |
| 312 » PZ_DestroyLock(cache->lock); | 313 » if (cache->lock) { |
| 314 » PZ_DestroyLock(cache->lock); |
| 315 » } |
| 313 nss_ZFreeIf(cache); | 316 nss_ZFreeIf(cache); |
| 314 } | 317 } |
| 315 } | 318 } |
| 316 | 319 |
| 317 NSS_IMPLEMENT PRBool | 320 NSS_IMPLEMENT PRBool |
| 318 nssTokenObjectCache_HaveObjectClass ( | 321 nssTokenObjectCache_HaveObjectClass ( |
| 319 nssTokenObjectCache *cache, | 322 nssTokenObjectCache *cache, |
| 320 CK_OBJECT_CLASS objclass | 323 CK_OBJECT_CLASS objclass |
| 321 ) | 324 ) |
| 322 { | 325 { |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 for (oi=0; oi<(PRIntn)numMatches; oi++) { | 732 for (oi=0; oi<(PRIntn)numMatches; oi++) { |
| 730 objects[oi] = nssCryptokiObject_Clone(matches[oi]->object); | 733 objects[oi] = nssCryptokiObject_Clone(matches[oi]->object); |
| 731 if (!objects[oi]) { | 734 if (!objects[oi]) { |
| 732 goto loser; | 735 goto loser; |
| 733 } | 736 } |
| 734 } | 737 } |
| 735 } | 738 } |
| 736 nssArena_Destroy(arena); | 739 nssArena_Destroy(arena); |
| 737 return objects; | 740 return objects; |
| 738 loser: | 741 loser: |
| 739 if (objects) { | 742 nssCryptokiObjectArray_Destroy(objects); |
| 740 » for (--oi; oi>=0; --oi) { | |
| 741 » nssCryptokiObject_Destroy(objects[oi]); | |
| 742 » } | |
| 743 } | |
| 744 nssArena_Destroy(arena); | 743 nssArena_Destroy(arena); |
| 745 return (nssCryptokiObject **)NULL; | 744 return (nssCryptokiObject **)NULL; |
| 746 } | 745 } |
| 747 | 746 |
| 748 NSS_IMPLEMENT nssCryptokiObject ** | 747 NSS_IMPLEMENT nssCryptokiObject ** |
| 749 nssTokenObjectCache_FindObjectsByTemplate ( | 748 nssTokenObjectCache_FindObjectsByTemplate ( |
| 750 nssTokenObjectCache *cache, | 749 nssTokenObjectCache *cache, |
| 751 CK_OBJECT_CLASS objclass, | 750 CK_OBJECT_CLASS objclass, |
| 752 CK_ATTRIBUTE_PTR otemplate, | 751 CK_ATTRIBUTE_PTR otemplate, |
| 753 CK_ULONG otlen, | 752 CK_ULONG otlen, |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 NSSAlgorithmAndParameters *rvAP = NULL; | 1033 NSSAlgorithmAndParameters *rvAP = NULL; |
| 1035 rvAP = nss_ZNEW(arenaOpt, NSSAlgorithmAndParameters); | 1034 rvAP = nss_ZNEW(arenaOpt, NSSAlgorithmAndParameters); |
| 1036 if (rvAP) { | 1035 if (rvAP) { |
| 1037 rvAP->mechanism.mechanism = CKM_MD5; | 1036 rvAP->mechanism.mechanism = CKM_MD5; |
| 1038 rvAP->mechanism.pParameter = NULL; | 1037 rvAP->mechanism.pParameter = NULL; |
| 1039 rvAP->mechanism.ulParameterLen = 0; | 1038 rvAP->mechanism.ulParameterLen = 0; |
| 1040 } | 1039 } |
| 1041 return rvAP; | 1040 return rvAP; |
| 1042 } | 1041 } |
| 1043 | 1042 |
| OLD | NEW |