Commits

sn...@snej.local  committed a9da6c5

* Added MYErrorUtils
* Added AssertAbstractMethod() to Test
* Added .xcconfig files

  • Participants
  • Parent commits 88d7e24

Comments (0)

Files changed (8)

File MYErrorUtils.h

+//
+//  MYErrorUtils.h
+//  MYCrypto
+//
+//  Created by Jens Alfke on 2/25/09.
+//  Copyright 2009 Jens Alfke. All rights reserved.
+//
+
+#import <Foundation/NSObject.h>
+@class NSError, NSString;
+
+
+extern NSString* const MYErrorDomain;
+
+enum {
+    /** "Miscellaneous" error code, set by MYMiscError.
+        Handy during development, but before shipping you really should define
+        individual error codes for each error condition. */
+    kMYErrorMisc = 999999,
+};
+
+
+/** Creates an NSError in MYErrorDomain. */
+NSError *MYError( int errorCode, NSString *domain, NSString *messageFormat, ... ) 
+                                __attribute__ ((format (__NSString__, 3, 4)));
+
+/** Convenience function for creating NSErrors.
+    Stores an NSError into *error, and returns NO.
+    Domain will be MYErrorDomain, code will be kMYErrorMisc.
+    Handy during development, but before shipping you really should define
+    individual error codes for each error condition. */
+BOOL MYMiscError( NSError **outError, NSString *messageFormat, ... )
+                                __attribute__ ((format (__NSString__, 2, 3)));
+
+NSString* MYPrintableErrorCode( int code );
+NSString* MYErrorName( NSString *domain, int code );
+
+@interface NSError (MYUtilities)
+/** Prepends a message to the beginning of the receiver's existing message,
+    and returns the modified NSError. */
+- (NSError*) my_errorByPrependingMessage: (NSString*)message;
+
+- (NSString*) my_nameOfCode;
+
+@end

File MYErrorUtils.m

+//
+//  MYErrorUtils.m
+//  MYCrypto
+//
+//  Created by Jens Alfke on 2/25/09.
+//  Copyright 2009 Jens Alfke. All rights reserved.
+//
+
+#import "MYErrorUtils.h"
+#import "Test.h"
+#import "CollectionUtils.h"
+#import <Foundation/Foundation.h>
+
+
+NSString* const MYErrorDomain = @"MYErrorDomain";
+
+
+static NSError *MYMakeErrorV( int errorCode, NSString *domain, NSString *message, va_list args )
+{
+    message = [[NSString alloc] initWithFormat: message arguments: args];
+    Log(@"MYError #%i: %@",errorCode,message);
+    NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
+                              message, NSLocalizedDescriptionKey,
+                              nil];
+    [message release];
+    return [NSError errorWithDomain: domain
+                               code: errorCode
+                           userInfo: userInfo];
+}
+
+
+NSError *MYError( int errorCode, NSString *domain, NSString *message, ... )
+{
+    va_list args;
+    va_start(args,message);
+    NSError *error = MYMakeErrorV(errorCode,domain,message,args);
+    va_end(args);
+    return error;
+}
+
+
+BOOL MYMiscError( NSError **error, NSString *message, ... )
+{
+    if (error) {
+        va_list args;
+        va_start(args,message);
+        *error = MYMakeErrorV(kMYErrorMisc,MYErrorDomain, message,args);
+        va_end(args);
+    }
+    return NO;
+}
+
+
+static NSString* printableOSType( OSType t ) {
+    if (t < 0x20202020 || t > 0x7e7e7e7e)
+        return nil;
+    union {
+        OSType ostype;
+        unsigned char ch[4];
+    } buf;
+    buf.ostype = CFSwapInt32HostToBig(t);
+    for (int i=0; i<4; i++)
+        if (buf.ch[i] < 0x20 || buf.ch[i] > 0x7E)
+            return nil;
+    return [[[NSString alloc] initWithBytes: &buf.ch length: 4 encoding: NSMacOSRomanStringEncoding]
+            autorelease];
+}
+
+
+static NSString* printableErrorCode( NSInteger code ) {
+    if (code < -99999)
+        return $sprintf(@"%u", code);       // CSSM errors are huge unsigned values > 0x80000000
+    NSString *result = printableOSType((OSType)code);
+    if (result)
+        return result;                      // CoreAudio errors are OSTypes (4-char strings)
+    return $sprintf(@"%i", code);           // Default: OSStatus and errno values are signed
+}
+
+static NSString* MYShortErrorDomainName( NSString *domain ) {
+    if ([domain hasPrefix: @"kCFErrorDomain"])
+        domain = [domain substringFromIndex: 14];
+    else {
+        if ([domain hasSuffix: @"ErrorDomain"])
+            domain = [domain substringToIndex: domain.length - 11];
+        if ([domain hasPrefix: @"NS"])
+            domain = [domain substringFromIndex: 2];
+    }
+    return domain;
+}
+
+NSString* MYErrorName( NSString *domain, NSInteger code ) {
+    if (code == 0)
+        return nil;
+    NSString *codeStr = printableErrorCode(code);
+    if (!domain)
+        return codeStr;
+    NSString *result = nil;
+    
+    if ($equal(domain,NSPOSIXErrorDomain)) {
+        // Interpret POSIX errors via strerror
+        // (which unfortunately returns a description, not the name of the constant)
+        const char *name = strerror(code);
+        if (name) {
+            result = [NSString stringWithCString: name encoding: NSASCIIStringEncoding];
+            if ([result hasPrefix: @"Unknown error"])
+                result = nil;
+        }
+    } 
+#if !TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
+    else if ($equal(domain,NSOSStatusErrorDomain)) {
+        // If it's an OSStatus, check whether CarbonCore knows its name:
+        const char *name = NULL;
+#if !TARGET_OS_IPHONE
+        name = GetMacOSStatusErrorString(code);
+#endif
+        if (name && *name)
+            result = [NSString stringWithCString: name encoding: NSMacOSRomanStringEncoding];
+        else {
+            result = (id) SecCopyErrorMessageString(code,NULL);
+            if (result) {
+                [(id)CFMakeCollectable(result) autorelease];
+                if ([result hasPrefix: @"OSStatus "])
+                    result = nil; // just a generic message
+            }
+        }
+    }
+#endif
+    
+    if (!result) {
+        // Look up errors in string files keyed by the domain name:
+        NSString *table = [@"MYError_" stringByAppendingString: domain];
+        result = [[NSBundle mainBundle] localizedStringForKey: codeStr value: @"?" table: table];
+        if ([result isEqualToString: @"?"])
+            result = nil;
+    }
+    
+    codeStr = $sprintf(@"%@ %@", MYShortErrorDomainName(domain), codeStr);;
+    return result ? $sprintf(@"%@ (%@)", result, codeStr) : codeStr;
+}
+
+
+
+
+@implementation NSError (MYUtils)
+
+- (NSError*) my_errorByPrependingMessage: (NSString*)message
+{
+    if( message.length ) {
+        NSDictionary *oldUserInfo = self.userInfo;
+        NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
+        if( oldUserInfo )
+            [userInfo addEntriesFromDictionary: oldUserInfo];
+        NSString *desc = [oldUserInfo objectForKey: NSLocalizedDescriptionKey];
+        if( desc )
+            message = $sprintf(@"%@: %@", message, desc);
+        [userInfo setObject: message forKey: NSLocalizedDescriptionKey];
+        return [NSError errorWithDomain: self.domain
+                                   code: self.code
+                               userInfo: userInfo];
+    } else
+        return self;
+}
+
+- (NSString*) my_nameOfCode {
+    return MYErrorName(self.domain, self.code);
+}
+
+@end
+
+
+TestCase(MYErrorUtils) {
+    CAssertEqual(printableOSType('abcd'), @"abcd");
+    CAssertEqual(printableOSType('    '), @"    ");
+    CAssertEqual(printableOSType(0x7e7e7e7e), @"~~~~");
+    CAssertEqual(printableOSType(0x7e7F7e7e), nil);
+    CAssertEqual(printableOSType(0x7e0D7e7e), nil);
+    CAssertEqual(printableOSType(0), nil);
+    CAssertEqual(printableOSType((OSType)-123456), nil);
+
+    CAssertEqual(MYErrorName(nil,0),      nil);
+    CAssertEqual(MYErrorName(nil,12345),  @"12345");
+    CAssertEqual(MYErrorName(nil,1),      @"1");
+    CAssertEqual(MYErrorName(nil,-1),     @"-1");
+    CAssertEqual(MYErrorName(nil,12345),  @"12345");
+    CAssertEqual(MYErrorName(nil,-12345), @"-12345");
+    CAssertEqual(MYErrorName(nil,2147549184u), @"2147549184");
+    
+    CAssertEqual(MYErrorName(@"foobar",0), nil);
+    CAssertEqual(MYErrorName(@"foobar",'fmt?'), @"foobar fmt?");
+    CAssertEqual(MYErrorName(@"foobar",1), @"foobar 1");
+    CAssertEqual(MYErrorName(@"FoobarErrorDomain",-1), @"Foobar -1");
+    CAssertEqual(MYErrorName(@"NSFoobarErrorDomain",12345), @"Foobar 12345");
+
+    NSError *err;
+    err = [NSError errorWithDomain: NSPOSIXErrorDomain code: EPERM userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"Operation not permitted (POSIX 1)");
+    err = [NSError errorWithDomain: NSPOSIXErrorDomain code: 12345 userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"POSIX 12345");
+    
+#if !TARGET_OS_IPHONE
+    err = [NSError errorWithDomain: NSOSStatusErrorDomain code: paramErr userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"paramErr (OSStatus -50)");
+    err = [NSError errorWithDomain: NSOSStatusErrorDomain code: fnfErr userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"fnfErr (OSStatus -43)");
+    err = [NSError errorWithDomain: NSOSStatusErrorDomain code: -25291 userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"errKCNotAvailable / errSecNotAvailable (OSStatus -25291)");
+    err = [NSError errorWithDomain: NSOSStatusErrorDomain code: -25260 userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"Passphrase is required for import/export. (OSStatus -25260)");
+#endif
+    err = [NSError errorWithDomain: NSOSStatusErrorDomain code: 12345 userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"OSStatus 12345");
+
+    err = [NSError errorWithDomain: @"CSSMErrorDomain" code: 2147549184u userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"CSSM_CSSM_BASE_ERROR (CSSM 2147549184)");
+
+    err = [NSError errorWithDomain: (id)kCFErrorDomainCocoa code: 100 userInfo: nil];
+    CAssertEqual(err.my_nameOfCode, @"Cocoa 100");
+}

