]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cdsa_utilities/lib/KeySchema.m4
Security-59754.41.1.tar.gz
[apple/security.git] / OSX / libsecurity_cdsa_utilities / lib / KeySchema.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(`indexIndex', 0)dnl
22 define(`class', $1)dnl
23 divert(2)dnl
24 // $1 attributes
25 const CSSM_DB_SCHEMA_ATTRIBUTE_INFO $1SchemaAttributeList[] =
26 {
27 divert(3)dnl
28 // $1 indices
29 const CSSM_DB_SCHEMA_INDEX_INFO $1SchemaIndexList[] =
30 {')
31
32 define(`endClass',
33 `divert(2)dnl
34 };
35
36 const uint32 class()SchemaAttributeCount = sizeof(class()SchemaAttributeList) / sizeof(CSSM_DB_SCHEMA_ATTRIBUTE_INFO);
37
38 divert(3)dnl
39 ` // Unique (primary) index'
40 undivert(5)
41 ` // Secondary indices'
42 undivert(6)dnl
43 };
44
45 const uint32 class()SchemaIndexCount = sizeof(class()SchemaIndexList) / sizeof(CSSM_DB_SCHEMA_INDEX_INFO);
46
47 undivert(4)dnl
48 divert(0)dnl
49 undivert(1)dnl
50 undivert(2)dnl
51 undivert(3)dnl')
52
53 define(`attributeBody',
54 `{
55 ifelse(index(`$1',`s'),-1,
56 ` CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER,
57 {(char *)((uint64_t)$3<<32|$3)},',
58 ` CSSM_DB_ATTRIBUTE_NAME_AS_STRING,
59 {$4},')
60 CSSM_DB_ATTRIBUTE_FORMAT_$7
61 }')
62
63 define(`simpleAttribute',
64 `const CSSM_DB_ATTRIBUTE_INFO $2 =
65 attributeBody($*);
66 ')
67
68 define(`attribute',
69 `divert(2)dnl
70 { $3, (char*) $4, { $5, $6 }, CSSM_DB_ATTRIBUTE_FORMAT_$7 },
71 divert(-1)
72 ifelse(index(`$1',`S'),-1,`',
73 `divert(4)dnl
74 simpleAttribute($*)
75 divert(-1)')dnl
76
77 ifelse(index(`$1',`U'),-1,`',
78 `divert(5)dnl
79 { $3, 0, CSSM_DB_INDEX_UNIQUE, CSSM_DB_INDEX_ON_ATTRIBUTE },
80 divert(-1)')dnl
81 ifelse(index(`$1',`I'),-1,`',
82 `define(`indexIndex', incr(indexIndex))dnl
83 divert(6)dnl
84 { $3, indexIndex(), CSSM_DB_INDEX_NONUNIQUE, CSSM_DB_INDEX_ON_ATTRIBUTE },
85 divert(-1)')')
86
87 /* Start of actual output */
88 divert(0)dnl
89 /*
90 * Generated by m4 from KeySchema.m4 please do not edit this file.
91 */
92
93 `#include <security_cdsa_utilities/KeySchema.h>'
94 #include <Security/SecKey.h>
95
96 namespace KeySchema {
97
98 divert(-1)
99 startClass(Key)
100 attribute(` Ss', KeyClass, kSecKeyKeyClass, (char*) "KeyClass", 0, NULL, UINT32)
101 attribute(` Ss', PrintName, kSecKeyPrintName, (char*) "PrintName", 0, NULL, BLOB)
102 attribute(` Ss', Alias, kSecKeyAlias, (char*) "Alias", 0, NULL, BLOB)
103 attribute(` Ss', Permanent, kSecKeyPermanent, (char*) "Permanent", 0, NULL, UINT32)
104 attribute(` Ss', Private, kSecKeyPrivate, (char*) "Private", 0, NULL, UINT32)
105 attribute(` Ss', Modifiable, kSecKeyModifiable, (char*) "Modifiable", 0, NULL, UINT32)
106 attribute(`UISs', Label, kSecKeyLabel, (char*) "Label", 0, NULL, BLOB)
107 attribute(`U Ss', ApplicationTag, kSecKeyApplicationTag, (char*) "ApplicationTag", 0, NULL, BLOB)
108 attribute(`U Ss', KeyCreator, kSecKeyKeyCreator, (char*) "KeyCreator", 0, NULL, BLOB)
109 attribute(`U Ss', KeyType, kSecKeyKeyType, (char*) "KeyType", 0, NULL, UINT32)
110 attribute(`U Ss', KeySizeInBits, kSecKeyKeySizeInBits, (char*) "KeySizeInBits", 0, NULL, UINT32)
111 attribute(`U Ss', EffectiveKeySize, kSecKeyEffectiveKeySize, (char*) "EffectiveKeySize", 0, NULL, UINT32)
112 attribute(`U Ss', StartDate, kSecKeyStartDate, (char*) "StartDate", 0, NULL, BLOB)
113 attribute(`U Ss', EndDate, kSecKeyEndDate, (char*) "EndDate", 0, NULL, BLOB)
114 attribute(` Ss', Sensitive, kSecKeySensitive, (char*) "Sensitive", 0, NULL, UINT32)
115 attribute(` Ss', AlwaysSensitive, kSecKeyAlwaysSensitive, (char*) "AlwaysSensitive", 0, NULL, UINT32)
116 attribute(` Ss', Extractable, kSecKeyExtractable, (char*) "Extractable", 0, NULL, UINT32)
117 attribute(` Ss', NeverExtractable, kSecKeyNeverExtractable, (char*) "NeverExtractable", 0, NULL, UINT32)
118 attribute(` ISs', Encrypt, kSecKeyEncrypt, (char*) "Encrypt", 0, NULL, UINT32)
119 attribute(` ISs', Decrypt, kSecKeyDecrypt, (char*) "Decrypt", 0, NULL, UINT32)
120 attribute(` ISs', Derive, kSecKeyDerive, (char*) "Derive", 0, NULL, UINT32)
121 attribute(` ISs', Sign, kSecKeySign, (char*) "Sign", 0, NULL, UINT32)
122 attribute(` ISs', Verify, kSecKeyVerify, (char*) "Verify", 0, NULL, UINT32)
123 attribute(` ISs', SignRecover, kSecKeySignRecover, (char*) "SignRecover", 0, NULL, UINT32)
124 attribute(` ISs', VerifyRecover, kSecKeyVerifyRecover, (char*) "VerifyRecover", 0, NULL, UINT32)
125 attribute(` ISs', Wrap, kSecKeyWrap, (char*) "Wrap", 0, NULL, UINT32)
126 attribute(` ISs', Unwrap, kSecKeyUnwrap, (char*) "Unwrap", 0, NULL, UINT32)
127 endClass()
128
129 } // end namespace KeySchema