]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cdsa_utilities/lib/Schema.m4
Security-58286.260.20.tar.gz
[apple/security.git] / OSX / libsecurity_cdsa_utilities / lib / Schema.m4
1 divert(-1)
2 changecom(/*, */)
3 /*
4 * Copyright (c) 2000-2002 Apple Inc. All Rights Reserved.
5 *
6 * The contents of this file constitute Original Code as defined in and are
7 * subject to the Apple Public Source License Version 1.2 (the 'License').
8 * You may not use this file except in compliance with the License. Please obtain
9 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
14 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
15 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
17 * specific language governing rights and limitations under the License.
18 */
19
20 define(`startClass',
21 `define(`arrayIndex', 0)dnl
22 define(`class', $1)dnl
23 divert(0)dnl
24 // $1 password attributes
25 static const CSSM_DB_ATTRIBUTE_INFO $1Attributes[] =
26 {
27 divert(1)dnl
28 // $1 password indices
29 static const CSSM_DB_INDEX_INFO $1Indices[] =
30 {')
31
32 define(`endClass',
33 `divert(0)dnl
34 };
35
36 divert(1)dnl
37 ` // Unique (primary) index'
38 undivert(3)
39 ` // Secondary indices'
40 undivert(4)dnl
41 };
42
43 divert(-1)')
44
45 define(`attributeBody',
46 ` {
47 ifelse(index(`$1',`s'),-1,
48 ` CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER,
49 {(char *)((uint64_t)$3<<32|$3)},',
50 ` CSSM_DB_ATTRIBUTE_NAME_AS_STRING,
51 {$4},')
52 CSSM_DB_ATTRIBUTE_FORMAT_$7
53 }')
54
55 define(`simpleAttribute',
56 `const CSSM_DB_ATTRIBUTE_INFO $2 =
57 attributeBody($*);
58 ')
59
60 define(`attribute',
61 `ifelse(index(`$1',`U'),-1,`',
62 `divert(3)dnl
63 {
64 CSSM_DB_INDEX_UNIQUE,
65 CSSM_DB_INDEX_ON_ATTRIBUTE,
66 attributeBody($*)
67 },
68 ')dnl
69 ifelse(index(`$1',`I'),-1,`',
70 `divert(4)dnl
71 {
72 CSSM_DB_INDEX_NONUNIQUE,
73 CSSM_DB_INDEX_ON_ATTRIBUTE,
74 attributeBody($*)
75 },
76 ')dnl
77 divert(2)dnl
78 dnl const CSSM_DB_ATTRIBUTE_INFO &`k'class()$2 = class()Attributes[arrayIndex()];
79 `#define k'class()$2 class()Attributes[arrayIndex()];
80 divert(0)dnl
81 attributeBody($*),dnl
82 define(`arrayIndex', incr(arrayIndex))dnl
83 ')
84
85 define(`attrInfo',
86 `{
87 $1,
88 sizeof($2Attributes) / sizeof(CSSM_DB_ATTRIBUTE_INFO),
89 const_cast<CSSM_DB_ATTRIBUTE_INFO_PTR>($2Attributes)
90 }')
91
92 define(`indexInfo',
93 `{
94 $1,
95 sizeof($2Indices) / sizeof(CSSM_DB_INDEX_INFO),
96 const_cast<CSSM_DB_INDEX_INFO_PTR>($2Indices)
97 }')
98
99 define(`parseInfo',
100 `{
101 CSSM_DB_RECORDTYPE_APP_DEFINED_START,
102 {
103 {0,0,0,{0}},
104 {0,0},
105 0,
106 0
107 }
108 }')
109
110 define(`startNewClass',
111 `define(`indexIndex', 0)dnl
112 define(`class', $1)dnl
113 divert(2)dnl
114 // $1 attributes
115 const CSSM_DB_SCHEMA_ATTRIBUTE_INFO $1SchemaAttributeList[] =
116 {
117 divert(3)dnl
118 // $1 indices
119 const CSSM_DB_SCHEMA_INDEX_INFO $1SchemaIndexList[] =
120 {')
121
122 define(`endNewClass',
123 `divert(2)dnl
124 };
125
126 const uint32 class()SchemaAttributeCount = sizeof(class()SchemaAttributeList) / sizeof(CSSM_DB_SCHEMA_ATTRIBUTE_INFO);
127
128 divert(3)dnl
129 ` // Unique (primary) index'
130 undivert(5)
131 ` // Secondary indices'
132 undivert(6)dnl
133 };
134
135 const uint32 class()SchemaIndexCount = sizeof(class()SchemaIndexList) / sizeof(CSSM_DB_SCHEMA_INDEX_INFO);
136
137 undivert(4)dnl
138 divert(0)dnl
139 undivert(2)dnl
140 undivert(3)dnl')
141
142 define(`newAttributeBody',
143 `{
144 ifelse(index(`$1',`s'),-1,
145 ` CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER,
146 {(char *)((uint64_t)$3<<32|$3)},',
147 ` CSSM_DB_ATTRIBUTE_NAME_AS_STRING,
148 {$4},')
149 CSSM_DB_ATTRIBUTE_FORMAT_$7
150 }')
151
152 define(`simpleNewAttribute',
153 `const CSSM_DB_ATTRIBUTE_INFO `k'class()$2 =
154 newAttributeBody($*);
155 ')
156
157 define(`newAttribute',
158 `divert(2)dnl
159 { $3, $4, { $5, $6 }, CSSM_DB_ATTRIBUTE_FORMAT_$7 },
160 divert(-1)
161 ifelse(index(`$1',`S'),-1,`',
162 `divert(4)dnl
163 simpleNewAttribute($*)
164 divert(-1)')dnl
165
166 ifelse(index(`$1',`U'),-1,`',
167 `divert(5)dnl
168 { $3, 0, CSSM_DB_INDEX_UNIQUE, CSSM_DB_INDEX_ON_ATTRIBUTE },
169 divert(-1)')dnl
170 ifelse(index(`$1',`I'),-1,`',
171 `define(`indexIndex', incr(indexIndex))dnl
172 divert(6)dnl
173 { $3, indexIndex(), CSSM_DB_INDEX_NONUNIQUE, CSSM_DB_INDEX_ON_ATTRIBUTE },
174 divert(-1)')')
175
176 /* Start of actual output */
177 divert(0)dnl
178 /*
179 * Generated by m4 from Schema.m4 please do not edit this file.
180 */
181
182 `#include <security_cdsa_utilities/Schema.h>'
183
184 `#include <Security/SecCertificate.h>'
185 `#include <Security/SecTrustPriv.h>'
186 `#include <Security/SecKeychainItemPriv.h>'
187 `#include <Security/cssmapple.h>'
188 `#include <security_utilities/errors.h>'
189
190 `#pragma clang diagnostic push'
191 `#pragma clang diagnostic ignored "-Wunused-const-variable"'
192
193 namespace Security {
194
195 namespace KeychainCore {
196
197 namespace Schema {
198
199 // Meta attributes
200 simpleAttribute(` s', RelationID, 0, (char*) "RelationID", 0, NULL, UINT32)
201 simpleAttribute(` s', RelationName, 1, (char*) "RelationName", 0, NULL, STRING)
202 simpleAttribute(` s', AttributeID, 1, (char*) "AttributeID", 0, NULL, UINT32)
203 simpleAttribute(` s', AttributeNameFormat, 2, (char*) "AttributeNameFormat", 0, NULL, UINT32)
204 simpleAttribute(` s', AttributeName, 3, (char*) "AttributeName", 0, NULL, STRING)
205 simpleAttribute(` s', AttributeNameID, 4, (char*) "AttributeNameID", 0, NULL, BLOB)
206 simpleAttribute(` s', AttributeFormat, 5, (char*) "AttributeFormat", 0, NULL, UINT32)
207 simpleAttribute(` s', IndexType, 3, (char*) "IndexType", 0, NULL, UINT32)
208
209 divert(-1)
210 startClass(Generic)
211 attribute(` i', CreationDate, kSecCreationDateItemAttr, (char*) "CreationDate", 0, NULL, TIME_DATE)
212 attribute(` i', ModDate, kSecModDateItemAttr, (char*) "ModDate", 0, NULL, TIME_DATE)
213 attribute(` i', Description, kSecDescriptionItemAttr, (char*) "Description", 0, NULL, BLOB)
214 attribute(` i', Comment, kSecCommentItemAttr, (char*) "Comment", 0, NULL, BLOB)
215 attribute(` i', Creator, kSecCreatorItemAttr, (char*) "Creator", 0, NULL, UINT32)
216 attribute(` i', Type, kSecTypeItemAttr, (char*) "Type", 0, NULL, UINT32)
217 attribute(` i', ScriptCode, kSecScriptCodeItemAttr, (char*) "ScriptCode", 0, NULL, SINT32)
218 attribute(` s', PrintName, kSecLabelItemAttr, (char*) "PrintName", 0, NULL, BLOB)
219 attribute(` s', Alias, kSecAlias, (char*) "Alias", 0, NULL, BLOB)
220 attribute(` i', Invisible, kSecInvisibleItemAttr, (char*) "Invisible", 0, NULL, SINT32)
221 attribute(` i', Negative, kSecNegativeItemAttr, (char*) "Negative", 0, NULL, SINT32)
222 attribute(` i', CustomIcon, kSecCustomIconItemAttr, (char*) "CustomIcon", 0, NULL, SINT32)
223 attribute(` i', Protected, kSecProtectedDataItemAttr, (char*) "Protected", 0, NULL, BLOB)
224 attribute(`UIi', Account, kSecAccountItemAttr, (char*) "Account", 0, NULL, BLOB)
225 attribute(`UIi', Service, kSecServiceItemAttr, (char*) "Service", 0, NULL, BLOB)
226 attribute(` i', Generic, kSecGenericItemAttr, (char*) "Generic", 0, NULL, BLOB)
227 endClass()
228
229 startClass(Appleshare)
230 attribute(` i', CreationDate, kSecCreationDateItemAttr, (char*) "CreationDate", 0, NULL, TIME_DATE)
231 attribute(` i', ModDate, kSecModDateItemAttr, (char*) "ModDate", 0, NULL, TIME_DATE)
232 attribute(` i', Description, kSecDescriptionItemAttr, (char*) "Description", 0, NULL, BLOB)
233 attribute(` i', Comment, kSecCommentItemAttr, (char*) "Comment", 0, NULL, BLOB)
234 attribute(` i', Creator, kSecCreatorItemAttr, (char*) "Creator", 0, NULL, UINT32)
235 attribute(` i', Type, kSecTypeItemAttr, (char*) "Type", 0, NULL, UINT32)
236 attribute(` i', ScriptCode, kSecScriptCodeItemAttr, (char*) "ScriptCode", 0, NULL, SINT32)
237 attribute(` s', PrintName, kSecLabelItemAttr, (char*) "PrintName", 0, NULL, BLOB)
238 attribute(` s', Alias, kSecAlias, (char*) "Alias", 0, NULL, BLOB)
239 attribute(` i', Invisible, kSecInvisibleItemAttr, (char*) "Invisible", 0, NULL, SINT32)
240 attribute(` i', Negative, kSecNegativeItemAttr, (char*) "Negative", 0, NULL, SINT32)
241 attribute(` i', CustomIcon, kSecCustomIconItemAttr, (char*) "CustomIcon", 0, NULL, SINT32)
242 attribute(` i', Protected, kSecProtectedDataItemAttr, (char*) "Protected", 0, NULL, BLOB)
243 attribute(`UIi', Account, kSecAccountItemAttr, (char*) "Account", 0, NULL, BLOB)
244 attribute(`UIi', Volume, kSecVolumeItemAttr, (char*) "Volume", 0, NULL, BLOB)
245 attribute(` i', Server, kSecServerItemAttr, (char*) "Server", 0, NULL, BLOB)
246 attribute(` i', Protocol, kSecProtocolItemAttr, (char*) "Protocol", 0, NULL, UINT32)
247 attribute(`UIi', Address, kSecAddressItemAttr, (char*) "Address", 0, NULL, BLOB)
248 attribute(`UIi', Signature, kSecSignatureItemAttr, (char*) "Signature", 0, NULL, BLOB)
249 endClass()
250
251 startClass(Internet)
252 attribute(` i', CreationDate, kSecCreationDateItemAttr, (char*) "CreationDate", 0, NULL, TIME_DATE)
253 attribute(` i', ModDate, kSecModDateItemAttr, (char*) "ModDate", 0, NULL, TIME_DATE)
254 attribute(` i', Description, kSecDescriptionItemAttr, (char*) "Description", 0, NULL, BLOB)
255 attribute(` i', Comment, kSecCommentItemAttr, (char*) "Comment", 0, NULL, BLOB)
256 attribute(` i', Creator, kSecCreatorItemAttr, (char*) "Creator", 0, NULL, UINT32)
257 attribute(` i', Type, kSecTypeItemAttr, (char*) "Type", 0, NULL, UINT32)
258 attribute(` i', ScriptCode, kSecScriptCodeItemAttr, (char*) "ScriptCode", 0, NULL, SINT32)
259 attribute(` s', PrintName, kSecLabelItemAttr, (char*) "PrintName", 0, NULL, BLOB)
260 attribute(` s', Alias, kSecAlias, (char*) "Alias", 0, NULL, BLOB)
261 attribute(` i', Invisible, kSecInvisibleItemAttr, (char*) "Invisible", 0, NULL, SINT32)
262 attribute(` i', Negative, kSecNegativeItemAttr, (char*) "Negative", 0, NULL, SINT32)
263 attribute(` i', CustomIcon, kSecCustomIconItemAttr, (char*) "CustomIcon", 0, NULL, SINT32)
264 attribute(` i', Protected, kSecProtectedDataItemAttr, (char*) "Protected", 0, NULL, BLOB)
265 attribute(`UIi', Account, kSecAccountItemAttr, (char*) "Account", 0, NULL, BLOB)
266 attribute(`UIi', SecurityDomain, kSecSecurityDomainItemAttr, (char*) "SecurityDomain", 0, NULL, BLOB)
267 attribute(`UIi', Server, kSecServerItemAttr, (char*) "Server", 0, NULL, BLOB)
268 attribute(`UIi', Protocol, kSecProtocolItemAttr, (char*) "Protocol", 0, NULL, UINT32)
269 attribute(`UIi', AuthType, kSecAuthenticationTypeItemAttr, (char*) "AuthType", 0, NULL, BLOB)
270 attribute(`UIi', Port, kSecPortItemAttr, (char*) "Port", 0, NULL, UINT32)
271 attribute(`UIi', Path, kSecPathItemAttr, (char*) "Path", 0, NULL, BLOB)
272 endClass()
273
274 startNewClass(X509Certificate)
275 newAttribute(`UISs', CertType, kSecCertTypeItemAttr, (char*) "CertType", 0, NULL, UINT32)
276 newAttribute(` Ss', CertEncoding, kSecCertEncodingItemAttr, (char*) "CertEncoding", 0, NULL, UINT32)
277 newAttribute(` Ss', PrintName, kSecLabelItemAttr, (char*) "PrintName", 0, NULL, BLOB)
278 newAttribute(` ISs', Alias, kSecAlias, (char*) "Alias", 0, NULL, BLOB)
279 newAttribute(` ISs', Subject, kSecSubjectItemAttr, (char*) "Subject", 0, NULL, BLOB)
280 newAttribute(`UISs', Issuer, kSecIssuerItemAttr, (char*) "Issuer", 0, NULL, BLOB)
281 newAttribute(`UISs', SerialNumber, kSecSerialNumberItemAttr, (char*) "SerialNumber", 0, NULL, BLOB)
282 newAttribute(` ISs', SubjectKeyIdentifier, kSecSubjectKeyIdentifierItemAttr, (char*) "SubjectKeyIdentifier", 0, NULL, BLOB)
283 newAttribute(` ISs', PublicKeyHash, kSecPublicKeyHashItemAttr, (char*) "PublicKeyHash", 0, NULL, BLOB)
284 endNewClass()
285
286 startNewClass(X509Crl)
287 newAttribute(`UISs', CrlType, kSecCrlType, (char*) "CrlType", 0, NULL, UINT32)
288 newAttribute(` Ss', CrlEncoding, kSecCrlEncodingItemAttr, (char*) "CrlEncoding", 0, NULL, UINT32)
289 newAttribute(` Ss', PrintName, kSecLabelItemAttr, (char*) "PrintName", 0, NULL, BLOB)
290 newAttribute(` Ss', Alias, kSecAlias, (char*) "Alias", 0, NULL, BLOB)
291 newAttribute(`UISs', Issuer, kSecIssuerItemAttr, (char*) "Issuer", 0, NULL, BLOB)
292 newAttribute(`UISs', ThisUpdate, kSecThisUpdateItemAttr, (char*) "ThisUpdate", 0, NULL, BLOB)
293 newAttribute(`UISs', NextUpdate, kSecNextUpdateItemAttr, (char*) "NextUpdate", 0, NULL, BLOB)
294 newAttribute(`UISs', URI, kSecUriItemAttr, (char*) "URI", 0, NULL, BLOB)
295 newAttribute(` ISs', CrlNumber, kSecCrlNumberItemAttr, (char*) "CrlNumber", 0, NULL, UINT32)
296 newAttribute(` ISs', DeltaCrlNumber, kSecDeltaCrlNumberItemAttr, (char*) "DeltaCrlNumber", 0, NULL, UINT32)
297 endNewClass()
298
299 startNewClass(UserTrust)
300 newAttribute(`UISs', TrustedCertificate, kSecTrustCertAttr, (char*) "TrustedCertificate", 0, NULL, BLOB)
301 newAttribute(`UISs', TrustedPolicy, kSecTrustPolicyAttr, (char*) "TrustedPolicy", 0, NULL, BLOB)
302 newAttribute(` Ss', PrintName, kSecLabelItemAttr, (char*) "PrintName", 0, NULL, BLOB)
303 endNewClass()
304
305 startNewClass(UnlockReferral)
306 newAttribute(`UISs', Type, kSecReferralTypeAttr, (char*) "Type", 0, NULL, UINT32)
307 newAttribute(`UISs', DbName, kSecReferralDbNameAttr, (char*) "DbName", 0, NULL, STRING)
308 newAttribute(`UISs', DbNetname, kSecReferralDbNetnameAttr, (char*) "DbNetname", 0, NULL, BLOB)
309 newAttribute(`UISs', DbGuid, kSecReferralDbGuidAttr, (char*) "DbGuid", 0, NULL, BLOB)
310 newAttribute(`UISs', DbSSID, kSecReferralDbSSIDAttr, (char*) "DbSSID", 0, NULL, UINT32)
311 newAttribute(`UISs', DbSSType, kSecReferralDbSSTypeAttr, (char*) "DbSSType", 0, NULL, UINT32)
312 newAttribute(` ISs', KeyLabel, kSecReferralKeyLabelAttr, (char*) "KeyLabel", 0, NULL, BLOB)
313 newAttribute(` ISs', KeyAppTag, kSecReferralKeyAppTagAttr, (char*) "KeyAppTag", 0, NULL, BLOB)
314 newAttribute(` Ss', PrintName, kSecLabelItemAttr, (char*) "PrintName", 0, NULL, BLOB)
315 newAttribute(` Ss', Alias, kSecAlias, (char*) "Alias", 0, NULL, BLOB)
316 endNewClass()
317
318 // Extended Attribute
319 startNewClass(ExtendedAttribute)
320 newAttribute(`UISs', RecordType, kExtendedAttrRecordTypeAttr, (char*) "RecordType", 0, NULL, UINT32)
321 newAttribute(`UISs', ItemID, kExtendedAttrItemIDAttr, (char*) "ItemID", 0, NULL, BLOB)
322 newAttribute(`UISs', AttributeName, kExtendedAttrAttributeNameAttr, (char*) "AttributeName", 0, NULL, BLOB)
323 newAttribute(` Ss', ModDate, kSecModDateItemAttr, (char*) "ModDate", 0, NULL, TIME_DATE)
324 newAttribute(` Ss', AttributeValue, kExtendedAttrAttributeValueAttr, (char*) "AttributeValue", 0, NULL, BLOB)
325 endNewClass()
326
327 divert(3)
328 static const CSSM_DB_RECORD_ATTRIBUTE_INFO Attributes[] =
329 {
330 attrInfo(CSSM_DL_DB_RECORD_GENERIC_PASSWORD, Generic),
331 attrInfo(CSSM_DL_DB_RECORD_APPLESHARE_PASSWORD, Appleshare),
332 attrInfo(CSSM_DL_DB_RECORD_INTERNET_PASSWORD, Internet)
333 };
334
335 static const CSSM_DB_RECORD_INDEX_INFO Indices[] =
336 {
337 indexInfo(CSSM_DL_DB_RECORD_GENERIC_PASSWORD, Generic),
338 indexInfo(CSSM_DL_DB_RECORD_APPLESHARE_PASSWORD, Appleshare),
339 indexInfo(CSSM_DL_DB_RECORD_INTERNET_PASSWORD, Internet)
340 };
341
342 static const CSSM_DB_PARSING_MODULE_INFO ParseInfos[] =
343 {
344 parseInfo(),
345 parseInfo(),
346 parseInfo()
347 };
348
349 //
350 // Public stuff
351 //
352 const CSSM_DBINFO DBInfo =
353 {
354 sizeof(Attributes) / sizeof(CSSM_DB_RECORD_ATTRIBUTE_INFO),
355 const_cast<CSSM_DB_PARSING_MODULE_INFO_PTR>(ParseInfos),
356 const_cast<CSSM_DB_RECORD_ATTRIBUTE_INFO_PTR>(Attributes),
357 const_cast<CSSM_DB_RECORD_INDEX_INFO_PTR>(Indices),
358 CSSM_TRUE,
359 NULL,
360 NULL
361 };
362
363 //
364 // Schema methods
365 //
366 CSSM_DB_RECORDTYPE
367 recordTypeFor(SecItemClass itemClass)
368 {
369 switch (itemClass)
370 {
371 case kSecGenericPasswordItemClass: return CSSM_DL_DB_RECORD_GENERIC_PASSWORD;
372 case kSecInternetPasswordItemClass: return CSSM_DL_DB_RECORD_INTERNET_PASSWORD;
373 case 'ashp': return CSSM_DL_DB_RECORD_APPLESHARE_PASSWORD;
374 default: return CSSM_DB_RECORDTYPE(itemClass);
375 }
376 }
377
378 SecItemClass
379 itemClassFor(CSSM_DB_RECORDTYPE recordType)
380 {
381 switch (recordType)
382 {
383 case CSSM_DL_DB_RECORD_GENERIC_PASSWORD: return kSecGenericPasswordItemClass;
384 case CSSM_DL_DB_RECORD_INTERNET_PASSWORD: return kSecInternetPasswordItemClass;
385 case CSSM_DL_DB_RECORD_APPLESHARE_PASSWORD: return (SecItemClass) 'ashp';
386 default: return SecItemClass(recordType);
387 }
388 }
389
390 bool
391 haveAttributeInfo(SecKeychainAttrType attrType)
392 {
393 switch (attrType)
394 {
395 case kSecCreationDateItemAttr: return true;
396 case kSecModDateItemAttr: return true;
397 case kSecDescriptionItemAttr: return true;
398 case kSecCommentItemAttr: return true;
399 case kSecCreatorItemAttr: return true;
400 case kSecTypeItemAttr: return true;
401 case kSecScriptCodeItemAttr: return true;
402 case kSecLabelItemAttr: return true;
403 case kSecAlias: return true;
404 case kSecInvisibleItemAttr: return true;
405 case kSecNegativeItemAttr: return true;
406 case kSecCustomIconItemAttr: return true;
407 /* Unique Generic password attributes */
408 case kSecAccountItemAttr: return true;
409 case kSecServiceItemAttr: return true;
410 case kSecGenericItemAttr: return true;
411 /* Unique Appleshare password attributes */
412 case kSecVolumeItemAttr: return true;
413 case kSecAddressItemAttr: return true;
414 case kSecSignatureItemAttr: return true;
415 /* Unique AppleShare and Internet attributes */
416 case kSecServerItemAttr: return true;
417 case kSecProtocolItemAttr: return true;
418 /* Unique Internet password attributes */
419 case kSecSecurityDomainItemAttr: return true;
420 case kSecAuthenticationTypeItemAttr: return true;
421 case kSecPortItemAttr: return true;
422 case kSecPathItemAttr: return true;
423 /* Unique Certificate attributes */
424 case kSecCertTypeItemAttr: return true;
425 case kSecCertEncodingItemAttr: return true;
426 case kSecSubjectItemAttr: return true;
427 case kSecIssuerItemAttr: return true;
428 case kSecSerialNumberItemAttr: return true;
429 case kSecSubjectKeyIdentifierItemAttr: return true;
430 case kSecPublicKeyHashItemAttr: return true;
431 /* Unique UserTrust attributes */
432 case kSecTrustCertAttr: return true;
433 case kSecTrustPolicyAttr: return true;
434 /* Unique UnlockReferral attributes */
435 case kSecReferralTypeAttr: return true;
436 case kSecReferralDbNameAttr: return true;
437 case kSecReferralDbGuidAttr: return true;
438 case kSecReferralDbSSIDAttr: return true;
439 case kSecReferralDbSSTypeAttr: return true;
440 case kSecReferralDbNetnameAttr: return true;
441 case kSecReferralKeyLabelAttr: return true;
442 case kSecReferralKeyAppTagAttr: return true;
443 /* Unique ExtendedAttribute attributes */
444 case kExtendedAttrRecordTypeAttr: return true;
445 case kExtendedAttrItemIDAttr: return true;
446 case kExtendedAttrAttributeNameAttr: return true;
447 case kExtendedAttrAttributeValueAttr: return true;
448 /* ??? */
449 case kSecProtectedDataItemAttr: return true;
450 default:
451 {
452 if (attrType == 7)
453 {
454 return true;
455 }
456 else if (attrType == 8)
457 {
458 return true;
459 }
460 return false;
461 }
462 }
463 }
464
465 const CSSM_DB_ATTRIBUTE_INFO &
466 attributeInfo(SecKeychainAttrType attrType)
467 {
468 switch (attrType)
469 {
470 case kSecCreationDateItemAttr: return kGenericCreationDate;
471 case kSecModDateItemAttr: return kGenericModDate;
472 case kSecDescriptionItemAttr: return kGenericDescription;
473 case kSecCommentItemAttr: return kGenericComment;
474 case kSecCreatorItemAttr: return kGenericCreator;
475 case kSecTypeItemAttr: return kGenericType;
476 case kSecScriptCodeItemAttr: return kGenericScriptCode;
477 case kSecLabelItemAttr: return kGenericPrintName;
478 case kSecAlias: return kGenericAlias;
479 case kSecInvisibleItemAttr: return kGenericInvisible;
480 case kSecNegativeItemAttr: return kGenericNegative;
481 case kSecCustomIconItemAttr: return kGenericCustomIcon;
482 /* Unique Generic password attributes */
483 case kSecAccountItemAttr: return kGenericAccount;
484 case kSecServiceItemAttr: return kGenericService;
485 case kSecGenericItemAttr: return kGenericGeneric;
486 /* Unique Appleshare password attributes */
487 case kSecVolumeItemAttr: return kAppleshareVolume;
488 case kSecAddressItemAttr: return kAppleshareAddress;
489 case kSecSignatureItemAttr: return kAppleshareSignature;
490 /* Unique AppleShare and Internet attributes */
491 case kSecServerItemAttr: return kAppleshareServer;
492 case kSecProtocolItemAttr: return kAppleshareProtocol;
493 /* Unique Internet password attributes */
494 case kSecSecurityDomainItemAttr: return kInternetSecurityDomain;
495 case kSecAuthenticationTypeItemAttr: return kInternetAuthType;
496 case kSecPortItemAttr: return kInternetPort;
497 case kSecPathItemAttr: return kInternetPath;
498 /* Unique Certificate attributes */
499 case kSecCertTypeItemAttr: return kX509CertificateCertType;
500 case kSecCertEncodingItemAttr: return kX509CertificateCertEncoding;
501 case kSecSubjectItemAttr: return kX509CertificateSubject;
502 case kSecIssuerItemAttr: return kX509CertificateIssuer;
503 case kSecSerialNumberItemAttr: return kX509CertificateSerialNumber;
504 case kSecSubjectKeyIdentifierItemAttr: return kX509CertificateSubjectKeyIdentifier;
505 case kSecPublicKeyHashItemAttr: return kX509CertificatePublicKeyHash;
506 /* Unique UserTrust attributes */
507 case kSecTrustCertAttr: return kUserTrustTrustedCertificate;
508 case kSecTrustPolicyAttr: return kUserTrustTrustedPolicy;
509 /* Unique UnlockReferral attributes */
510 case kSecReferralTypeAttr: return kUnlockReferralType;
511 case kSecReferralDbNameAttr: return kUnlockReferralDbName;
512 case kSecReferralDbGuidAttr: return kUnlockReferralDbGuid;
513 case kSecReferralDbSSIDAttr: return kUnlockReferralDbSSID;
514 case kSecReferralDbSSTypeAttr: return kUnlockReferralDbSSType;
515 case kSecReferralDbNetnameAttr: return kUnlockReferralDbNetname;
516 case kSecReferralKeyLabelAttr: return kUnlockReferralKeyLabel;
517 case kSecReferralKeyAppTagAttr: return kUnlockReferralKeyAppTag;
518 /* Unique ExtendedAttribute attributes */
519 case kExtendedAttrRecordTypeAttr: return kExtendedAttributeRecordType;
520 case kExtendedAttrItemIDAttr: return kExtendedAttributeItemID;
521 case kExtendedAttrAttributeNameAttr: return kExtendedAttributeAttributeName;
522 case kExtendedAttrAttributeValueAttr: return kExtendedAttributeAttributeValue;
523 /* ??? */
524 case kSecProtectedDataItemAttr: return kGenericProtected;
525 default:
526 {
527 if (attrType == 7)
528 {
529 return kGenericPrintName;
530 }
531 else if (attrType == 8)
532 {
533 return kGenericAlias;
534 }
535 MacOSError::throwMe(errSecNoSuchAttr);
536 }
537 }
538 }
539
540 } // end namespace Schema
541
542 } // end namespace KeychainCore
543
544 } // end namespace Security
545
546 `#pragma clang diagnostic pop'