File MYError_CSSMErrorDomain.strings

+/* CSSM Error Constants. */
+
+/* Copied from Keychain.framework, by Wade Tregaskis. --Jens Alfke, 4/2009 */
+
+/* The key is the CSSM error name, as defined in various header files. */
+/* The value is the constant corresponding to the code. */
+
+/* "Standard" error codes defined by the CDSA spec., found in cssmerr.h. */
+
+/* Apple use the private errors as one of their codes... d'oh. */
+
+2147549184 = "CSSM_CSSM_BASE_ERROR";
+2147550208 = "CSSM_CSSM_PRIVATE_ERROR";
+2147551232 = "CSSM_CSP_BASE_ERROR";
+/* 2147552256 = "CSSM_CSP_PRIVATE_ERROR"; */
+2147553280 = "CSSM_DL_BASE_ERROR";
+/* 2147554304 = "CSSM_DL_PRIVATE_ERROR"; */
+2147555328 = "CSSM_CL_BASE_ERROR";
+2147556352 = "CSSM_CL_PRIVATE_ERROR";
+2147557376 = "CSSM_TP_BASE_ERROR";
+/* 2147558400 = "CSSM_TP_PRIVATE_ERROR"; */
+2147559424 = "CSSM_KR_BASE_ERROR";
+2147560448 = "CSSM_KR_PRIVATE_ERROR";
+2147561472 = "CSSM_AC_BASE_ERROR";
+2147562496 = "CSSM_AC_PRIVATE_ERROR";
+
+2147549441 = "CSSMERR_CSSM_INVALID_ADDIN_HANDLE";
+2147549442 = "CSSMERR_CSSM_NOT_INITIALIZED";
+2147549443 = "CSSMERR_CSSM_INVALID_HANDLE_USAGE";
+2147549444 = "CSSMERR_CSSM_PVC_REFERENT_NOT_FOUND";
+2147549445 = "CSSMERR_CSSM_FUNCTION_INTEGRITY_FAIL";
+
+1 = "CSSM_ERRCODE_INTERNAL_ERROR";
+2 = "CSSM_ERRCODE_MEMORY_ERROR";
+3 = "CSSM_ERRCODE_MDS_ERROR";
+4 = "CSSM_ERRCODE_INVALID_POINTER";
+5 = "CSSM_ERRCODE_INVALID_INPUT_POINTER";
+6 = "CSSM_ERRCODE_INVALID_OUTPUT_POINTER";
+7 = "CSSM_ERRCODE_FUNCTION_NOT_IMPLEMENTED";
+8 = "CSSM_ERRCODE_SELF_CHECK_FAILED";
+9 = "CSSM_ERRCODE_OS_ACCESS_DENIED";
+10 = "CSSM_ERRCODE_FUNCTION_FAILED";
+11 = "CSSM_ERRCODE_MODULE_MANIFEST_VERIFY_FAILED";
+12 = "CSSM_ERRCODE_INVALID_GUID";
+
+32 = "CSSM_ERRCODE_OPERATION_AUTH_DENIED";
+33 = "CSSM_ERRCODE_OBJECT_USE_AUTH_DENIED";
+34 = "CSSM_ERRCODE_OBJECT_MANIP_AUTH_DENIED";
+35 = "CSSM_ERRCODE_OBJECT_ACL_NOT_SUPPORTED";
+36 = "CSSM_ERRCODE_OBJECT_ACL_REQUIRED";
+37 = "CSSM_ERRCODE_INVALID_ACCESS_CREDENTIALS";
+38 = "CSSM_ERRCODE_INVALID_ACL_BASE_CERTS";
+39 = "CSSM_ERRCODE_ACL_BASE_CERTS_NOT_SUPPORTED";
+40 = "CSSM_ERRCODE_INVALID_SAMPLE_VALUE";
+41 = "CSSM_ERRCODE_SAMPLE_VALUE_NOT_SUPPORTED";
+42 = "CSSM_ERRCODE_INVALID_ACL_SUBJECT_VALUE";
+43 = "CSSM_ERRCODE_ACL_SUBJECT_TYPE_NOT_SUPPORTED";
+44 = "CSSM_ERRCODE_INVALID_ACL_CHALLENGE_CALLBACK";
+45 = "CSSM_ERRCODE_ACL_CHALLENGE_CALLBACK_FAILED";
+46 = "CSSM_ERRCODE_INVALID_ACL_ENTRY_TAG";
+47 = "CSSM_ERRCODE_ACL_ENTRY_TAG_NOT_FOUND";
+48 = "CSSM_ERRCODE_INVALID_ACL_EDIT_MODE";
+49 = "CSSM_ERRCODE_ACL_CHANGE_FAILED";
+50 = "CSSM_ERRCODE_INVALID_NEW_ACL_ENTRY";
+51 = "CSSM_ERRCODE_INVALID_NEW_ACL_OWNER";
+52 = "CSSM_ERRCODE_ACL_DELETE_FAILED";
+53 = "CSSM_ERRCODE_ACL_REPLACE_FAILED";
+54 = "CSSM_ERRCODE_ACL_ADD_FAILED";
+
+64 = "CSSM_ERRCODE_INVALID_CONTEXT_HANDLE";
+65 = "CSSM_ERRCODE_INCOMPATIBLE_VERSION";
+66 = "CSSM_ERRCODE_INVALID_CERTGROUP_POINTER";
+67 = "CSSM_ERRCODE_INVALID_CERT_POINTER";
+68 = "CSSM_ERRCODE_INVALID_CRL_POINTER";
+69 = "CSSM_ERRCODE_INVALID_FIELD_POINTER";
+70 = "CSSM_ERRCODE_INVALID_DATA";
+71 = "CSSM_ERRCODE_CRL_ALREADY_SIGNED";
+72 = "CSSM_ERRCODE_INVALID_NUMBER_OF_FIELDS";
+73 = "CSSM_ERRCODE_VERIFICATION_FAILURE";
+74 = "CSSM_ERRCODE_INVALID_DB_HANDLE";
+75 = "CSSM_ERRCODE_PRIVILEGE_NOT_GRANTED";
+76 = "CSSM_ERRCODE_INVALID_DB_LIST";
+77 = "CSSM_ERRCODE_INVALID_DB_LIST_POINTER";
+78 = "CSSM_ERRCODE_UNKNOWN_FORMAT";
+79 = "CSSM_ERRCODE_UNKNOWN_TAG";
+80 = "CSSM_ERRCODE_INVALID_CSP_HANDLE";
+81 = "CSSM_ERRCODE_INVALID_DL_HANDLE";
+82 = "CSSM_ERRCODE_INVALID_CL_HANDLE";
+83 = "CSSM_ERRCODE_INVALID_TP_HANDLE";
+84 = "CSSM_ERRCODE_INVALID_KR_HANDLE";
+85 = "CSSM_ERRCODE_INVALID_AC_HANDLE";
+86 = "CSSM_ERRCODE_INVALID_PASSTHROUGH_ID";
+87 = "CSSM_ERRCODE_INVALID_NETWORK_ADDR";
+88 = "CSSM_ERRCODE_INVALID_CRYPTO_DATA";
+
+2147549185 = "CSSMERR_CSSM_INTERNAL_ERROR";
+2147549186 = "CSSMERR_CSSM_MEMORY_ERROR";
+2147549187 = "CSSMERR_CSSM_MDS_ERROR";
+2147549188 = "CSSMERR_CSSM_INVALID_POINTER";
+2147549189 = "CSSMERR_CSSM_INVALID_INPUT_POINTER";
+2147549190 = "CSSMERR_CSSM_INVALID_OUTPUT_POINTER";
+2147549191 = "CSSMERR_CSSM_FUNCTION_NOT_IMPLEMENTED";
+2147549192 = "CSSMERR_CSSM_SELF_CHECK_FAILED";
+2147549193 = "CSSMERR_CSSM_OS_ACCESS_DENIED";
+2147549194 = "CSSMERR_CSSM_FUNCTION_FAILED";
+2147549195 = "CSSMERR_CSSM_MODULE_MANIFEST_VERIFY_FAILED";
+2147549196 = "CSSMERR_CSSM_INVALID_GUID";
+
+2147549248 = "CSSMERR_CSSM_INVALID_CONTEXT_HANDLE";
+2147549249 = "CSSMERR_CSSM_INCOMPATIBLE_VERSION";
+2147549259 = "CSSMERR_CSSM_PRIVILEGE_NOT_GRANTED";
+
+2147549456 = "CSSM_CSSM_BASE_CSSM_ERROR";
+2147549457 = "CSSMERR_CSSM_SCOPE_NOT_SUPPORTED";
+2147549458 = "CSSMERR_CSSM_PVC_ALREADY_CONFIGURED";
+2147549459 = "CSSMERR_CSSM_INVALID_PVC";
+2147549460 = "CSSMERR_CSSM_EMM_LOAD_FAILED";
+2147549461 = "CSSMERR_CSSM_EMM_UNLOAD_FAILED";
+2147549462 = "CSSMERR_CSSM_ADDIN_LOAD_FAILED";
+2147549463 = "CSSMERR_CSSM_INVALID_KEY_HIERARCHY";
+2147549464 = "CSSMERR_CSSM_ADDIN_UNLOAD_FAILED";
+2147549465 = "CSSMERR_CSSM_LIB_REF_NOT_FOUND";
+2147549466 = "CSSMERR_CSSM_INVALID_ADDIN_FUNCTION_TABLE";
+2147549467 = "CSSMERR_CSSM_EMM_AUTHENTICATE_FAILED";
+2147549468 = "CSSMERR_CSSM_ADDIN_AUTHENTICATE_FAILED";
+2147549469 = "CSSMERR_CSSM_INVALID_SERVICE_MASK";
+2147549470 = "CSSMERR_CSSM_MODULE_NOT_LOADED";
+2147549471 = "CSSMERR_CSSM_INVALID_SUBSERVICEID";
+2147549472 = "CSSMERR_CSSM_BUFFER_TOO_SMALL";
+2147549473 = "CSSMERR_CSSM_INVALID_ATTRIBUTE";
+2147549474 = "CSSMERR_CSSM_ATTRIBUTE_NOT_IN_CONTEXT";
+2147549475 = "CSSMERR_CSSM_MODULE_MANAGER_INITIALIZE_FAIL";
+2147549476 = "CSSMERR_CSSM_MODULE_MANAGER_NOT_FOUND";
+2147549477 = "CSSMERR_CSSM_EVENT_NOTIFICATION_CALLBACK_NOT_FOUND";
+
+2147557377 = "CSSMERR_TP_INTERNAL_ERROR";
+2147557378 = "CSSMERR_TP_MEMORY_ERROR";
+2147557379 = "CSSMERR_TP_MDS_ERROR";
+2147557380 = "CSSMERR_TP_INVALID_POINTER";
+2147557381 = "CSSMERR_TP_INVALID_INPUT_POINTER";
+2147557382 = "CSSMERR_TP_INVALID_OUTPUT_POINTER";
+2147557383 = "CSSMERR_TP_FUNCTION_NOT_IMPLEMENTED";
+2147557384 = "CSSMERR_TP_SELF_CHECK_FAILED";
+2147557385 = "CSSMERR_TP_OS_ACCESS_DENIED";
+2147557386 = "CSSMERR_TP_FUNCTION_FAILED";
+
+/* Proof:
+    CSSMERR_TP_FUNCTION_FAILED = CSSM_TP_BASE_ERROR + CSSM_ERRCODE_FUNCTION_FAILED
+                               = CSSM_CL_BASE_ERROR + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRCODE_FUNCTION_FAILED
+                               = CSSM_DL_BASE_ERROR + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRCODE_FUNCTION_FAILED
+                               = CSSM_CSP_BASE_ERROR + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRCODE_FUNCTION_FAILED
+                               = CSSM_CSSM_BASE_ERROR + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRCODE_FUNCTION_FAILED
+                               = CSSM_BASE_ERROR + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRORCODE_MODULE_EXTENT + CSSM_ERRCODE_FUNCTION_FAILED
+                               = 0x80010000 + 0x00000800 + 0x00000800 + 0x00000800 + 0x00000800 + 0x000A
+                               = 0x8001200A
+                               = 2147557386  (Q.E.D.) */
+
+2147557440 = "CSSMERR_TP_INVALID_CONTEXT_HANDLE";
+2147557442 = "CSSMERR_TP_INVALID_CERTGROUP_POINTER";
+2147557443 = "CSSMERR_TP_INVALID_CERT_POINTER";
+2147557444 = "CSSMERR_TP_INVALID_CRL_POINTER";
+2147557445 = "CSSMERR_TP_INVALID_FIELD_POINTER";
+2147557446 = "CSSMERR_TP_INVALID_DATA";
+2147557447 = "CSSMERR_TP_CRL_ALREADY_SIGNED";
+2147557448 = "CSSMERR_TP_INVALID_NUMBER_OF_FIELDS";
+2147557449 = "CSSMERR_TP_VERIFICATION_FAILURE";
+2147557450 = "CSSMERR_TP_INVALID_DB_HANDLE";
+2147557452 = "CSSMERR_TP_INVALID_DB_LIST";
+2147557453 = "CSSMERR_TP_INVALID_DB_LIST_POINTER";
+2147557454 = "CSSMERR_TP_UNKNOWN_FORMAT";
+2147557455 = "CSSMERR_TP_UNKNOWN_TAG";
+2147557456 = "CSSMERR_TP_INVALID_CSP_HANDLE";
+2147557457 = "CSSMERR_TP_INVALID_DL_HANDLE";
+2147557458 = "CSSMERR_TP_INVALID_CL_HANDLE";
+2147557462 = "CSSMERR_TP_INVALID_PASSTHROUGH_ID";
+2147557463 = "CSSMERR_TP_INVALID_NETWORK_ADDR";
+
+2147557632 = "CSSM_TP_BASE_TP_ERROR";
+2147557633 = "CSSMERR_TP_INVALID_CALLERAUTH_CONTEXT_POINTER";
+2147557634 = "CSSMERR_TP_INVALID_IDENTIFIER_POINTER";
+2147557635 = "CSSMERR_TP_INVALID_KEYCACHE_HANDLE";
+2147557636 = "CSSMERR_TP_INVALID_CERTGROUP";
+2147557637 = "CSSMERR_TP_INVALID_CRLGROUP";
+2147557638 = "CSSMERR_TP_INVALID_CRLGROUP_POINTER";
+2147557639 = "CSSMERR_TP_AUTHENTICATION_FAILED";
+2147557640 = "CSSMERR_TP_CERTGROUP_INCOMPLETE";
+2147557641 = "CSSMERR_TP_CERTIFICATE_CANT_OPERATE";
+2147557642 = "CSSMERR_TP_CERT_EXPIRED";
+2147557643 = "CSSMERR_TP_CERT_NOT_VALID_YET";
+2147557644 = "CSSMERR_TP_CERT_REVOKED";
+2147557645 = "CSSMERR_TP_CERT_SUSPENDED";
+2147557646 = "CSSMERR_TP_INSUFFICIENT_CREDENTIALS";
+2147557647 = "CSSMERR_TP_INVALID_ACTION";
+2147557648 = "CSSMERR_TP_INVALID_ACTION_DATA";
+2147557649 = "CSSMERR_TP_INVALID_NETWORK_ADDR";
+2147557650 = "CSSMERR_TP_INVALID_ANCHOR_CERT";
+2147557651 = "CSSMERR_TP_INVALID_AUTHORITY";
+2147557652 = "CSSMERR_TP_VERIFY_ACTION_FAILED";
+2147557653 = "CSSMERR_TP_INVALID_CERTIFICATE";
+2147557654 = "CSSMERR_TP_INVALID_CERT_AUTHORITY";
+2147557655 = "CSSMERR_TP_INVALID_CRL_AUTHORITY";
+2147557656 = "CSSMERR_TP_INVALID_CRL_ENCODING";
+2147557657 = "CSSMERR_TP_INVALID_CRL_TYPE";
+2147557658 = "CSSMERR_TP_INVALID_CRL";
+2147557659 = "CSSMERR_TP_INVALID_FORM_TYPE";
+2147557660 = "CSSMERR_TP_INVALID_ID";
+2147557661 = "CSSMERR_TP_INVALID_IDENTIFIER";
+2147557662 = "CSSMERR_TP_INVALID_INDEX";
+2147557663 = "CSSMERR_TP_INVALID_NAME";
+2147557664 = "CSSMERR_TP_INVALID_POLICY_IDENTIFIERS";
+2147557665 = "CSSMERR_TP_INVALID_TIMESTRING";
+2147557666 = "CSSMERR_TP_INVALID_REASON";
+2147557667 = "CSSMERR_TP_INVALID_REQUEST_INPUTS";
+2147557668 = "CSSMERR_TP_INVALID_RESPONSE_VECTOR";
+2147557669 = "CSSMERR_TP_INVALID_SIGNATURE";
+2147557670 = "CSSMERR_TP_INVALID_STOP_ON_POLICY";
+2147557671 = "CSSMERR_TP_INVALID_CALLBACK";
+2147557672 = "CSSMERR_TP_INVALID_TUPLE";
+2147557673 = "CSSMERR_TP_NOT_SIGNER";
+2147557674 = "CSSMERR_TP_NOT_TRUSTED";
+2147557675 = "CSSMERR_TP_NO_DEFAULT_AUTHORITY";
+2147557676 = "CSSMERR_TP_REJECTED_FORM";
+2147557677 = "CSSMERR_TP_REQUEST_LOST";
+2147557678 = "CSSMERR_TP_REQUEST_REJECTED";
+2147557679 = "CSSMERR_TP_UNSUPPORTED_ADDR_TYPE";
+2147557680 = "CSSMERR_TP_UNSUPPORTED_SERVICE";
+2147557681 = "CSSMERR_TP_INVALID_TUPLEGROUP_POINTER";
+2147557682 = "CSSMERR_TP_INVALID_TUPLEGROUP";
+
+2147561473 = "CSSMERR_AC_INTERNAL_ERROR";
+2147561474 = "CSSMERR_AC_MEMORY_ERROR";
+2147561475 = "CSSMERR_AC_MDS_ERROR";
+2147561476 = "CSSMERR_AC_INVALID_POINTER";
+2147561477 = "CSSMERR_AC_INVALID_INPUT_POINTER";
+2147561478 = "CSSMERR_AC_INVALID_OUTPUT_POINTER";
+2147561479 = "CSSMERR_AC_FUNCTION_NOT_IMPLEMENTED";
+2147561480 = "CSSMERR_AC_SELF_CHECK_FAILED";
+2147561481 = "CSSMERR_AC_OS_ACCESS_DENIED";
+2147561482 = "CSSMERR_AC_FUNCTION_FAILED";
+
+2147561536 = "CSSMERR_AC_INVALID_CONTEXT_HANDLE";
+2147561542 = "CSSMERR_AC_INVALID_DATA";
+2147561546 = "CSSMERR_AC_INVALID_DB_HANDLE";
+2147561548 = "CSSMERR_AC_INVALID_DB_LIST";
+2147561549 = "CSSMERR_AC_INVALID_DB_LIST_POINTER";
+2147561553 = "CSSMERR_AC_INVALID_DL_HANDLE";
+2147561554 = "CSSMERR_AC_INVALID_CL_HANDLE";
+2147561555 = "CSSMERR_AC_INVALID_TP_HANDLE";
+2147561558 = "CSSMERR_AC_INVALID_PASSTHROUGH_ID";
+
+2147561728 = "CSSM_AC_BASE_AC_ERROR";
+2147561729 = "CSSMERR_AC_INVALID_BASE_ACLS";
+2147561730 = "CSSMERR_AC_INVALID_TUPLE_CREDENTIALS";
+2147561731 = "CSSMERR_AC_INVALID_ENCODING";
+2147561732 = "CSSMERR_AC_INVALID_VALIDITY_PERIOD";
+2147561733 = "CSSMERR_AC_INVALID_REQUESTOR";
+2147561734 = "CSSMERR_AC_INVALID_REQUEST_DESCRIPTOR";
+
+2147555329 = "CSSMERR_CL_INTERNAL_ERROR";
+2147555330 = "CSSMERR_CL_MEMORY_ERROR";
+2147555331 = "CSSMERR_CL_MDS_ERROR";
+2147555332 = "CSSMERR_CL_INVALID_POINTER";
+2147555333 = "CSSMERR_CL_INVALID_INPUT_POINTER";
+2147555334 = "CSSMERR_CL_INVALID_OUTPUT_POINTER";
+2147555335 = "CSSMERR_CL_FUNCTION_NOT_IMPLEMENTED";
+2147555336 = "CSSMERR_CL_SELF_CHECK_FAILED";
+2147555337 = "CSSMERR_CL_OS_ACCESS_DENIED";
+2147555338 = "CSSMERR_CL_FUNCTION_FAILED";
+
+2147555392 = "CSSMERR_CL_INVALID_CONTEXT_HANDLE";
+2147555394 = "CSSMERR_CL_INVALID_CERTGROUP_POINTER";
+2147555395 = "CSSMERR_CL_INVALID_CERT_POINTER";
+2147555396 = "CSSMERR_CL_INVALID_CRL_POINTER";
+2147555397 = "CSSMERR_CL_INVALID_FIELD_POINTER";
+2147555398 = "CSSMERR_CL_INVALID_DATA";
+2147555399 = "CSSMERR_CL_CRL_ALREADY_SIGNED";
+2147555400 = "CSSMERR_CL_INVALID_NUMBER_OF_FIELDS";
+2147555401 = "CSSMERR_CL_VERIFICATION_FAILURE";
+2147555406 = "CSSMERR_CL_UNKNOWN_FORMAT";
+2147555407 = "CSSMERR_CL_UNKNOWN_TAG";
+2147555414 = "CSSMERR_CL_INVALID_PASSTHROUGH_ID";
+
+2147555584 = "CSSM_CL_BASE_CL_ERROR";
+2147555585 = "CSSMERR_CL_INVALID_BUNDLE_POINTER";
+2147555586 = "CSSMERR_CL_INVALID_CACHE_HANDLE";
+2147555587 = "CSSMERR_CL_INVALID_RESULTS_HANDLE";
+2147555588 = "CSSMERR_CL_INVALID_BUNDLE_INFO";
+2147555589 = "CSSMERR_CL_INVALID_CRL_INDEX";
+2147555590 = "CSSMERR_CL_INVALID_SCOPE";
+2147555591 = "CSSMERR_CL_NO_FIELD_VALUES";
+2147555592 = "CSSMERR_CL_SCOPE_NOT_SUPPORTED";
+
+2147553281 = "CSSMERR_DL_INTERNAL_ERROR";
+2147553282 = "CSSMERR_DL_MEMORY_ERROR";
+2147553283 = "CSSMERR_DL_MDS_ERROR";
+2147553284 = "CSSMERR_DL_INVALID_POINTER";
+2147553285 = "CSSMERR_DL_INVALID_INPUT_POINTER";
+2147553286 = "CSSMERR_DL_INVALID_OUTPUT_POINTER";
+2147553287 = "CSSMERR_DL_FUNCTION_NOT_IMPLEMENTED";
+2147553288 = "CSSMERR_DL_SELF_CHECK_FAILED";
+2147553289 = "CSSMERR_DL_OS_ACCESS_DENIED";
+2147553290 = "CSSMERR_DL_FUNCTION_FAILED";
+2147553360 = "CSSMERR_DL_INVALID_CSP_HANDLE";
+2147553361 = "CSSMERR_DL_INVALID_DL_HANDLE";
+2147553362 = "CSSMERR_DL_INVALID_CL_HANDLE";
+2147553357 = "CSSMERR_DL_INVALID_DB_LIST_POINTER";
+
+2147553312 = "CSSMERR_DL_OPERATION_AUTH_DENIED";
+2147553313 = "CSSMERR_DL_OBJECT_USE_AUTH_DENIED";
+2147553314 = "CSSMERR_DL_OBJECT_MANIP_AUTH_DENIED";
+2147553315 = "CSSMERR_DL_OBJECT_ACL_NOT_SUPPORTED";
+2147553316 = "CSSMERR_DL_OBJECT_ACL_REQUIRED";
+2147553317 = "CSSMERR_DL_INVALID_ACCESS_CREDENTIALS";
+2147553318 = "CSSMERR_DL_INVALID_ACL_BASE_CERTS";
+2147553319 = "CSSMERR_DL_ACL_BASE_CERTS_NOT_SUPPORTED";
+2147553320 = "CSSMERR_DL_INVALID_SAMPLE_VALUE";
+2147553321 = "CSSMERR_DL_SAMPLE_VALUE_NOT_SUPPORTED";
+2147553322 = "CSSMERR_DL_INVALID_ACL_SUBJECT_VALUE";
+2147553323 = "CSSMERR_DL_ACL_SUBJECT_TYPE_NOT_SUPPORTED";
+2147553324 = "CSSMERR_DL_INVALID_ACL_CHALLENGE_CALLBACK";
+2147553325 = "CSSMERR_DL_ACL_CHALLENGE_CALLBACK_FAILED";
+2147553326 = "CSSMERR_DL_INVALID_ACL_ENTRY_TAG";
+2147553327 = "CSSMERR_DL_ACL_ENTRY_TAG_NOT_FOUND";
+2147553328 = "CSSMERR_DL_INVALID_ACL_EDIT_MODE";
+2147553329 = "CSSMERR_DL_ACL_CHANGE_FAILED";
+2147553330 = "CSSMERR_DL_INVALID_NEW_ACL_ENTRY";
+2147553331 = "CSSMERR_DL_INVALID_NEW_ACL_OWNER";
+2147553332 = "CSSMERR_DL_ACL_DELETE_FAILED";
+2147553333 = "CSSMERR_DL_ACL_REPLACE_FAILED";
+2147553334 = "CSSMERR_DL_ACL_ADD_FAILED";
+
+2147553352 = "CSSMERR_DL_INVALID_DB_HANDLE";
+2147553366 = "CSSMERR_DL_INVALID_PASSTHROUGH_ID";
+2147553367 = "CSSMERR_DL_INVALID_NETWORK_ADDR";
+
+2147553536 = "CSSM_DL_BASE_DL_ERROR";
+2147553537 = "CSSMERR_DL_DATABASE_CORRUPT";
+2147553544 = "CSSMERR_DL_INVALID_RECORD_INDEX";
+2147553545 = "CSSMERR_DL_INVALID_RECORDTYPE";
+2147553546 = "CSSMERR_DL_INVALID_FIELD_NAME";
+2147553547 = "CSSMERR_DL_UNSUPPORTED_FIELD_FORMAT";
+2147553548 = "CSSMERR_DL_UNSUPPORTED_INDEX_INFO";
+2147553549 = "CSSMERR_DL_UNSUPPORTED_LOCALITY";
+2147553550 = "CSSMERR_DL_UNSUPPORTED_NUM_ATTRIBUTES";
+2147553551 = "CSSMERR_DL_UNSUPPORTED_NUM_INDEXES";
+2147553552 = "CSSMERR_DL_UNSUPPORTED_NUM_RECORDTYPES";
+2147553553 = "CSSMERR_DL_UNSUPPORTED_RECORDTYPE";
+2147553554 = "CSSMERR_DL_FIELD_SPECIFIED_MULTIPLE";
+2147553555 = "CSSMERR_DL_INCOMPATIBLE_FIELD_FORMAT";
+2147553556 = "CSSMERR_DL_INVALID_PARSING_MODULE";
+
+2147553558 = "CSSMERR_DL_INVALID_DB_NAME";
+2147553559 = "CSSMERR_DL_DATASTORE_DOESNOT_EXIST";
+2147553560 = "CSSMERR_DL_DATASTORE_ALREADY_EXISTS";
+2147553561 = "CSSMERR_DL_DB_LOCKED";
+2147553562 = "CSSMERR_DL_DATASTORE_IS_OPEN";
+2147553563 = "CSSMERR_DL_RECORD_NOT_FOUND";
+2147553564 = "CSSMERR_DL_MISSING_VALUE";
+2147553565 = "CSSMERR_DL_UNSUPPORTED_QUERY";
+2147553566 = "CSSMERR_DL_UNSUPPORTED_QUERY_LIMITS";
+2147553567 = "CSSMERR_DL_UNSUPPORTED_NUM_SELECTION_PREDS";
+
+2147553569 = "CSSMERR_DL_UNSUPPORTED_OPERATOR";
+2147553570 = "CSSMERR_DL_INVALID_RESULTS_HANDLE";
+2147553571 = "CSSMERR_DL_INVALID_DB_LOCATION";
+2147553572 = "CSSMERR_DL_INVALID_ACCESS_REQUEST";
+2147553573 = "CSSMERR_DL_INVALID_INDEX_INFO";
+2147553574 = "CSSMERR_DL_INVALID_SELECTION_TAG";
+2147553575 = "CSSMERR_DL_INVALID_NEW_OWNER";
+2147553576 = "CSSMERR_DL_INVALID_RECORD_UID";
+2147553577 = "CSSMERR_DL_INVALID_UNIQUE_INDEX_DATA";
+2147553578 = "CSSMERR_DL_INVALID_MODIFY_MODE";
+2147553579 = "CSSMERR_DL_INVALID_OPEN_PARAMETERS";
+2147553580 = "CSSMERR_DL_RECORD_MODIFIED";
+2147553581 = "CSSMERR_DL_ENDOFDATA";
+2147553582 = "CSSMERR_DL_INVALID_QUERY";
+2147553583 = "CSSMERR_DL_INVALID_VALUE";
+2147553584 = "CSSMERR_DL_MULTIPLE_VALUES_UNSUPPORTED";
+2147553585 = "CSSMERR_DL_STALE_UNIQUE_RECORD";
+
+2147551233 = "CSSMERR_CSP_INTERNAL_ERROR";
+2147551234 = "CSSMERR_CSP_MEMORY_ERROR";
+2147551235 = "CSSMERR_CSP_MDS_ERROR";
+2147551236 = "CSSMERR_CSP_INVALID_POINTER";
+2147551237 = "CSSMERR_CSP_INVALID_INPUT_POINTER";
+2147551238 = "CSSMERR_CSP_INVALID_OUTPUT_POINTER";
+2147551239 = "CSSMERR_CSP_FUNCTION_NOT_IMPLEMENTED";
+2147551240 = "CSSMERR_CSP_SELF_CHECK_FAILED";
+2147551241 = "CSSMERR_CSP_OS_ACCESS_DENIED";
+2147551242 = "CSSMERR_CSP_FUNCTION_FAILED";
+
+2147551264 = "CSSMERR_CSP_OPERATION_AUTH_DENIED";
+2147551265 = "CSSMERR_CSP_OBJECT_USE_AUTH_DENIED";
+2147551266 = "CSSMERR_CSP_OBJECT_MANIP_AUTH_DENIED";
+2147551267 = "CSSMERR_CSP_OBJECT_ACL_NOT_SUPPORTED";
+2147551268 = "CSSMERR_CSP_OBJECT_ACL_REQUIRED";
+2147551269 = "CSSMERR_CSP_INVALID_ACCESS_CREDENTIALS";
+2147551270 = "CSSMERR_CSP_INVALID_ACL_BASE_CERTS";
+2147551271 = "CSSMERR_CSP_ACL_BASE_CERTS_NOT_SUPPORTED";
+2147551272 = "CSSMERR_CSP_INVALID_SAMPLE_VALUE";
+2147551273 = "CSSMERR_CSP_SAMPLE_VALUE_NOT_SUPPORTED";
+2147551274 = "CSSMERR_CSP_INVALID_ACL_SUBJECT_VALUE";
+2147551275 = "CSSMERR_CSP_ACL_SUBJECT_TYPE_NOT_SUPPORTED";
+2147551276 = "CSSMERR_CSP_INVALID_ACL_CHALLENGE_CALLBACK";
+2147551277 = "CSSMERR_CSP_ACL_CHALLENGE_CALLBACK_FAILED";
+2147551278 = "CSSMERR_CSP_INVALID_ACL_ENTRY_TAG";
+2147551279 = "CSSMERR_CSP_ACL_ENTRY_TAG_NOT_FOUND";
+2147551280 = "CSSMERR_CSP_INVALID_ACL_EDIT_MODE";
+2147551281 = "CSSMERR_CSP_ACL_CHANGE_FAILED";
+2147551282 = "CSSMERR_CSP_INVALID_NEW_ACL_ENTRY";
+2147551283 = "CSSMERR_CSP_INVALID_NEW_ACL_OWNER";
+2147551284 = "CSSMERR_CSP_ACL_DELETE_FAILED";
+2147551285 = "CSSMERR_CSP_ACL_REPLACE_FAILED";
+2147551286 = "CSSMERR_CSP_ACL_ADD_FAILED";
+
+2147551296 = "CSSMERR_CSP_INVALID_CONTEXT_HANDLE";
+2147551307 = "CSSMERR_CSP_PRIVILEGE_NOT_GRANTED";
+2147551302 = "CSSMERR_CSP_INVALID_DATA";
+2147551318 = "CSSMERR_CSP_INVALID_PASSTHROUGH_ID";
+2147551320 = "CSSMERR_CSP_INVALID_CRYPTO_DATA";
+
+2147551488 = "CSSM_CSP_BASE_CSP_ERROR";
+2147551489 = "CSSMERR_CSP_INPUT_LENGTH_ERROR";
+2147551490 = "CSSMERR_CSP_OUTPUT_LENGTH_ERROR";
+2147551491 = "CSSMERR_CSP_PRIVILEGE_NOT_SUPPORTED";
+2147551492 = "CSSMERR_CSP_DEVICE_ERROR";
+2147551493 = "CSSMERR_CSP_DEVICE_MEMORY_ERROR";
+2147551494 = "CSSMERR_CSP_ATTACH_HANDLE_BUSY";
+2147551495 = "CSSMERR_CSP_NOT_LOGGED_IN";
+
+2147551506 = "CSSMERR_CSP_INVALID_KEY";
+2147551507 = "CSSMERR_CSP_INVALID_KEY_REFERENCE";
+2147551508 = "CSSMERR_CSP_INVALID_KEY_CLASS";
+2147551509 = "CSSMERR_CSP_ALGID_MISMATCH";
+2147551510 = "CSSMERR_CSP_KEY_USAGE_INCORRECT";
+2147551511 = "CSSMERR_CSP_KEY_BLOB_TYPE_INCORRECT";
+2147551512 = "CSSMERR_CSP_KEY_HEADER_INCONSISTENT";
+2147551513 = "CSSMERR_CSP_UNSUPPORTED_KEY_FORMAT";
+2147551514 = "CSSMERR_CSP_UNSUPPORTED_KEY_SIZE";
+2147551515 = "CSSMERR_CSP_INVALID_KEY_POINTER";
+2147551516 = "CSSMERR_CSP_INVALID_KEYUSAGE_MASK";
+2147551517 = "CSSMERR_CSP_UNSUPPORTED_KEYUSAGE_MASK";
+2147551518 = "CSSMERR_CSP_INVALID_KEYATTR_MASK";
+2147551519 = "CSSMERR_CSP_UNSUPPORTED_KEYATTR_MASK";
+2147551520 = "CSSMERR_CSP_INVALID_KEY_LABEL";
+2147551521 = "CSSMERR_CSP_UNSUPPORTED_KEY_LABEL";
+2147551522 = "CSSMERR_CSP_INVALID_KEY_FORMAT";
+
+2147551528 = "CSSMERR_CSP_INVALID_DATA_COUNT";
+2147551529 = "CSSMERR_CSP_VECTOR_OF_BUFS_UNSUPPORTED";
+2147551530 = "CSSMERR_CSP_INVALID_INPUT_VECTOR";
+2147551531 = "CSSMERR_CSP_INVALID_OUTPUT_VECTOR";
+
+2147551536 = "CSSMERR_CSP_INVALID_CONTEXT";
+2147551537 = "CSSMERR_CSP_INVALID_ALGORITHM";
+2147551542 = "CSSMERR_CSP_INVALID_ATTR_KEY";
+2147551543 = "CSSMERR_CSP_MISSING_ATTR_KEY";
+2147551544 = "CSSMERR_CSP_INVALID_ATTR_INIT_VECTOR";
+2147551545 = "CSSMERR_CSP_MISSING_ATTR_INIT_VECTOR";
+2147551546 = "CSSMERR_CSP_INVALID_ATTR_SALT";
+2147551547 = "CSSMERR_CSP_MISSING_ATTR_SALT";
+2147551548 = "CSSMERR_CSP_INVALID_ATTR_PADDING";
+2147551549 = "CSSMERR_CSP_MISSING_ATTR_PADDING";
+2147551550 = "CSSMERR_CSP_INVALID_ATTR_RANDOM";
+2147551551 = "CSSMERR_CSP_MISSING_ATTR_RANDOM";
+2147551552 = "CSSMERR_CSP_INVALID_ATTR_SEED";
+2147551553 = "CSSMERR_CSP_MISSING_ATTR_SEED";
+2147551554 = "CSSMERR_CSP_INVALID_ATTR_PASSPHRASE";
+2147551555 = "CSSMERR_CSP_MISSING_ATTR_PASSPHRASE";
+2147551556 = "CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH";
+2147551557 = "CSSMERR_CSP_MISSING_ATTR_KEY_LENGTH";
+2147551558 = "CSSMERR_CSP_INVALID_ATTR_BLOCK_SIZE";
+2147551559 = "CSSMERR_CSP_MISSING_ATTR_BLOCK_SIZE";
+2147551560 = "CSSMERR_CSP_STAGED_OPERATION_IN_PROGRESS";
+2147551561 = "CSSMERR_CSP_STAGED_OPERATION_NOT_STARTED";
+2147551562 = "CSSMERR_CSP_VERIFY_FAILED";
+2147551563 = "CSSMERR_CSP_INVALID_SIGNATURE";
+2147551564 = "CSSMERR_CSP_QUERY_SIZE_UNKNOWN";
+2147551565 = "CSSMERR_CSP_BLOCK_SIZE_MISMATCH";
+2147551566 = "CSSMERR_CSP_PRIVATE_KEY_NOT_FOUND";
+2147551567 = "CSSMERR_CSP_PUBLIC_KEY_INCONSISTENT";
+2147551568 = "CSSMERR_CSP_DEVICE_VERIFY_FAILED";
+2147551569 = "CSSMERR_CSP_INVALID_LOGIN_NAME";
+2147551570 = "CSSMERR_CSP_ALREADY_LOGGED_IN";
+2147551571 = "CSSMERR_CSP_PRIVATE_KEY_ALREADY_EXISTS";
+2147551572 = "CSSMERR_CSP_KEY_LABEL_ALREADY_EXISTS";
+2147551573 = "CSSMERR_CSP_INVALID_DIGEST_ALGORITHM";
+2147551574 = "CSSMERR_CSP_CRYPTO_DATA_CALLBACK_FAILED";
+
+2147551588 = "CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE";
+2147551589 = "CSSMERR_CSP_MISSING_ATTR_OUTPUT_SIZE";
+2147551590 = "CSSMERR_CSP_INVALID_ATTR_ROUNDS";
+2147551591 = "CSSMERR_CSP_MISSING_ATTR_ROUNDS";
+2147551592 = "CSSMERR_CSP_INVALID_ATTR_ALG_PARAMS";
+2147551593 = "CSSMERR_CSP_MISSING_ATTR_ALG_PARAMS";
+2147551594 = "CSSMERR_CSP_INVALID_ATTR_LABEL";
+2147551595 = "CSSMERR_CSP_MISSING_ATTR_LABEL";
+2147551596 = "CSSMERR_CSP_INVALID_ATTR_KEY_TYPE";
+2147551597 = "CSSMERR_CSP_MISSING_ATTR_KEY_TYPE";
+2147551598 = "CSSMERR_CSP_INVALID_ATTR_MODE";
+2147551599 = "CSSMERR_CSP_MISSING_ATTR_MODE";
+2147551600 = "CSSMERR_CSP_INVALID_ATTR_EFFECTIVE_BITS";
+2147551601 = "CSSMERR_CSP_MISSING_ATTR_EFFECTIVE_BITS";
+2147551602 = "CSSMERR_CSP_INVALID_ATTR_START_DATE";
+2147551603 = "CSSMERR_CSP_MISSING_ATTR_START_DATE";
+2147551604 = "CSSMERR_CSP_INVALID_ATTR_END_DATE";
+2147551605 = "CSSMERR_CSP_MISSING_ATTR_END_DATE";
+2147551606 = "CSSMERR_CSP_INVALID_ATTR_VERSION";
+2147551607 = "CSSMERR_CSP_MISSING_ATTR_VERSION";
+2147551608 = "CSSMERR_CSP_INVALID_ATTR_PRIME";
+2147551609 = "CSSMERR_CSP_MISSING_ATTR_PRIME";
+2147551610 = "CSSMERR_CSP_INVALID_ATTR_BASE";
+2147551611 = "CSSMERR_CSP_MISSING_ATTR_BASE";
+2147551612 = "CSSMERR_CSP_INVALID_ATTR_SUBPRIME";
+2147551613 = "CSSMERR_CSP_MISSING_ATTR_SUBPRIME";
+2147551614 = "CSSMERR_CSP_INVALID_ATTR_ITERATION_COUNT";
+2147551615 = "CSSMERR_CSP_MISSING_ATTR_ITERATION_COUNT";
+2147551616 = "CSSMERR_CSP_INVALID_ATTR_DL_DB_HANDLE";
+2147551617 = "CSSMERR_CSP_MISSING_ATTR_DL_DB_HANDLE";
+2147551618 = "CSSMERR_CSP_INVALID_ATTR_ACCESS_CREDENTIALS";
+2147551619 = "CSSMERR_CSP_MISSING_ATTR_ACCESS_CREDENTIALS";
+2147551620 = "CSSMERR_CSP_INVALID_ATTR_PUBLIC_KEY_FORMAT";
+2147551621 = "CSSMERR_CSP_MISSING_ATTR_PUBLIC_KEY_FORMAT";
+2147551622 = "CSSMERR_CSP_INVALID_ATTR_PRIVATE_KEY_FORMAT";
+2147551623 = "CSSMERR_CSP_MISSING_ATTR_PRIVATE_KEY_FORMAT";
+2147551624 = "CSSMERR_CSP_INVALID_ATTR_SYMMETRIC_KEY_FORMAT";
+2147551625 = "CSSMERR_CSP_MISSING_ATTR_SYMMETRIC_KEY_FORMAT";
+2147551626 = "CSSMERR_CSP_INVALID_ATTR_WRAPPED_KEY_FORMAT";
+2147551627 = "CSSMERR_CSP_MISSING_ATTR_WRAPPED_KEY_FORMAT";
+
+/* Apple's error codes, defined in cssmapple.h. */
+
+224 = "CSSM_ERRCODE_NO_USER_INTERACTION";
+225 = "CSSM_ERRCODE_USER_CANCELED";
+226 = "CSSM_ERRCODE_SERVICE_NOT_AVAILABLE";
+227 = "CSSM_ERRCODE_INSUFFICIENT_CLIENT_IDENTIFICATION";
+228 = "CSSM_ERRCODE_DEVICE_RESET";
+229 = "CSSM_ERRCODE_DEVICE_FAILED";
+
+2147549408 = "CSSMERR_CSSM_NO_USER_INTERACTION";
+2147549409 = "CSSMERR_CSSM_USER_CANCELED";
+2147549410 = "CSSMERR_CSSM_SERVICE_NOT_AVAILABLE";
+2147549411 = "CSSMERR_CSSM_INSUFFICIENT_CLIENT_IDENTIFICATION";
+2147549412 = "CSSMERR_CSSM_DEVICE_RESET";
+2147549413 = "CSSMERR_CSSM_DEVICE_FAILED";
+
+2147561696 = "CSSMERR_AC_NO_USER_INTERACTION";
+2147561697 = "CSSMERR_AC_USER_CANCELED";
+2147561698 = "CSSMERR_AC_SERVICE_NOT_AVAILABLE";
+2147561699 = "CSSMERR_AC_INSUFFICIENT_CLIENT_IDENTIFICATION";
+2147561700 = "CSSMERR_AC_DEVICE_RESET";
+2147561701 = "CSSMERR_AC_DEVICE_FAILED";
+
+2147551456 = "CSSMERR_CSP_NO_USER_INTERACTION";
+2147551457 = "CSSMERR_CSP_USER_CANCELED";
+2147551458 = "CSSMERR_CSP_SERVICE_NOT_AVAILABLE";
+2147551459 = "CSSMERR_CSP_INSUFFICIENT_CLIENT_IDENTIFICATION";
+2147551460 = "CSSMERR_CSP_DEVICE_RESET";
+2147551461 = "CSSMERR_CSP_DEVICE_FAILED";
+
+2147555552 = "CSSMERR_CL_NO_USER_INTERACTION";
+2147555553 = "CSSMERR_CL_USER_CANCELED";
+2147555554 = "CSSMERR_CL_SERVICE_NOT_AVAILABLE";
+2147555555 = "CSSMERR_CL_INSUFFICIENT_CLIENT_IDENTIFICATION";
+2147555556 = "CSSMERR_CL_DEVICE_RESET";
+2147555557 = "CSSMERR_CL_DEVICE_FAILED";
+
+2147553504 = "CSSMERR_DL_NO_USER_INTERACTION";
+2147553505 = "CSSMERR_DL_USER_CANCELED";
+2147553506 = "CSSMERR_DL_SERVICE_NOT_AVAILABLE";
+2147553507 = "CSSMERR_DL_INSUFFICIENT_CLIENT_IDENTIFICATION";
+2147553508 = "CSSMERR_DL_DEVICE_RESET";
+2147553509 = "CSSMERR_DL_DEVICE_FAILED";
+
+2147557600 = "CSSMERR_TP_NO_USER_INTERACTION";
+2147557601 = "CSSMERR_TP_USER_CANCELED";
+2147557602 = "CSSMERR_TP_SERVICE_NOT_AVAILABLE";
+2147557603 = "CSSMERR_TP_INSUFFICIENT_CLIENT_IDENTIFICATION";
+2147557604 = "CSSMERR_TP_DEVICE_RESET";
+2147557605 = "CSSMERR_TP_DEVICE_FAILED";
+
+/* Apple's private CSP errors, defined in cssmapple.h. */
+
+2147552256 = "CSSMERR_CSP_APPLE_ADD_APPLICATION_ACL_SUBJECT";
+2147552257 = "CSSMERR_CSP_APPLE_PUBLIC_KEY_INCOMPLETE";
+2147552258 = "CSSMERR_CSP_APPLE_SIGNATURE_MISMATCH";
+2147552259 = "CSSMERR_CSP_APPLE_INVALID_KEY_START_DATE";
+2147552260 = "CSSMERR_CSP_APPLE_INVALID_KEY_END_DATE";
+2147552261 = "CSSMERR_CSPDL_APPLE_DL_CONVERSION_ERROR";
+
+/* Apple's private DL errors, defined in cssmapple.h. */
+
+2147554304 = "CSSMERR_APPLEDL_INVALID_OPEN_PARAMETERS";
+2147554305 = "CSSMERR_APPLEDL_DISK_FULL";
+2147554306 = "CSSMERR_APPLEDL_QUOTA_EXCEEDED";
+2147554307 = "CSSMERR_APPLEDL_FILE_TOO_BIG";
+2147554308 = "CSSMERR_APPLEDL_INVALID_DATABASE_BLOB";
+2147554309 = "CSSMERR_APPLEDL_INVALID_KEY_BLOB";
+2147554310 = "CSSMERR_APPLEDL_INCOMPATIBLE_DATABASE_BLOB";
+2147554311 = "CSSMERR_APPLEDL_INCOMPATIBLE_KEY_BLOB";
+
+/* Apple's private X509 TP errors, defined in cssmapple.h. */
+
+2147558400 = "CSSMERR_APPLETP_HOSTNAME_MISMATCH";
+2147558401 = "CSSMERR_APPLETP_UNKNOWN_CRITICAL_EXTEN";
+2147558402 = "CSSMERR_APPLETP_NO_BASIC_CONSTRAINTS";
+2147558403 = "CSSMERR_APPLETP_INVALID_CA";
+2147558404 = "CSSMERR_APPLETP_INVALID_AUTHORITY_ID";
+2147558405 = "CSSMERR_APPLETP_INVALID_SUBJECT_ID";
+2147558406 = "CSSMERR_APPLETP_INVALID_KEY_USAGE";
+2147558407 = "CSSMERR_APPLETP_INVALID_EXTENDED_KEY_USAGE";
+2147558408 = "CSSMERR_APPLETP_INVALID_ID_LINKAGE";
+2147558409 = "CSSMERR_APPLETP_PATH_LEN_CONSTRAINT";
+2147558410 = "CSSMERR_APPLETP_INVALID_ROOT";
+2147558411 = "CSSMERR_APPLETP_CRL_EXPIRED";
+2147558412 = "CSSMERR_APPLETP_CRL_NOT_VALID_YET";
+2147558413 = "CSSMERR_APPLETP_CRL_NOT_FOUND";
+2147558414 = "CSSMERR_APPLETP_CRL_SERVER_DOWN";
+2147558415 = "CSSMERR_APPLETP_CRL_BAD_URI";
+2147558416 = "CSSMERR_APPLETP_UNKNOWN_CERT_EXTEN";
+2147558417 = "CSSMERR_APPLETP_UNKNOWN_CRL_EXTEN";
+2147558418 = "CSSMERR_APPLETP_CRL_NOT_TRUSTED";
+2147558419 = "CSSMERR_APPLETP_CRL_INVALID_ANCHOR_CERT";
+2147558420 = "CSSMERR_APPLETP_CRL_POLICY_FAIL";
+2147558421 = "CSSMERR_APPLETP_IDP_FAIL";
+2147558422 = "CSSMERR_APPLETP_CERT_NOT_FOUND_FROM_ISSUER";
+2147558423 = "CSSMERR_APPLETP_BAD_CERT_FROM_ISSUER";
+2147558424 = "CSSMERR_APPLETP_SMIME_EMAIL_ADDRS_NOT_FOUND";
+2147558425 = "CSSMERR_APPLETP_SMIME_BAD_EXT_KEY_USE";
+2147558426 = "CSSMERR_APPLETP_SMIME_BAD_KEY_USE";
+2147558427 = "CSSMERR_APPLETP_SMIME_KEYUSAGE_NOT_CRITICAL";
+2147558428 = "CSSMERR_APPLETP_SMIME_NO_EMAIL_ADDRS";
+2147558429 = "CSSMERR_APPLETP_SMIME_SUBJ_ALT_NAME_NOT_CRIT";
+2147558430 = "CSSMERR_APPLETP_SSL_BAD_EXT_KEY_USE";
+2147558431 = "CSSMERR_APPLETP_OCSP_BAD_RESPONSE";
+2147558432 = "CSSMERR_APPLETP_OCSP_BAD_REQUEST";
+2147558433 = "CSSMERR_APPLETP_OCSP_UNAVAILABLE";
+2147558434 = "CSSMERR_APPLETP_OCSP_STATUS_UNRECOGNIZED";
+2147558435 = "CSSMERR_APPLETP_INCOMPLETE_REVOCATION_CHECK";
+2147558436 = "CSSMERR_APPLETP_NETWORK_FAILURE";
+2147558437 = "CSSMERR_APPLETP_OCSP_NOT_TRUSTED";
+2147558438 = "CSSMERR_APPLETP_OCSP_INVALID_ANCHOR_CERT";
+2147558439 = "CSSMERR_APPLETP_OCSP_SIG_ERROR";
+2147558440 = "CSSMERR_APPLETP_OCSP_NO_SIGNER";
+2147558441 = "CSSMERR_APPLETP_OCSP_RESP_MALFORMED_REQ";
+2147558442 = "CSSMERR_APPLETP_OCSP_RESP_INTERNAL_ERR";
+2147558443 = "CSSMERR_APPLETP_OCSP_RESP_TRY_LATER";
+2147558444 = "CSSMERR_APPLETP_OCSP_RESP_SIG_REQUIRED";
+2147558445 = "CSSMERR_APPLETP_OCSP_RESP_UNAUTHORIZED";
+2147558446 = "CSSMERR_APPLETP_OCSP_NONCE_MISMATCH";
+2147558447 = "CSSMERR_APPLETP_CS_BAD_CERT_CHAIN_LENGTH";
+2147558448 = "CSSMERR_APPLETP_CS_NO_BASIC_CONSTRAINTS";
+2147558449 = "CSSMERR_APPLETP_CS_BAD_PATH_LENGTH";
+2147558450 = "CSSMERR_APPLETP_CS_NO_EXTENDED_KEY_USAGE";
+2147558451 = "CSSMERR_APPLETP_CODE_SIGN_DEVELOPMENT";
+
+/* Apple's private .Mac TP errors, defined in cssmapple.h. */
+
+2147558500 = "CSSMERR_APPLE_DOTMAC_REQ_QUEUED";
+2147558501 = "CSSMERR_APPLE_DOTMAC_REQ_REDIRECT";
+2147558502 = "CSSMERR_APPLE_DOTMAC_REQ_SERVER_ERR";
+2147558503 = "CSSMERR_APPLE_DOTMAC_REQ_SERVER_PARAM";
+2147558504 = "CSSMERR_APPLE_DOTMAC_REQ_SERVER_AUTH";
+2147558505 = "CSSMERR_APPLE_DOTMAC_REQ_SERVER_UNIMPL";
+2147558506 = "CSSMERR_APPLE_DOTMAC_REQ_SERVER_NOT_AVAIL";
+2147558507 = "CSSMERR_APPLE_DOTMAC_REQ_SERVER_ALREADY_EXIST";
+2147558508 = "CSSMERR_APPLE_DOTMAC_REQ_SERVER_SERVICE_ERROR";
+2147558509 = "CSSMERR_APPLE_DOTMAC_REQ_IS_PENDING";
+2147558510 = "CSSMERR_APPLE_DOTMAC_NO_REQ_PENDING";

