2 * Copyright (c) 2003-2010 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #include <Security/SecBasePriv.h>
25 #include <Security/SecKeychainPriv.h>
26 #include <security_utilities/threading.h>
27 #include "SecBridge.h"
29 static CFStringRef
copyErrorMessageFromBundle(OSStatus status
,CFStringRef tableName
);
31 // caller MUST release the string, since it is gotten with "CFCopyLocalizedStringFromTableInBundle"
32 // intended use of reserved param is to pass in CFStringRef with name of the Table for lookup
33 // Will look by default in "SecErrorMessages.strings" in the resources of Security.framework.
37 SecCopyErrorMessageString(OSStatus status
, void *reserved
)
41 CFStringRef result
= copyErrorMessageFromBundle(status
,CFSTR("SecErrorMessages"));
43 result
= copyErrorMessageFromBundle(status
,CFSTR("SecDebugErrorMessages"));
47 if (status
>= errSecErrnoBase
&& status
<= errSecErrnoLimit
)
49 result
= CFStringCreateWithFormat (NULL
, NULL
, CFSTR("UNIX[%s]"), strerror(status
-errSecErrnoBase
));
53 // no error message found, so format a faked-up error message from the status
54 result
= CFStringCreateWithFormat(NULL
, NULL
, CFSTR("OSStatus %d"), status
);
68 cssmPerror(const char *how
, CSSM_RETURN error
)
72 const char* errMsg
= cssmErrorString(error
);
73 fprintf(stderr
, "%s: %s\n", how
? how
: "error", errMsg
);
77 fprintf(stderr
, "failed to print error: %lu\n", (unsigned long)error
);
83 cssmErrorString(CSSM_RETURN error
)
85 static ThreadNexus
<string
> lastError
;
90 if (error
>= errSecErrnoBase
&& error
<= errSecErrnoLimit
)
92 err
= string ("UNIX[") + strerror(error
- errSecErrnoBase
) + "]";
96 CFStringRef result
= copyErrorMessageFromBundle(error
,CFSTR("SecErrorMessages"));
98 result
= copyErrorMessageFromBundle(error
,CFSTR("SecDebugErrorMessages"));
99 err
= cfString(result
, true);
105 snprintf(buf
, sizeof(buf
), "unknown error %ld=%lx", (long) error
, (long) error
);
110 return lastError().c_str();
115 snprintf (buf
, sizeof (buf
), "unknown error %ld=%lx", (long) error
, (long) error
);
117 return lastError().c_str();
122 static ModuleNexus
<Mutex
> gBundleLock
;
125 copyErrorMessageFromBundle(OSStatus status
,CFStringRef tableName
)
127 StLock
<Mutex
> _lock(gBundleLock());
129 CFStringRef errorString
= nil
;
130 CFStringRef keyString
= nil
;
131 CFBundleRef secBundle
= NULL
;
133 // Make a bundle instance using the URLRef.
134 secBundle
= CFBundleGetBundleWithIdentifier(CFSTR("com.apple.security"));
138 // Convert status to Int32 string representation, e.g. "-25924"
139 keyString
= CFStringCreateWithFormat (kCFAllocatorDefault
,NULL
,CFSTR("%d"),status
);
143 errorString
= CFCopyLocalizedStringFromTableInBundle(keyString
,tableName
,secBundle
,NULL
);
144 if (CFStringCompare(errorString
, keyString
, 0)==kCFCompareEqualTo
) // no real error message
147 CFRelease(errorString
);
152 CFRelease(keyString
);
157 /* Convert a possible CSSM type osStatus error to a more Keychain friendly OSStatus. */
158 OSStatus
SecKeychainErrFromOSStatus(OSStatus osStatus
)
160 if (CSSM_ERR_IS_CONVERTIBLE(osStatus
))
162 switch (CSSM_ERRCODE(osStatus
))
164 // CONVERTIBLE ERROR CODES.
165 case CSSM_ERRCODE_SERVICE_NOT_AVAILABLE
:
166 return errSecNotAvailable
;
167 case CSSM_ERRCODE_USER_CANCELED
:
168 return userCanceledErr
;
169 case CSSM_ERRCODE_OPERATION_AUTH_DENIED
:
170 return errSecAuthFailed
;
171 case CSSM_ERRCODE_NO_USER_INTERACTION
:
172 return errSecInteractionNotAllowed
;
173 case CSSM_ERRCODE_IN_DARK_WAKE
:
174 return errSecInDarkWake
;
175 case CSSM_ERRCODE_OS_ACCESS_DENIED
:
177 case CSSM_ERRCODE_INSUFFICIENT_CLIENT_IDENTIFICATION
:
178 return errSecInsufficientClientID
;
179 case CSSM_ERRCODE_DEVICE_RESET
:
180 return errSecDeviceReset
;
181 case CSSM_ERRCODE_DEVICE_FAILED
:
182 return errSecDeviceFailed
;
183 case CSSM_ERRCODE_INTERNAL_ERROR
:
184 return errSecInternalError
;
185 case CSSM_ERRCODE_MEMORY_ERROR
:
186 return errSecMemoryError
;
187 case CSSM_ERRCODE_MDS_ERROR
:
188 return errSecMDSError
;
189 case CSSM_ERRCODE_INVALID_POINTER
:
190 case CSSM_ERRCODE_INVALID_INPUT_POINTER
:
191 case CSSM_ERRCODE_INVALID_OUTPUT_POINTER
:
192 case CSSM_ERRCODE_INVALID_CERTGROUP_POINTER
:
193 case CSSM_ERRCODE_INVALID_CERT_POINTER
:
194 case CSSM_ERRCODE_INVALID_CRL_POINTER
:
195 case CSSM_ERRCODE_INVALID_FIELD_POINTER
:
196 case CSSM_ERRCODE_INVALID_DB_LIST_POINTER
:
197 return errSecInvalidPointer
;
198 case CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED
:
199 return errSecUnimplemented
;
200 case CSSM_ERRCODE_SELF_CHECK_FAILED
:
201 case CSSMERR_CL_SELF_CHECK_FAILED
:
202 case CSSMERR_DL_SELF_CHECK_FAILED
:
203 return errSecSelfCheckFailed
;
204 case CSSM_ERRCODE_FUNCTION_FAILED
:
205 return errSecFunctionFailed
;
206 case CSSM_ERRCODE_MODULE_MANIFEST_VERIFY_FAILED
:
207 return errSecModuleManifestVerifyFailed
;
208 case CSSM_ERRCODE_INVALID_GUID
:
209 return errSecInvalidGUID
;
210 case CSSM_ERRCODE_OBJECT_USE_AUTH_DENIED
:
211 case CSSM_ERRCODE_OBJECT_MANIP_AUTH_DENIED
:
212 return errAuthorizationDenied
;
213 case CSSM_ERRCODE_OBJECT_ACL_NOT_SUPPORTED
:
214 case CSSM_ERRCODE_OBJECT_ACL_REQUIRED
:
215 case CSSM_ERRCODE_INVALID_ACL_SUBJECT_VALUE
:
216 case CSSM_ERRCODE_ACL_SUBJECT_TYPE_NOT_SUPPORTED
:
217 case CSSM_ERRCODE_INVALID_ACL_EDIT_MODE
:
218 case CSSM_ERRCODE_INVALID_NEW_ACL_ENTRY
:
219 case CSSM_ERRCODE_INVALID_NEW_ACL_OWNER
:
220 return errSecInvalidACL
;
221 case CSSM_ERRCODE_INVALID_ACCESS_CREDENTIALS
:
222 return errSecInvalidAccessCredentials
;
223 case CSSM_ERRCODE_INVALID_ACL_BASE_CERTS
:
224 case CSSM_ERRCODE_ACL_BASE_CERTS_NOT_SUPPORTED
:
225 return errSecInvalidCertificateGroup
;
226 case CSSM_ERRCODE_INVALID_SAMPLE_VALUE
:
227 return errSecInvalidSampleValue
;
228 case CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED
:
229 return errSecInvalidSampleValue
;
230 case CSSM_ERRCODE_INVALID_ACL_CHALLENGE_CALLBACK
:
231 return errSecInvalidCallback
;
232 case CSSM_ERRCODE_ACL_CHALLENGE_CALLBACK_FAILED
:
233 return errSecCallbackFailed
;
234 case CSSM_ERRCODE_INVALID_ACL_ENTRY_TAG
:
235 case CSSM_ERRCODE_UNKNOWN_TAG
:
236 return errSecUnknownTag
;
237 case CSSM_ERRCODE_ACL_ENTRY_TAG_NOT_FOUND
:
238 return errSecTagNotFound
;
239 case CSSM_ERRCODE_ACL_CHANGE_FAILED
:
240 return errSecACLChangeFailed
;
241 case CSSM_ERRCODE_ACL_DELETE_FAILED
:
242 return errSecACLDeleteFailed
;
243 case CSSM_ERRCODE_ACL_REPLACE_FAILED
:
244 return errSecACLReplaceFailed
;
245 case CSSM_ERRCODE_ACL_ADD_FAILED
:
246 return errSecACLAddFailed
;
247 case CSSM_ERRCODE_INVALID_CONTEXT_HANDLE
:
248 case CSSM_ERRCODE_INVALID_DB_HANDLE
:
249 case CSSM_ERRCODE_INVALID_CSP_HANDLE
:
250 case CSSM_ERRCODE_INVALID_DL_HANDLE
:
251 case CSSM_ERRCODE_INVALID_CL_HANDLE
:
252 case CSSM_ERRCODE_INVALID_TP_HANDLE
:
253 case CSSM_ERRCODE_INVALID_KR_HANDLE
:
254 case CSSM_ERRCODE_INVALID_AC_HANDLE
:
255 return errSecInvalidHandle
;
256 case CSSM_ERRCODE_INCOMPATIBLE_VERSION
:
257 return errSecIncompatibleVersion
;
258 case CSSM_ERRCODE_INVALID_DATA
:
259 return errSecInvalidData
;
260 case CSSM_ERRCODE_CRL_ALREADY_SIGNED
:
261 return errSecCRLAlreadySigned
;
262 case CSSM_ERRCODE_INVALID_NUMBER_OF_FIELDS
:
263 return errSecInvalidNumberOfFields
;
264 case CSSM_ERRCODE_VERIFICATION_FAILURE
:
265 return errSecVerificationFailure
;
266 case CSSM_ERRCODE_PRIVILEGE_NOT_GRANTED
:
267 return errSecPrivilegeNotGranted
;
268 case CSSM_ERRCODE_INVALID_DB_LIST
:
269 return errSecInvalidDBList
;
270 case CSSM_ERRCODE_UNKNOWN_FORMAT
:
271 return errSecUnknownFormat
;
272 case CSSM_ERRCODE_INVALID_PASSTHROUGH_ID
:
273 return errSecInvalidPassthroughID
;
274 case CSSM_ERRCODE_INVALID_NETWORK_ADDR
:
275 return errSecInvalidNetworkAddress
;
276 case CSSM_ERRCODE_INVALID_CRYPTO_DATA
:
277 return errSecInvalidData
;
282 // Some CSSM errors mapped to OSStatus-type (SnowLeopard and earlier).
284 case CSSMERR_DL_RECORD_NOT_FOUND
:
285 case CSSMERR_APPLETP_CERT_NOT_FOUND_FROM_ISSUER
:
286 case CSSMERR_CSP_PRIVATE_KEY_NOT_FOUND
:
287 return errSecItemNotFound
;
288 case CSSMERR_DL_INVALID_UNIQUE_INDEX_DATA
:
289 case CSSMERR_CSP_PRIVATE_KEY_ALREADY_EXISTS
:
290 case CSSMERR_CSP_KEY_LABEL_ALREADY_EXISTS
:
291 return errSecDuplicateItem
;
292 case CSSMERR_DL_DATABASE_CORRUPT
:
293 return errSecInvalidKeychain
;
294 case CSSMERR_DL_DATASTORE_DOESNOT_EXIST
:
295 return errSecNoSuchKeychain
;
296 case CSSMERR_DL_DATASTORE_ALREADY_EXISTS
:
297 return errSecDuplicateKeychain
;
298 case CSSMERR_APPLEDL_DISK_FULL
:
300 case CSSMERR_DL_INVALID_OPEN_PARAMETERS
:
301 case CSSMERR_APPLEDL_INVALID_OPEN_PARAMETERS
:
302 case CSSMERR_APPLE_DOTMAC_REQ_SERVER_PARAM
:
304 case CSSMERR_DL_INVALID_FIELD_NAME
:
305 case CSSMERR_CSSM_INVALID_ATTRIBUTE
:
306 return errSecNoSuchAttr
;
307 case CSSMERR_DL_OS_ACCESS_DENIED
:
308 case CSSMERR_CSP_OS_ACCESS_DENIED
:
309 case CSSMERR_TP_OS_ACCESS_DENIED
:
310 case CSSMERR_AC_OS_ACCESS_DENIED
:
311 case CSSMERR_CL_OS_ACCESS_DENIED
:
313 case CSSMERR_CSSM_BUFFER_TOO_SMALL
:
314 return errSecBufferTooSmall
;
315 case CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED
:
316 case CSSMERR_CSP_FUNCTION_NOT_IMPLEMENTED
:
317 case CSSMERR_TP_FUNCTION_NOT_IMPLEMENTED
:
318 case CSSMERR_AC_FUNCTION_NOT_IMPLEMENTED
:
319 case CSSMERR_CL_FUNCTION_NOT_IMPLEMENTED
:
320 case CSSMERR_DL_FUNCTION_NOT_IMPLEMENTED
:
321 case CSSMERR_APPLE_DOTMAC_REQ_SERVER_UNIMPL
:
322 return errSecUnimplemented
;
323 case CSSMERR_CSSM_INTERNAL_ERROR
:
324 case CSSMERR_CSP_INTERNAL_ERROR
:
325 case CSSMERR_TP_INTERNAL_ERROR
:
326 case CSSMERR_AC_INTERNAL_ERROR
:
327 case CSSMERR_CL_INTERNAL_ERROR
:
328 case CSSMERR_DL_INTERNAL_ERROR
:
329 return errSecInternalError
;
330 case CSSMERR_CSSM_MEMORY_ERROR
:
331 case CSSMERR_CSP_MEMORY_ERROR
:
332 case CSSMERR_TP_MEMORY_ERROR
:
333 case CSSMERR_AC_MEMORY_ERROR
:
334 case CSSMERR_CSP_DEVICE_MEMORY_ERROR
:
335 case CSSMERR_CL_MEMORY_ERROR
:
336 case CSSMERR_DL_MEMORY_ERROR
:
337 return errSecMemoryError
;
338 case CSSMERR_CSSM_MDS_ERROR
:
339 case CSSMERR_CSP_MDS_ERROR
:
340 case CSSMERR_TP_MDS_ERROR
:
341 case CSSMERR_AC_MDS_ERROR
:
342 case CSSMERR_CL_MDS_ERROR
:
343 case CSSMERR_DL_MDS_ERROR
:
344 return errSecMDSError
;
345 case CSSMERR_CSSM_INVALID_POINTER
:
346 case CSSMERR_CSP_INVALID_POINTER
:
347 case CSSMERR_TP_INVALID_POINTER
:
348 case CSSMERR_AC_INVALID_POINTER
:
349 case CSSMERR_CL_INVALID_POINTER
:
350 case CSSMERR_DL_INVALID_POINTER
:
351 case CSSMERR_CSSM_INVALID_INPUT_POINTER
:
352 case CSSMERR_CSP_INVALID_INPUT_POINTER
:
353 case CSSMERR_TP_INVALID_INPUT_POINTER
:
354 case CSSMERR_AC_INVALID_INPUT_POINTER
:
355 case CSSMERR_CL_INVALID_INPUT_POINTER
:
356 case CSSMERR_DL_INVALID_INPUT_POINTER
:
357 case CSSMERR_TP_INVALID_DB_LIST_POINTER
:
358 case CSSMERR_AC_INVALID_DB_LIST_POINTER
:
359 case CSSMERR_DL_INVALID_DB_LIST_POINTER
:
360 case CSSMERR_TP_INVALID_CERTGROUP_POINTER
:
361 case CSSMERR_TP_INVALID_CERT_POINTER
:
362 case CSSMERR_TP_INVALID_CRL_POINTER
:
363 case CSSMERR_TP_INVALID_FIELD_POINTER
:
364 case CSSMERR_CSP_INVALID_KEY_POINTER
:
365 case CSSMERR_TP_INVALID_CALLERAUTH_CONTEXT_POINTER
:
366 case CSSMERR_TP_INVALID_IDENTIFIER_POINTER
:
367 case CSSMERR_TP_INVALID_CRLGROUP_POINTER
:
368 case CSSMERR_TP_INVALID_TUPLEGROUP_POINTER
:
369 case CSSMERR_CL_INVALID_CERTGROUP_POINTER
:
370 case CSSMERR_CL_INVALID_CERT_POINTER
:
371 case CSSMERR_CL_INVALID_CRL_POINTER
:
372 case CSSMERR_CL_INVALID_FIELD_POINTER
:
373 case CSSMERR_CL_INVALID_BUNDLE_POINTER
:
374 case CSSMERR_CSSM_INVALID_OUTPUT_POINTER
:
375 case CSSMERR_CSP_INVALID_OUTPUT_POINTER
:
376 case CSSMERR_TP_INVALID_OUTPUT_POINTER
:
377 case CSSMERR_AC_INVALID_OUTPUT_POINTER
:
378 case CSSMERR_CL_INVALID_OUTPUT_POINTER
:
379 case CSSMERR_DL_INVALID_OUTPUT_POINTER
:
380 return errSecInvalidPointer
;
381 case CSSMERR_CSSM_FUNCTION_FAILED
:
382 case CSSMERR_CSP_FUNCTION_FAILED
:
383 case CSSMERR_TP_FUNCTION_FAILED
:
384 case CSSMERR_AC_FUNCTION_FAILED
:
385 case CSSMERR_CL_FUNCTION_FAILED
:
386 case CSSMERR_DL_FUNCTION_FAILED
:
387 return errSecFunctionFailed
;
388 case CSSMERR_CSP_INVALID_DATA
:
389 case CSSMERR_TP_INVALID_DATA
:
390 case CSSMERR_AC_INVALID_DATA
:
391 case CSSMERR_CL_INVALID_DATA
:
392 case CSSMERR_CSP_INVALID_CRYPTO_DATA
:
393 case CSSMERR_CSP_INVALID_DATA_COUNT
:
394 case CSSMERR_TP_INVALID_ACTION_DATA
:
395 return errSecInvalidData
;
396 case CSSMERR_TP_INVALID_DB_LIST
:
397 case CSSMERR_AC_INVALID_DB_LIST
:
398 return errSecInvalidDBList
;
399 case CSSMERR_CSP_INVALID_PASSTHROUGH_ID
:
400 case CSSMERR_TP_INVALID_PASSTHROUGH_ID
:
401 case CSSMERR_AC_INVALID_PASSTHROUGH_ID
:
402 case CSSMERR_CL_INVALID_PASSTHROUGH_ID
:
403 case CSSMERR_DL_INVALID_PASSTHROUGH_ID
:
404 return errSecInvalidPassthroughID
;
405 case CSSMERR_TP_INVALID_CSP_HANDLE
:
406 case CSSMERR_TP_INVALID_CL_HANDLE
:
407 case CSSMERR_TP_INVALID_DL_HANDLE
:
408 case CSSMERR_AC_INVALID_TP_HANDLE
:
409 case CSSMERR_AC_INVALID_DL_HANDLE
:
410 case CSSMERR_DL_INVALID_DL_HANDLE
:
411 case CSSMERR_AC_INVALID_CL_HANDLE
:
412 case CSSMERR_DL_INVALID_CL_HANDLE
:
413 case CSSMERR_DL_INVALID_CSP_HANDLE
:
414 case CSSMERR_TP_INVALID_DB_HANDLE
:
415 case CSSMERR_CSSM_INVALID_ADDIN_HANDLE
:
416 case CSSMERR_CSSM_INVALID_CONTEXT_HANDLE
:
417 case CSSMERR_CL_INVALID_CACHE_HANDLE
:
418 case CSSMERR_CL_INVALID_RESULTS_HANDLE
:
419 case CSSMERR_DL_INVALID_RESULTS_HANDLE
:
420 case CSSMERR_TP_INVALID_KEYCACHE_HANDLE
:
421 case CSSMERR_CSP_INVALID_CONTEXT_HANDLE
:
422 case CSSMERR_TP_INVALID_CONTEXT_HANDLE
:
423 case CSSMERR_AC_INVALID_CONTEXT_HANDLE
:
424 case CSSMERR_CL_INVALID_CONTEXT_HANDLE
:
425 return errSecInvalidHandle
;
426 case CSSMERR_TP_CRL_ALREADY_SIGNED
:
427 case CSSMERR_CL_CRL_ALREADY_SIGNED
:
428 return errSecCRLAlreadySigned
;
429 case CSSMERR_TP_INVALID_NUMBER_OF_FIELDS
:
430 case CSSMERR_CL_INVALID_NUMBER_OF_FIELDS
:
431 return errSecInvalidNumberOfFields
;
432 case CSSMERR_TP_VERIFICATION_FAILURE
:
433 case CSSMERR_CL_VERIFICATION_FAILURE
:
434 return errSecVerificationFailure
;
435 case CSSMERR_TP_INVALID_NETWORK_ADDR
:
436 case CSSMERR_DL_INVALID_NETWORK_ADDR
:
437 return errSecInvalidNetworkAddress
;
438 case CSSMERR_TP_UNKNOWN_TAG
:
439 case CSSMERR_CL_UNKNOWN_TAG
:
440 case CSSMERR_CSP_INVALID_ACL_ENTRY_TAG
:
441 case CSSMERR_DL_INVALID_ACL_ENTRY_TAG
:
442 case CSSMERR_DL_INVALID_SELECTION_TAG
:
443 return errSecUnknownTag
;
444 case CSSMERR_CSP_INVALID_SIGNATURE
:
445 case CSSMERR_TP_INVALID_SIGNATURE
:
446 return errSecInvalidSignature
;
447 case CSSMERR_CSSM_USER_CANCELED
:
448 case CSSMERR_CSP_USER_CANCELED
:
449 case CSSMERR_TP_USER_CANCELED
:
450 case CSSMERR_AC_USER_CANCELED
:
451 case CSSMERR_CL_USER_CANCELED
:
452 case CSSMERR_DL_USER_CANCELED
:
453 return userCanceledErr
;
454 case CSSMERR_CSSM_NO_USER_INTERACTION
:
455 case CSSMERR_CSP_NO_USER_INTERACTION
:
456 case CSSMERR_TP_NO_USER_INTERACTION
:
457 case CSSMERR_AC_NO_USER_INTERACTION
:
458 case CSSMERR_CL_NO_USER_INTERACTION
:
459 case CSSMERR_DL_NO_USER_INTERACTION
:
460 return errSecInteractionNotAllowed
;
461 case CSSMERR_CSSM_IN_DARK_WAKE
:
462 case CSSMERR_CSP_IN_DARK_WAKE
:
463 case CSSMERR_TP_IN_DARK_WAKE
:
464 case CSSMERR_AC_IN_DARK_WAKE
:
465 case CSSMERR_CL_IN_DARK_WAKE
:
466 case CSSMERR_DL_IN_DARK_WAKE
:
467 return errSecInDarkWake
;
468 case CSSMERR_CSSM_SERVICE_NOT_AVAILABLE
:
469 case CSSMERR_CSP_SERVICE_NOT_AVAILABLE
:
470 case CSSMERR_TP_SERVICE_NOT_AVAILABLE
:
471 case CSSMERR_AC_SERVICE_NOT_AVAILABLE
:
472 case CSSMERR_CL_SERVICE_NOT_AVAILABLE
:
473 case CSSMERR_DL_SERVICE_NOT_AVAILABLE
:
474 return errSecServiceNotAvailable
;
475 case CSSMERR_CSSM_INSUFFICIENT_CLIENT_IDENTIFICATION
:
476 case CSSMERR_CSP_INSUFFICIENT_CLIENT_IDENTIFICATION
:
477 case CSSMERR_TP_INSUFFICIENT_CLIENT_IDENTIFICATION
:
478 case CSSMERR_AC_INSUFFICIENT_CLIENT_IDENTIFICATION
:
479 case CSSMERR_CL_INSUFFICIENT_CLIENT_IDENTIFICATION
:
480 case CSSMERR_DL_INSUFFICIENT_CLIENT_IDENTIFICATION
:
481 return errSecInsufficientClientID
;
482 case CSSMERR_CSSM_DEVICE_RESET
:
483 case CSSMERR_CSP_DEVICE_RESET
:
484 case CSSMERR_TP_DEVICE_RESET
:
485 case CSSMERR_AC_DEVICE_RESET
:
486 case CSSMERR_CL_DEVICE_RESET
:
487 case CSSMERR_DL_DEVICE_RESET
:
488 return errSecDeviceReset
;
489 case CSSMERR_CSSM_DEVICE_FAILED
:
490 case CSSMERR_CSP_DEVICE_FAILED
:
491 case CSSMERR_TP_DEVICE_FAILED
:
492 case CSSMERR_AC_DEVICE_FAILED
:
493 case CSSMERR_CL_DEVICE_FAILED
:
494 case CSSMERR_DL_DEVICE_FAILED
:
495 return errSecDeviceFailed
;
496 case CSSMERR_APPLE_DOTMAC_REQ_SERVER_AUTH
:
497 case CSSMERR_CSSM_EMM_AUTHENTICATE_FAILED
:
498 case CSSMERR_CSSM_ADDIN_AUTHENTICATE_FAILED
:
499 case CSSMERR_CSP_OPERATION_AUTH_DENIED
:
500 case CSSMERR_CSP_OBJECT_USE_AUTH_DENIED
:
501 case CSSMERR_CSP_OBJECT_MANIP_AUTH_DENIED
:
502 case CSSMERR_TP_AUTHENTICATION_FAILED
:
503 case CSSMERR_DL_OPERATION_AUTH_DENIED
:
504 case CSSMERR_DL_OBJECT_USE_AUTH_DENIED
:
505 case CSSMERR_DL_OBJECT_MANIP_AUTH_DENIED
:
506 return errAuthorizationDenied
;
507 case CSSMERR_CSSM_SCOPE_NOT_SUPPORTED
:
508 case CSSMERR_CL_SCOPE_NOT_SUPPORTED
:
509 case CSSMERR_CL_INVALID_SCOPE
:
510 return errSecInvalidScope
;
511 case CSSMERR_TP_INVALID_NAME
:
512 case CSSMERR_DL_INVALID_DB_NAME
:
513 return errSecInvalidName
;
514 case CSSMERR_APPLETP_BAD_CERT_FROM_ISSUER
:
515 case CSSMERR_TP_INVALID_CERTIFICATE
:
516 case CSSMERR_TP_INVALID_ANCHOR_CERT
:
517 case CSSMERR_APPLETP_CRL_INVALID_ANCHOR_CERT
:
518 case CSSMERR_APPLETP_OCSP_INVALID_ANCHOR_CERT
:
519 return errSecInvalidCertificateRef
;
520 case CSSMERR_CSP_ACL_ENTRY_TAG_NOT_FOUND
:
521 case CSSMERR_DL_ACL_ENTRY_TAG_NOT_FOUND
:
522 return errSecTagNotFound
;
523 case CSSMERR_DL_UNSUPPORTED_QUERY
:
524 case CSSMERR_DL_INVALID_QUERY
:
525 return errSecInvalidQuery
;
526 case CSSMERR_CSP_INVALID_ACL_CHALLENGE_CALLBACK
:
527 case CSSMERR_TP_INVALID_CALLBACK
:
528 case CSSMERR_DL_INVALID_ACL_CHALLENGE_CALLBACK
:
529 return errSecInvalidCallback
;
530 case CSSMERR_CSP_ACL_CHALLENGE_CALLBACK_FAILED
:
531 case CSSMERR_CSP_CRYPTO_DATA_CALLBACK_FAILED
:
532 case CSSMERR_DL_ACL_CHALLENGE_CALLBACK_FAILED
:
533 return errSecCallbackFailed
;
534 case CSSMERR_TP_INVALID_CERTGROUP
:
535 case CSSMERR_TP_CERTGROUP_INCOMPLETE
:
536 case CSSMERR_DL_INVALID_ACL_BASE_CERTS
:
537 case CSSMERR_DL_ACL_BASE_CERTS_NOT_SUPPORTED
:
538 case CSSMERR_CSP_INVALID_ACL_BASE_CERTS
:
539 return errSecInvalidCertificateGroup
;
540 case CSSMERR_CSP_ACL_DELETE_FAILED
:
541 case CSSMERR_DL_ACL_DELETE_FAILED
:
542 return errSecACLDeleteFailed
;
543 case CSSMERR_CSP_ACL_REPLACE_FAILED
:
544 case CSSMERR_DL_ACL_REPLACE_FAILED
:
545 return errSecACLReplaceFailed
;
546 case CSSMERR_CSP_ACL_ADD_FAILED
:
547 case CSSMERR_DL_ACL_ADD_FAILED
:
548 return errSecACLAddFailed
;
549 case CSSMERR_DL_ACL_CHANGE_FAILED
:
550 case CSSMERR_CSP_ACL_CHANGE_FAILED
:
551 return errSecACLChangeFailed
;
552 case CSSMERR_CSSM_PRIVILEGE_NOT_GRANTED
:
553 case CSSMERR_CSP_PRIVILEGE_NOT_GRANTED
:
554 return errSecPrivilegeNotGranted
;
555 case CSSMERR_CSP_INVALID_ACCESS_CREDENTIALS
:
556 case CSSMERR_DL_INVALID_ACCESS_CREDENTIALS
:
557 return errSecInvalidAccessCredentials
;
558 case CSSMERR_DL_INVALID_RECORD_INDEX
:
559 case CSSMERR_DL_INVALID_RECORDTYPE
:
560 case CSSMERR_DL_UNSUPPORTED_RECORDTYPE
:
561 case CSSMERR_DL_INVALID_RECORD_UID
:
562 case CSSMERR_DL_STALE_UNIQUE_RECORD
:
563 return errSecInvalidRecord
;
564 case CSSMERR_CSP_INVALID_KEY
:
565 case CSSMERR_CSP_INVALID_KEY_REFERENCE
:
566 case CSSMERR_CSP_INVALID_KEY_CLASS
:
567 return errSecInvalidKeyRef
;
568 case CSSMERR_CSP_OBJECT_ACL_NOT_SUPPORTED
:
569 case CSSMERR_CSP_OBJECT_ACL_REQUIRED
:
570 case CSSMERR_CSP_ACL_BASE_CERTS_NOT_SUPPORTED
:
571 case CSSMERR_CSP_INVALID_ACL_SUBJECT_VALUE
:
572 case CSSMERR_CSP_ACL_SUBJECT_TYPE_NOT_SUPPORTED
:
573 case CSSMERR_DL_OBJECT_ACL_NOT_SUPPORTED
:
574 case CSSMERR_DL_OBJECT_ACL_REQUIRED
:
575 case CSSMERR_DL_INVALID_ACL_SUBJECT_VALUE
:
576 case CSSMERR_DL_ACL_SUBJECT_TYPE_NOT_SUPPORTED
:
577 case CSSMERR_DL_INVALID_NEW_ACL_ENTRY
:
578 case CSSMERR_DL_INVALID_NEW_ACL_OWNER
:
579 case CSSMERR_DL_INVALID_ACL_EDIT_MODE
:
580 case CSSMERR_CSP_INVALID_ACL_EDIT_MODE
:
581 case CSSMERR_CSP_INVALID_NEW_ACL_ENTRY
:
582 case CSSMERR_CSP_INVALID_NEW_ACL_OWNER
:
583 return errSecInvalidACL
;
584 case CSSMERR_CSP_INVALID_SAMPLE_VALUE
:
585 case CSSMERR_DL_INVALID_SAMPLE_VALUE
:
586 case CSSMERR_CSP_SAMPLE_VALUE_NOT_SUPPORTED
:
587 case CSSMERR_DL_SAMPLE_VALUE_NOT_SUPPORTED
:
588 return errSecInvalidSampleValue
;
589 case CSSMERR_TP_UNKNOWN_FORMAT
:
590 case CSSMERR_CL_UNKNOWN_FORMAT
:
591 return errSecUnknownFormat
;
592 case CSSMERR_CSP_APPLE_ADD_APPLICATION_ACL_SUBJECT
:
593 return errSecAppleAddAppACLSubject
;
594 case CSSMERR_CSP_APPLE_PUBLIC_KEY_INCOMPLETE
:
595 return errSecApplePublicKeyIncomplete
;
596 case CSSMERR_CSP_APPLE_SIGNATURE_MISMATCH
:
597 return errSecAppleSignatureMismatch
;
598 case CSSMERR_CSP_APPLE_INVALID_KEY_START_DATE
:
599 return errSecAppleInvalidKeyStartDate
;
600 case CSSMERR_CSP_APPLE_INVALID_KEY_END_DATE
:
601 return errSecAppleInvalidKeyEndDate
;
602 case CSSMERR_CSPDL_APPLE_DL_CONVERSION_ERROR
:
603 return errSecConversionError
;
604 case CSSMERR_CSP_APPLE_SSLv2_ROLLBACK
:
605 return errSecAppleSSLv2Rollback
;
606 case CSSMERR_APPLEDL_QUOTA_EXCEEDED
:
607 return errSecQuotaExceeded
;
608 case CSSMERR_APPLEDL_FILE_TOO_BIG
:
609 return errSecFileTooBig
;
610 case CSSMERR_APPLEDL_INVALID_DATABASE_BLOB
:
611 return errSecInvalidDatabaseBlob
;
612 case CSSMERR_APPLEDL_INVALID_KEY_BLOB
:
613 return errSecInvalidKeyBlob
;
614 case CSSMERR_APPLEDL_INCOMPATIBLE_DATABASE_BLOB
:
615 return errSecIncompatibleDatabaseBlob
;
616 case CSSMERR_APPLEDL_INCOMPATIBLE_KEY_BLOB
:
617 return errSecIncompatibleKeyBlob
;
618 case CSSMERR_APPLETP_HOSTNAME_MISMATCH
:
619 return errSecHostNameMismatch
;
620 case CSSMERR_APPLETP_UNKNOWN_CRITICAL_EXTEN
:
621 return errSecUnknownCriticalExtensionFlag
;
622 case CSSMERR_APPLETP_NO_BASIC_CONSTRAINTS
:
623 return errSecNoBasicConstraints
;
624 case CSSMERR_APPLETP_INVALID_AUTHORITY_ID
:
625 return errSecInvalidAuthorityKeyID
;
626 case CSSMERR_APPLETP_INVALID_SUBJECT_ID
:
627 return errSecInvalidSubjectKeyID
;
628 case CSSMERR_APPLETP_INVALID_KEY_USAGE
:
629 return errSecInvalidKeyUsageForPolicy
;
630 case CSSMERR_APPLETP_INVALID_EXTENDED_KEY_USAGE
:
631 return errSecInvalidExtendedKeyUsage
;
632 case CSSMERR_APPLETP_INVALID_ID_LINKAGE
:
633 return errSecInvalidIDLinkage
;
634 case CSSMERR_APPLETP_PATH_LEN_CONSTRAINT
:
635 return errSecPathLengthConstraintExceeded
;
636 case CSSMERR_APPLETP_INVALID_ROOT
:
637 return errSecInvalidRoot
;
638 case CSSMERR_APPLETP_CRL_EXPIRED
:
639 return errSecCRLExpired
;
640 case CSSMERR_APPLETP_CRL_NOT_VALID_YET
:
641 return errSecCRLNotValidYet
;
642 case CSSMERR_APPLETP_CRL_NOT_FOUND
:
643 return errSecCRLNotFound
;
644 case CSSMERR_APPLETP_CRL_SERVER_DOWN
:
645 return errSecCRLServerDown
;
646 case CSSMERR_APPLETP_CRL_BAD_URI
:
647 return errSecCRLBadURI
;
648 case CSSMERR_APPLETP_UNKNOWN_CERT_EXTEN
:
649 return errSecUnknownCertExtension
;
650 case CSSMERR_APPLETP_UNKNOWN_CRL_EXTEN
:
651 return errSecUnknownCRLExtension
;
652 case CSSMERR_APPLETP_CRL_NOT_TRUSTED
:
653 return errSecCRLNotTrusted
;
654 case CSSMERR_APPLETP_CRL_POLICY_FAIL
:
655 return errSecCRLPolicyFailed
;
656 case CSSMERR_APPLETP_IDP_FAIL
:
657 return errSecIDPFailure
;
658 case CSSMERR_APPLETP_SMIME_EMAIL_ADDRS_NOT_FOUND
:
659 return errSecSMIMEEmailAddressesNotFound
;
660 case CSSMERR_APPLETP_SMIME_BAD_EXT_KEY_USE
:
661 return errSecSMIMEBadExtendedKeyUsage
;
662 case CSSMERR_APPLETP_SMIME_BAD_KEY_USE
:
663 return errSecSMIMEBadKeyUsage
;
664 case CSSMERR_APPLETP_SMIME_KEYUSAGE_NOT_CRITICAL
:
665 return errSecSMIMEKeyUsageNotCritical
;
666 case CSSMERR_APPLETP_SMIME_NO_EMAIL_ADDRS
:
667 return errSecSMIMENoEmailAddress
;
668 case CSSMERR_APPLETP_SMIME_SUBJ_ALT_NAME_NOT_CRIT
:
669 return errSecSMIMESubjAltNameNotCritical
;
670 case CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE
:
671 return errSecSSLBadExtendedKeyUsage
;
672 case CSSMERR_APPLETP_OCSP_BAD_RESPONSE
:
673 return errSecOCSPBadResponse
;
674 case CSSMERR_APPLETP_OCSP_BAD_REQUEST
:
675 return errSecOCSPBadRequest
;
676 case CSSMERR_APPLETP_OCSP_UNAVAILABLE
:
677 return errSecOCSPUnavailable
;
678 case CSSMERR_APPLETP_OCSP_STATUS_UNRECOGNIZED
:
679 return errSecOCSPStatusUnrecognized
;
680 case CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK
:
681 return errSecIncompleteCertRevocationCheck
;
682 case CSSMERR_APPLETP_NETWORK_FAILURE
:
683 return errSecNetworkFailure
;
684 case CSSMERR_APPLETP_OCSP_NOT_TRUSTED
:
685 return errSecOCSPNotTrustedToAnchor
;
686 case CSSMERR_APPLETP_OCSP_SIG_ERROR
:
687 return errSecOCSPSignatureError
;
688 case CSSMERR_APPLETP_OCSP_NO_SIGNER
:
689 return errSecOCSPNoSigner
;
690 case CSSMERR_APPLETP_OCSP_RESP_MALFORMED_REQ
:
691 return errSecOCSPResponderMalformedReq
;
692 case CSSMERR_APPLETP_OCSP_RESP_INTERNAL_ERR
:
693 return errSecOCSPResponderInternalError
;
694 case CSSMERR_APPLETP_OCSP_RESP_TRY_LATER
:
695 return errSecOCSPResponderTryLater
;
696 case CSSMERR_APPLETP_OCSP_RESP_SIG_REQUIRED
:
697 return errSecOCSPResponderSignatureRequired
;
698 case CSSMERR_APPLETP_OCSP_RESP_UNAUTHORIZED
:
699 return errSecOCSPResponderUnauthorized
;
700 case CSSMERR_APPLETP_OCSP_NONCE_MISMATCH
:
701 return errSecOCSPResponseNonceMismatch
;
702 case CSSMERR_APPLETP_CS_BAD_CERT_CHAIN_LENGTH
:
703 return errSecCodeSigningBadCertChainLength
;
704 case CSSMERR_APPLETP_CS_NO_BASIC_CONSTRAINTS
:
705 return errSecCodeSigningNoBasicConstraints
;
706 case CSSMERR_APPLETP_CS_BAD_PATH_LENGTH
:
707 return errSecCodeSigningBadPathLengthConstraint
;
708 case CSSMERR_APPLETP_CS_NO_EXTENDED_KEY_USAGE
:
709 return errSecCodeSigningNoExtendedKeyUsage
;
710 case CSSMERR_APPLETP_CODE_SIGN_DEVELOPMENT
:
711 return errSecCodeSigningDevelopment
;
712 case CSSMERR_APPLETP_RS_BAD_CERT_CHAIN_LENGTH
:
713 return errSecResourceSignBadCertChainLength
;
714 case CSSMERR_APPLETP_RS_BAD_EXTENDED_KEY_USAGE
:
715 return errSecResourceSignBadExtKeyUsage
;
716 case CSSMERR_APPLETP_TRUST_SETTING_DENY
:
717 return errSecTrustSettingDeny
;
718 case CSSMERR_APPLETP_INVALID_EMPTY_SUBJECT
:
719 return errSecInvalidSubjectName
;
720 case CSSMERR_APPLETP_UNKNOWN_QUAL_CERT_STATEMENT
:
721 return errSecUnknownQualifiedCertStatement
;
722 case CSSMERR_APPLETP_MISSING_REQUIRED_EXTENSION
:
723 return errSecMissingRequiredExtension
;
724 case CSSMERR_APPLETP_EXT_KEYUSAGE_NOT_CRITICAL
:
725 return errSecExtendedKeyUsageNotCritical
;
726 case CSSMERR_APPLE_DOTMAC_REQ_QUEUED
:
727 return errSecMobileMeRequestQueued
;
728 case CSSMERR_APPLE_DOTMAC_REQ_REDIRECT
:
729 return errSecMobileMeRequestRedirected
;
730 case CSSMERR_APPLE_DOTMAC_REQ_SERVER_ERR
:
731 return errSecMobileMeServerError
;
732 case CSSMERR_APPLE_DOTMAC_REQ_SERVER_NOT_AVAIL
:
733 return errSecMobileMeServerNotAvailable
;
734 case CSSMERR_APPLE_DOTMAC_REQ_SERVER_ALREADY_EXIST
:
735 return errSecMobileMeServerAlreadyExists
;
736 case CSSMERR_APPLE_DOTMAC_REQ_SERVER_SERVICE_ERROR
:
737 return errSecMobileMeServerServiceErr
;
738 case CSSMERR_APPLE_DOTMAC_REQ_IS_PENDING
:
739 return errSecMobileMeRequestAlreadyPending
;
740 case CSSMERR_APPLE_DOTMAC_NO_REQ_PENDING
:
741 return errSecMobileMeNoRequestPending
;
742 case CSSMERR_APPLE_DOTMAC_CSR_VERIFY_FAIL
:
743 return errSecMobileMeCSRVerifyFailure
;
744 case CSSMERR_APPLE_DOTMAC_FAILED_CONSISTENCY_CHECK
:
745 return errSecMobileMeFailedConsistencyCheck
;
746 case CSSMERR_CSSM_NOT_INITIALIZED
:
747 return errSecNotInitialized
;
748 case CSSMERR_CSSM_INVALID_HANDLE_USAGE
:
749 return errSecInvalidHandleUsage
;
750 case CSSMERR_CSSM_PVC_REFERENT_NOT_FOUND
:
751 return errSecPVCReferentNotFound
;
752 case CSSMERR_CSSM_FUNCTION_INTEGRITY_FAIL
:
753 return errSecFunctionIntegrityFail
;
754 case CSSMERR_CSSM_SELF_CHECK_FAILED
:
755 case CSSMERR_CSP_SELF_CHECK_FAILED
:
756 return errSecSelfCheckFailed
;
757 case CSSMERR_CSSM_MODULE_MANIFEST_VERIFY_FAILED
:
758 return errSecModuleManifestVerifyFailed
;
759 case CSSMERR_CSSM_INVALID_GUID
:
760 return errSecInvalidGUID
;
761 case CSSMERR_CSSM_INCOMPATIBLE_VERSION
:
762 return errSecIncompatibleVersion
;
763 case CSSMERR_CSSM_PVC_ALREADY_CONFIGURED
:
764 return errSecPVCAlreadyConfigured
;
765 case CSSMERR_CSSM_INVALID_PVC
:
766 return errSecInvalidPVC
;
767 case CSSMERR_CSSM_EMM_LOAD_FAILED
:
768 return errSecEMMLoadFailed
;
769 case CSSMERR_CSSM_EMM_UNLOAD_FAILED
:
770 return errSecEMMUnloadFailed
;
771 case CSSMERR_CSSM_ADDIN_LOAD_FAILED
:
772 return errSecAddinLoadFailed
;
773 case CSSMERR_CSSM_INVALID_KEY_HIERARCHY
:
774 return errSecInvalidKeyHierarchy
;
775 case CSSMERR_CSSM_ADDIN_UNLOAD_FAILED
:
776 return errSecAddinUnloadFailed
;
777 case CSSMERR_CSSM_LIB_REF_NOT_FOUND
:
778 return errSecLibraryReferenceNotFound
;
779 case CSSMERR_CSSM_INVALID_ADDIN_FUNCTION_TABLE
:
780 return errSecInvalidAddinFunctionTable
;
781 case CSSMERR_CSSM_INVALID_SERVICE_MASK
:
782 return errSecInvalidServiceMask
;
783 case CSSMERR_CSSM_MODULE_NOT_LOADED
:
784 return errSecModuleNotLoaded
;
785 case CSSMERR_CSSM_INVALID_SUBSERVICEID
:
786 return errSecInvalidSubServiceID
;
787 case CSSMERR_CSSM_ATTRIBUTE_NOT_IN_CONTEXT
:
788 return errSecAttributeNotInContext
;
789 case CSSMERR_CSSM_MODULE_MANAGER_INITIALIZE_FAIL
:
790 return errSecModuleManagerInitializeFailed
;
791 case CSSMERR_CSSM_MODULE_MANAGER_NOT_FOUND
:
792 return errSecModuleManagerNotFound
;
793 case CSSMERR_CSSM_EVENT_NOTIFICATION_CALLBACK_NOT_FOUND
:
794 return errSecEventNotificationCallbackNotFound
;
795 case CSSMERR_CSP_INPUT_LENGTH_ERROR
:
796 return errSecInputLengthError
;
797 case CSSMERR_CSP_OUTPUT_LENGTH_ERROR
:
798 return errSecOutputLengthError
;
799 case CSSMERR_CSP_PRIVILEGE_NOT_SUPPORTED
:
800 return errSecPrivilegeNotSupported
;
801 case CSSMERR_CSP_DEVICE_ERROR
:
802 return errSecDeviceError
;
803 case CSSMERR_CSP_ATTACH_HANDLE_BUSY
:
804 return errSecAttachHandleBusy
;
805 case CSSMERR_CSP_NOT_LOGGED_IN
:
806 return errSecNotLoggedIn
;
807 case CSSMERR_CSP_ALGID_MISMATCH
:
808 return errSecAlgorithmMismatch
;
809 case CSSMERR_CSP_KEY_USAGE_INCORRECT
:
810 return errSecKeyUsageIncorrect
;
811 case CSSMERR_CSP_KEY_BLOB_TYPE_INCORRECT
:
812 return errSecKeyBlobTypeIncorrect
;
813 case CSSMERR_CSP_KEY_HEADER_INCONSISTENT
:
814 return errSecKeyHeaderInconsistent
;
815 case CSSMERR_CSP_UNSUPPORTED_KEY_FORMAT
:
816 return errSecUnsupportedKeyFormat
;
817 case CSSMERR_CSP_UNSUPPORTED_KEY_SIZE
:
818 return errSecUnsupportedKeySize
;
819 case CSSMERR_CSP_INVALID_KEYUSAGE_MASK
:
820 return errSecInvalidKeyUsageMask
;
821 case CSSMERR_CSP_UNSUPPORTED_KEYUSAGE_MASK
:
822 return errSecUnsupportedKeyUsageMask
;
823 case CSSMERR_CSP_INVALID_KEYATTR_MASK
:
824 return errSecInvalidKeyAttributeMask
;
825 case CSSMERR_CSP_UNSUPPORTED_KEYATTR_MASK
:
826 return errSecUnsupportedKeyAttributeMask
;
827 case CSSMERR_CSP_INVALID_KEY_LABEL
:
828 return errSecInvalidKeyLabel
;
829 case CSSMERR_CSP_UNSUPPORTED_KEY_LABEL
:
830 return errSecUnsupportedKeyLabel
;
831 case CSSMERR_CSP_INVALID_KEY_FORMAT
:
832 return errSecInvalidKeyFormat
;
833 case CSSMERR_CSP_VECTOR_OF_BUFS_UNSUPPORTED
:
834 return errSecUnsupportedVectorOfBuffers
;
835 case CSSMERR_CSP_INVALID_INPUT_VECTOR
:
836 return errSecInvalidInputVector
;
837 case CSSMERR_CSP_INVALID_OUTPUT_VECTOR
:
838 return errSecInvalidOutputVector
;
839 case CSSMERR_CSP_INVALID_CONTEXT
:
840 return errSecInvalidContext
;
841 case CSSMERR_CSP_INVALID_ALGORITHM
:
842 return errSecInvalidAlgorithm
;
843 case CSSMERR_CSP_INVALID_ATTR_KEY
:
844 return errSecInvalidAttributeKey
;
845 case CSSMERR_CSP_MISSING_ATTR_KEY
:
846 return errSecMissingAttributeKey
;
847 case CSSMERR_CSP_INVALID_ATTR_INIT_VECTOR
:
848 return errSecInvalidAttributeInitVector
;
849 case CSSMERR_CSP_MISSING_ATTR_INIT_VECTOR
:
850 return errSecMissingAttributeInitVector
;
851 case CSSMERR_CSP_INVALID_ATTR_SALT
:
852 return errSecInvalidAttributeSalt
;
853 case CSSMERR_CSP_MISSING_ATTR_SALT
:
854 return errSecMissingAttributeSalt
;
855 case CSSMERR_CSP_INVALID_ATTR_PADDING
:
856 return errSecInvalidAttributePadding
;
857 case CSSMERR_CSP_MISSING_ATTR_PADDING
:
858 return errSecMissingAttributePadding
;
859 case CSSMERR_CSP_INVALID_ATTR_RANDOM
:
860 return errSecInvalidAttributeRandom
;
861 case CSSMERR_CSP_MISSING_ATTR_RANDOM
:
862 return errSecMissingAttributeRandom
;
863 case CSSMERR_CSP_INVALID_ATTR_SEED
:
864 return errSecInvalidAttributeSeed
;
865 case CSSMERR_CSP_MISSING_ATTR_SEED
:
866 return errSecMissingAttributeSeed
;
867 case CSSMERR_CSP_INVALID_ATTR_PASSPHRASE
:
868 return errSecInvalidAttributePassphrase
;
869 case CSSMERR_CSP_MISSING_ATTR_PASSPHRASE
:
870 return errSecMissingAttributePassphrase
;
871 case CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH
:
872 return errSecInvalidAttributeKeyLength
;
873 case CSSMERR_CSP_MISSING_ATTR_KEY_LENGTH
:
874 return errSecMissingAttributeKeyLength
;
875 case CSSMERR_CSP_INVALID_ATTR_BLOCK_SIZE
:
876 return errSecInvalidAttributeBlockSize
;
877 case CSSMERR_CSP_MISSING_ATTR_BLOCK_SIZE
:
878 return errSecMissingAttributeBlockSize
;
879 case CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE
:
880 return errSecInvalidAttributeOutputSize
;
881 case CSSMERR_CSP_MISSING_ATTR_OUTPUT_SIZE
:
882 return errSecMissingAttributeOutputSize
;
883 case CSSMERR_CSP_INVALID_ATTR_ROUNDS
:
884 return errSecInvalidAttributeRounds
;
885 case CSSMERR_CSP_MISSING_ATTR_ROUNDS
:
886 return errSecMissingAttributeRounds
;
887 case CSSMERR_CSP_INVALID_ATTR_ALG_PARAMS
:
888 return errSecInvalidAlgorithmParms
;
889 case CSSMERR_CSP_MISSING_ATTR_ALG_PARAMS
:
890 return errSecMissingAlgorithmParms
;
891 case CSSMERR_CSP_INVALID_ATTR_LABEL
:
892 return errSecInvalidAttributeLabel
;
893 case CSSMERR_CSP_MISSING_ATTR_LABEL
:
894 return errSecMissingAttributeLabel
;
895 case CSSMERR_CSP_INVALID_ATTR_KEY_TYPE
:
896 return errSecInvalidAttributeKeyType
;
897 case CSSMERR_CSP_MISSING_ATTR_KEY_TYPE
:
898 return errSecMissingAttributeKeyType
;
899 case CSSMERR_CSP_INVALID_ATTR_MODE
:
900 return errSecInvalidAttributeMode
;
901 case CSSMERR_CSP_MISSING_ATTR_MODE
:
902 return errSecMissingAttributeMode
;
903 case CSSMERR_CSP_INVALID_ATTR_EFFECTIVE_BITS
:
904 return errSecInvalidAttributeEffectiveBits
;
905 case CSSMERR_CSP_MISSING_ATTR_EFFECTIVE_BITS
:
906 return errSecMissingAttributeEffectiveBits
;
907 case CSSMERR_CSP_INVALID_ATTR_START_DATE
:
908 return errSecInvalidAttributeStartDate
;
909 case CSSMERR_CSP_MISSING_ATTR_START_DATE
:
910 return errSecMissingAttributeStartDate
;
911 case CSSMERR_CSP_INVALID_ATTR_END_DATE
:
912 return errSecInvalidAttributeEndDate
;
913 case CSSMERR_CSP_MISSING_ATTR_END_DATE
:
914 return errSecMissingAttributeEndDate
;
915 case CSSMERR_CSP_INVALID_ATTR_VERSION
:
916 return errSecInvalidAttributeVersion
;
917 case CSSMERR_CSP_MISSING_ATTR_VERSION
:
918 return errSecMissingAttributeVersion
;
919 case CSSMERR_CSP_INVALID_ATTR_PRIME
:
920 return errSecInvalidAttributePrime
;
921 case CSSMERR_CSP_MISSING_ATTR_PRIME
:
922 return errSecMissingAttributePrime
;
923 case CSSMERR_CSP_INVALID_ATTR_BASE
:
924 return errSecInvalidAttributeBase
;
925 case CSSMERR_CSP_MISSING_ATTR_BASE
:
926 return errSecMissingAttributeBase
;
927 case CSSMERR_CSP_INVALID_ATTR_SUBPRIME
:
928 return errSecInvalidAttributeSubprime
;
929 case CSSMERR_CSP_MISSING_ATTR_SUBPRIME
:
930 return errSecMissingAttributeSubprime
;
931 case CSSMERR_CSP_INVALID_ATTR_ITERATION_COUNT
:
932 return errSecInvalidAttributeIterationCount
;
933 case CSSMERR_CSP_MISSING_ATTR_ITERATION_COUNT
:
934 return errSecMissingAttributeIterationCount
;
935 case CSSMERR_CSP_INVALID_ATTR_DL_DB_HANDLE
:
936 return errSecInvalidAttributeDLDBHandle
;
937 case CSSMERR_CSP_MISSING_ATTR_DL_DB_HANDLE
:
938 return errSecMissingAttributeDLDBHandle
;
939 case CSSMERR_CSP_INVALID_ATTR_ACCESS_CREDENTIALS
:
940 return errSecInvalidAttributeAccessCredentials
;
941 case CSSMERR_CSP_MISSING_ATTR_ACCESS_CREDENTIALS
:
942 return errSecMissingAttributeAccessCredentials
;
943 case CSSMERR_CSP_INVALID_ATTR_PUBLIC_KEY_FORMAT
:
944 return errSecInvalidAttributePublicKeyFormat
;
945 case CSSMERR_CSP_MISSING_ATTR_PUBLIC_KEY_FORMAT
:
946 return errSecMissingAttributePublicKeyFormat
;
947 case CSSMERR_CSP_INVALID_ATTR_PRIVATE_KEY_FORMAT
:
948 return errSecInvalidAttributePrivateKeyFormat
;
949 case CSSMERR_CSP_MISSING_ATTR_PRIVATE_KEY_FORMAT
:
950 return errSecMissingAttributePrivateKeyFormat
;
951 case CSSMERR_CSP_INVALID_ATTR_SYMMETRIC_KEY_FORMAT
:
952 return errSecInvalidAttributeSymmetricKeyFormat
;
953 case CSSMERR_CSP_MISSING_ATTR_SYMMETRIC_KEY_FORMAT
:
954 return errSecMissingAttributeSymmetricKeyFormat
;
955 case CSSMERR_CSP_INVALID_ATTR_WRAPPED_KEY_FORMAT
:
956 return errSecInvalidAttributeWrappedKeyFormat
;
957 case CSSMERR_CSP_MISSING_ATTR_WRAPPED_KEY_FORMAT
:
958 return errSecMissingAttributeWrappedKeyFormat
;
959 case CSSMERR_CSP_STAGED_OPERATION_IN_PROGRESS
:
960 return errSecStagedOperationInProgress
;
961 case CSSMERR_CSP_STAGED_OPERATION_NOT_STARTED
:
962 return errSecStagedOperationNotStarted
;
963 case CSSMERR_CSP_VERIFY_FAILED
:
964 return errSecVerifyFailed
;
965 case CSSMERR_CSP_QUERY_SIZE_UNKNOWN
:
966 return errSecQuerySizeUnknown
;
967 case CSSMERR_CSP_BLOCK_SIZE_MISMATCH
:
968 return errSecBlockSizeMismatch
;
969 case CSSMERR_CSP_PUBLIC_KEY_INCONSISTENT
:
970 return errSecPublicKeyInconsistent
;
971 case CSSMERR_CSP_DEVICE_VERIFY_FAILED
:
972 return errSecDeviceVerifyFailed
;
973 case CSSMERR_CSP_INVALID_LOGIN_NAME
:
974 return errSecInvalidLoginName
;
975 case CSSMERR_CSP_ALREADY_LOGGED_IN
:
976 return errSecAlreadyLoggedIn
;
977 case CSSMERR_CSP_INVALID_DIGEST_ALGORITHM
:
978 return errSecInvalidDigestAlgorithm
;
979 case CSSMERR_TP_INVALID_CRLGROUP
:
980 return errSecInvalidCRLGroup
;
981 case CSSMERR_TP_CERTIFICATE_CANT_OPERATE
:
982 return errSecCertificateCannotOperate
;
983 case CSSMERR_TP_CERT_EXPIRED
:
984 return errSecCertificateExpired
;
985 case CSSMERR_TP_CERT_NOT_VALID_YET
:
986 return errSecCertificateNotValidYet
;
987 case CSSMERR_TP_CERT_REVOKED
:
988 return errSecCertificateRevoked
;
989 case CSSMERR_TP_CERT_SUSPENDED
:
990 return errSecCertificateSuspended
;
991 case CSSMERR_TP_INSUFFICIENT_CREDENTIALS
:
992 return errSecInsufficientCredentials
;
993 case CSSMERR_TP_INVALID_ACTION
:
994 return errSecInvalidAction
;
995 case CSSMERR_TP_INVALID_AUTHORITY
:
996 return errSecInvalidAuthority
;
997 case CSSMERR_TP_VERIFY_ACTION_FAILED
:
998 return errSecVerifyActionFailed
;
999 case CSSMERR_TP_INVALID_CERT_AUTHORITY
:
1000 case CSSMERR_APPLETP_INVALID_CA
:
1001 return errSecInvalidCertAuthority
;
1002 case CSSMERR_TP_INVALID_CRL_AUTHORITY
:
1003 return errSecInvaldCRLAuthority
;
1004 case CSSMERR_TP_INVALID_CRL_ENCODING
:
1005 return errSecInvalidCRLEncoding
;
1006 case CSSMERR_TP_INVALID_CRL_TYPE
:
1007 return errSecInvalidCRLType
;
1008 case CSSMERR_TP_INVALID_CRL
:
1009 return errSecInvalidCRL
;
1010 case CSSMERR_TP_INVALID_FORM_TYPE
:
1011 return errSecInvalidFormType
;
1012 case CSSMERR_TP_INVALID_ID
:
1013 return errSecInvalidID
;
1014 case CSSMERR_TP_INVALID_IDENTIFIER
:
1015 return errSecInvalidIdentifier
;
1016 case CSSMERR_TP_INVALID_INDEX
:
1017 return errSecInvalidIndex
;
1018 case CSSMERR_TP_INVALID_POLICY_IDENTIFIERS
:
1019 return errSecInvalidPolicyIdentifiers
;
1020 case CSSMERR_TP_INVALID_TIMESTRING
:
1021 return errSecInvalidTimeString
;
1022 case CSSMERR_TP_INVALID_REASON
:
1023 return errSecInvalidReason
;
1024 case CSSMERR_TP_INVALID_REQUEST_INPUTS
:
1025 return errSecInvalidRequestInputs
;
1026 case CSSMERR_TP_INVALID_RESPONSE_VECTOR
:
1027 return errSecInvalidResponseVector
;
1028 case CSSMERR_TP_INVALID_STOP_ON_POLICY
:
1029 return errSecInvalidStopOnPolicy
;
1030 case CSSMERR_TP_INVALID_TUPLE
:
1031 return errSecInvalidTuple
;
1032 case CSSMERR_TP_NOT_SIGNER
:
1033 return errSecNotSigner
;
1034 case CSSMERR_TP_NOT_TRUSTED
:
1035 return errSecNotTrusted
;
1036 case CSSMERR_TP_NO_DEFAULT_AUTHORITY
:
1037 return errSecNoDefaultAuthority
;
1038 case CSSMERR_TP_REJECTED_FORM
:
1039 return errSecRejectedForm
;
1040 case CSSMERR_TP_REQUEST_LOST
:
1041 return errSecRequestLost
;
1042 case CSSMERR_TP_REQUEST_REJECTED
:
1043 return errSecRequestRejected
;
1044 case CSSMERR_TP_UNSUPPORTED_ADDR_TYPE
:
1045 return errSecUnsupportedAddressType
;
1046 case CSSMERR_TP_UNSUPPORTED_SERVICE
:
1047 return errSecUnsupportedService
;
1048 case CSSMERR_TP_INVALID_TUPLEGROUP
:
1049 return errSecInvalidTupleGroup
;
1050 case CSSMERR_AC_INVALID_BASE_ACLS
:
1051 return errSecInvalidBaseACLs
;
1052 case CSSMERR_AC_INVALID_TUPLE_CREDENTIALS
:
1053 return errSecInvalidTupleCredendtials
;
1054 case CSSMERR_AC_INVALID_ENCODING
:
1055 return errSecInvalidEncoding
;
1056 case CSSMERR_AC_INVALID_VALIDITY_PERIOD
:
1057 return errSecInvalidValidityPeriod
;
1058 case CSSMERR_AC_INVALID_REQUESTOR
:
1059 return errSecInvalidRequestor
;
1060 case CSSMERR_AC_INVALID_REQUEST_DESCRIPTOR
:
1061 return errSecRequestDescriptor
;
1062 case CSSMERR_CL_INVALID_BUNDLE_INFO
:
1063 return errSecInvalidBundleInfo
;
1064 case CSSMERR_CL_INVALID_CRL_INDEX
:
1065 return errSecInvalidCRLIndex
;
1066 case CSSMERR_CL_NO_FIELD_VALUES
:
1067 return errSecNoFieldValues
;
1068 case CSSMERR_DL_UNSUPPORTED_FIELD_FORMAT
:
1069 return errSecUnsupportedFieldFormat
;
1070 case CSSMERR_DL_UNSUPPORTED_INDEX_INFO
:
1071 return errSecUnsupportedIndexInfo
;
1072 case CSSMERR_DL_UNSUPPORTED_LOCALITY
:
1073 return errSecUnsupportedLocality
;
1074 case CSSMERR_DL_UNSUPPORTED_NUM_ATTRIBUTES
:
1075 return errSecUnsupportedNumAttributes
;
1076 case CSSMERR_DL_UNSUPPORTED_NUM_INDEXES
:
1077 return errSecUnsupportedNumIndexes
;
1078 case CSSMERR_DL_UNSUPPORTED_NUM_RECORDTYPES
:
1079 return errSecUnsupportedNumRecordTypes
;
1080 case CSSMERR_DL_FIELD_SPECIFIED_MULTIPLE
:
1081 return errSecFieldSpecifiedMultiple
;
1082 case CSSMERR_DL_INCOMPATIBLE_FIELD_FORMAT
:
1083 return errSecIncompatibleFieldFormat
;
1084 case CSSMERR_DL_INVALID_PARSING_MODULE
:
1085 return errSecInvalidParsingModule
;
1086 case CSSMERR_DL_DB_LOCKED
:
1087 return errSecDatabaseLocked
;
1088 case CSSMERR_DL_DATASTORE_IS_OPEN
:
1089 return errSecDatastoreIsOpen
;
1090 case CSSMERR_DL_MISSING_VALUE
:
1091 return errSecMissingValue
;
1092 case CSSMERR_DL_UNSUPPORTED_QUERY_LIMITS
:
1093 return errSecUnsupportedQueryLimits
;
1094 case CSSMERR_DL_UNSUPPORTED_NUM_SELECTION_PREDS
:
1095 return errSecUnsupportedNumSelectionPreds
;
1096 case CSSMERR_DL_UNSUPPORTED_OPERATOR
:
1097 return errSecUnsupportedOperator
;
1098 case CSSMERR_DL_INVALID_DB_LOCATION
:
1099 return errSecInvalidDBLocation
;
1100 case CSSMERR_DL_INVALID_ACCESS_REQUEST
:
1101 return errSecInvalidAccessRequest
;
1102 case CSSMERR_DL_INVALID_INDEX_INFO
:
1103 return errSecInvalidIndexInfo
;
1104 case CSSMERR_DL_INVALID_NEW_OWNER
:
1105 return errSecInvalidNewOwner
;
1106 case CSSMERR_DL_INVALID_MODIFY_MODE
:
1107 return errSecInvalidModifyMode
;
1108 case CSSMERR_DL_RECORD_MODIFIED
:
1109 return errSecRecordModified
;
1110 case CSSMERR_DL_ENDOFDATA
:
1111 return errSecEndOfData
;
1112 case CSSMERR_DL_INVALID_VALUE
:
1113 return errSecInvalidValue
;
1114 case CSSMERR_DL_MULTIPLE_VALUES_UNSUPPORTED
:
1115 return errSecMultipleValuesUnsupported
;