File MYUtilities.xcconfig

+//
+//  MYUtilities.xcconfig
+//  MYUtilities
+//
+//  Created by Jens Alfke on 6/27/08.
+//  Copyright 2008-2009 Jens Alfke. All rights reserved.
+//
+
+
+// Precompiled Headers:
+GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES
+GCC_PRECOMPILE_PREFIX_HEADER = YES
+// GCC_PREFIX_HEADER = MYUtilities_Prefix.pch
+
+// Language:
+GCC_C_LANGUAGE_STANDARD = gnu99
+OTHER_CFLAGS = -fnested-functions -Wmissing-declarations
+OTHER_CPLUSPLUSFLAGS = 
+
+// Warnings:
+GCC_TREAT_WARNINGS_AS_ERRORS = YES
+GCC_WARN_ABOUT_RETURN_TYPE = YES
+GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES
+GCC_WARN_UNUSED_VARIABLE = YES
+WARNING_CFLAGS = -Wall -Wformat-security -Wshorten-64-to-32
+
+// Code generation:
+GCC_INLINES_ARE_PRIVATE_EXTERN = YES
+GCC_SYMBOLS_PRIVATE_EXTERN = YES
+GCC_ENABLE_OBJC_GC = unsupported
+GCC_DYNAMIC_NO_PIC = YES
+GCC_MODEL_TUNING = G5
+PREBINDING = NO
+DEBUG_INFORMATION_FORMAT = dwarf

File MYUtilities_Debug.xcconfig

+//
+//  MYUtilities_Debug.xcconfig
+//  MYUtilities
+//
+//  Created by Jens Alfke on 6/27/08.
+//  Copyright 2008-2009 Jens Alfke. All rights reserved.
+//
+
+#include "MYUtilities.xcconfig"
+
+GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
+
+GCC_OPTIMIZATION_LEVEL = 0
+
+COPY_PHASE_STRIP = NO

File MYUtilities_Release.xcconfig

+//
+//  MYUtilities_Release.xcconfig
+//  MYUtilities
+//
+//  Created by Jens Alfke on 6/27/08.
+//  Copyright 2008-2009 Jens Alfke. All rights reserved.
+//
+
+#include "MYUtilities.xcconfig"
+
+DEAD_CODE_STRIPPING = YES
+
+GCC_WARN_UNINITIALIZED_AUTOS = YES
+
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
                                     CAssert(_val==_expected, @"Unexpected value for %s: %@ (expected %@)", #VAL,$object(_val),$object(_expected)); \
                                 }while(0)
 
+#define AssertAbstractMethod()  _AssertAbstractMethodFailed(self,_cmd);
 
 // Nasty internals ...
 #if DEBUG
 #endif DEBUG
 void _AssertFailed( id rcvr, const void *selOrFn, const char *sourceFile, int sourceLine,
                    const char *condString, NSString *message, ... ) __attribute__((noreturn));
+void _AssertAbstractMethodFailed( id rcvr, SEL cmd) __attribute__((noreturn));
 
 static void TestCaseExceptionReporter( NSException *x ) {
     sCurTestCaseExceptions++;
+    fflush(stderr);
     Log(@"XXX FAILED test case -- backtrace:\n%@\n\n", x.my_callStack);
 }
 
             if( [x.name isEqualToString: @"TestCaseSkipped"] )
                 Log(@"... skipping test %s since %@\n\n", test->name, x.reason);
             else {
+                fflush(stderr);
                 Log(@"XXX FAILED test case '%s' due to:\nException: %@\n%@\n\n", 
                       test->name,x,x.my_callStack);
                 sFailed++;
 }
 
 
+void _AssertAbstractMethodFailed( id rcvr, SEL cmd)
+{
+    [NSException raise: NSInternalInconsistencyException 
+                format: @"Class %@ forgot to implement abstract method %@",
+                         [rcvr class], NSStringFromSelector(cmd)];
+    abort(); // unreachable, but appeases compiler
+}
+
+
 /*
  Copyright (c) 2008, Jens Alfke <jens@mooseyard.com>. All rights reserved.