]> git.saurik.com Git - apple/security.git/blob - keychain/securityd/SecItemSchema.c
Security-59754.60.13.tar.gz
[apple/security.git] / keychain / securityd / SecItemSchema.c
1 /*
2 * Copyright (c) 2006-2014 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /*
25 * SecItemSchema.c - CoreFoundation-based constants and functions for
26 access to Security items (certificates, keys, identities, and
27 passwords.)
28 */
29
30 #include "SecItemSchema.h"
31 #include "keychain/securityd/SecDbKeychainItem.h"
32 #include <keychain/ckks/CKKS.h>
33 #include "CheckV12DevEnabled.h"
34
35 // MARK -
36 // MARK Keychain version 6 schema
37
38 #define __FLAGS(ARG, ...) SECDBFLAGS(__VA_ARGS__)
39 #define SECDBFLAGS(ARG, ...) __FLAGS_##ARG | __FLAGS(__VA_ARGS__)
40
41 #define SecDbFlags(P,L,I,S,A,D,R,C,H,B,Z,E,N,U,V,Y) (__FLAGS_##P|__FLAGS_##L|__FLAGS_##I|__FLAGS_##S|__FLAGS_##A|__FLAGS_##D|__FLAGS_##R|__FLAGS_##C|__FLAGS_##H|__FLAGS_##B|__FLAGS_##Z|__FLAGS_##E|__FLAGS_##N|__FLAGS_##U|__FLAGS_##V|__FLAGS_##Y)
42
43 #define __FLAGS_ 0
44 #define __FLAGS_P kSecDbPrimaryKeyFlag
45 #define __FLAGS_L kSecDbInFlag
46 #define __FLAGS_I kSecDbIndexFlag
47 #define __FLAGS_S kSecDbSHA1ValueInFlag
48 #define __FLAGS_A kSecDbReturnAttrFlag
49 #define __FLAGS_D kSecDbReturnDataFlag
50 #define __FLAGS_R kSecDbReturnRefFlag
51 #define __FLAGS_C kSecDbInCryptoDataFlag
52 #define __FLAGS_H kSecDbInHashFlag
53 #define __FLAGS_B kSecDbInBackupFlag
54 #define __FLAGS_Z kSecDbDefault0Flag
55 #define __FLAGS_E kSecDbDefaultEmptyFlag
56 #define __FLAGS_N kSecDbNotNullFlag
57 #define __FLAGS_U kSecDbInAuthenticatedDataFlag
58 #define __FLAGS_V0 kSecDbSyncPrimaryKeyV0
59 #define __FLAGS_V2 (kSecDbSyncPrimaryKeyV0 | kSecDbSyncPrimaryKeyV2)
60 #define __FLAGS_Y kSecDbSyncFlag
61 #define __FLAGS_X kSecDbSyncFlag | kSecDbSyncSOSCannotSyncFlag
62
63 // ,----------------- P : Part of primary key
64 // / ,---------------- L : Stored in local database
65 // / / ,--------------- I : Attribute wants an index in the database
66 // / / / ,-------------- S : SHA1 hashed attribute value in database (implies L)
67 // / / / / ,------------- A : Returned to client as attribute in queries (implied by C)
68 // / / / / / ,------------ D : Returned to client as data in queries (implied by C)
69 // / / / / / / ,----------- R : Returned to client as ref/persistent ref in queries
70 // / / / / / / / ,---------- C : Part of encrypted blob
71 // / / / / / / / / ,--------- H : Attribute is part of item SHA1 hash
72 // / / / / / / / / / ,-------- B : Attribute is part of iTunes/iCloud backup bag
73 // / / / / / / / / / / ,------- Z : Attribute has a default value of 0
74 // / / / / / / / / / / / ,------ E : Attribute has a default value of "" or empty data
75 // / / / / / / / / / / / / ,----- N : Attribute must have a value
76 // / / / / / / / / / / / / / ,---- U : Attribute is stored in authenticated, but not necessarily encrypted data
77 // / / / / / / / / / / / / / / ,--- V0: Sync primary key version
78 // / / / / / / / / / / / / / / / ,- Y : Attribute should be synced, or
79 // | | | | | | | | | | | | | | | | X : Attribute should be synced in CKKS, and ignored in SOS
80 // | | | | | | | | | | | | | | | |
81 // common to all | | | | | | | | | | | | | | | |
82 SECDB_ATTR(v6rowid, "rowid", RowId, SecDbFlags( ,L, , , , ,R, , ,B, , , , , , ), NULL, NULL);
83 SECDB_ATTR(v6cdat, "cdat", CreationDate, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), SecDbKeychainItemCopyCurrentDate, NULL);
84 SECDB_ATTR(v6mdat, "mdat",ModificationDate,SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), SecDbKeychainItemCopyCurrentDate, NULL);
85 SECDB_ATTR(v6labl, "labl", Blob, SecDbFlags( ,L, ,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
86 SECDB_ATTR(v6data, "data", EncryptedData, SecDbFlags( ,L, , , , , , , ,B, , , , , , ), SecDbKeychainItemCopyEncryptedData, NULL);
87 SECDB_ATTR(v6agrp, "agrp", String, SecDbFlags(P,L, , ,A, , , ,H, , , ,N,U,V0,Y), NULL, NULL);
88 SECDB_ATTR(v6pdmn, "pdmn", Access, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
89 SECDB_ATTR(v6sync, "sync", Sync, SecDbFlags(P,L, , ,A, , , ,H, ,Z, ,N,U,V0, ), NULL, NULL);
90 SECDB_ATTR(v6tomb, "tomb", Tomb, SecDbFlags( ,L, , , , , , ,H, ,Z, ,N,U, ,Y), NULL, NULL);
91 SECDB_ATTR(v6sha1, "sha1", SHA1, SecDbFlags( ,L,I, ,A, ,R, , , , , , , , ,Y), SecDbKeychainItemCopySHA1, NULL);
92 SECDB_ATTR(v6accc, "accc", AccessControl, SecDbFlags( , , , ,A, , , , , , , , , , , ), NULL, NULL);
93 SECDB_ATTR(v6v_Data, "v_Data", Data, SecDbFlags( , , , , ,D, ,C,H, , , , , , ,Y), NULL, NULL);
94 SECDB_ATTR(v6v_pk, "v_pk", PrimaryKey, SecDbFlags( , , , , , , , , , , , , , , , ), SecDbKeychainItemCopyPrimaryKey, NULL);
95 SECDB_ATTR(v7vwht, "vwht", String, SecDbFlags(P,L,I, ,A, , , ,H, , , , ,U,V2,Y), NULL, NULL);
96 SECDB_ATTR(v7tkid, "tkid", String, SecDbFlags(P,L,I, ,A, , , ,H, , , , ,U,V2,Y), NULL, NULL);
97 SECDB_ATTR(v7utomb, "u_Tomb", UTomb, SecDbFlags( , , , , , , , , , , , , , , , ), NULL, NULL);
98 SECDB_ATTR(v8musr, "musr", UUID, SecDbFlags(P,L, , , , , , , , , , ,N,U, ,Y), NULL, NULL);
99 SECDB_ATTR(v11_7appclip, "clip", Number, SecDbFlags( ,L, , , , , , , , ,Z, ,N, , , ), NULL, NULL);
100 // genp and inet and keys | | | | | | | | | | | | | | | |
101 SECDB_ATTR(v6crtr, "crtr", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
102 SECDB_ATTR(v6alis, "alis", Blob, SecDbFlags( ,L, ,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
103 // genp and inet | | | | | | | | | | | | | | | |
104 SECDB_ATTR(v6desc, "desc", Blob, SecDbFlags( ,L, ,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
105 SECDB_ATTR(v6icmt, "icmt", Blob, SecDbFlags( ,L, ,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
106 SECDB_ATTR(v6type, "type", Number, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
107 SECDB_ATTR(v6invi, "invi", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
108 SECDB_ATTR(v6nega, "nega", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
109 SECDB_ATTR(v6cusi, "cusi", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
110 SECDB_ATTR(v6prot, "prot", Blob, SecDbFlags( ,L, ,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
111 SECDB_ATTR(v6scrp, "scrp", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
112 SECDB_ATTR(v6acct, "acct", Blob, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
113 // genp only | | | | | | | | | | | | | | | |
114 SECDB_ATTR(v6svce, "svce", Blob, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
115 SECDB_ATTR(v6gena, "gena", Blob, SecDbFlags( ,L, ,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
116 // inet only | | | | | | | | | | | | | | | |
117 SECDB_ATTR(v6sdmn, "sdmn", Blob, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
118 SECDB_ATTR(v6srvr, "srvr", Blob, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
119 SECDB_ATTR(v6ptcl, "ptcl", Number, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
120 SECDB_ATTR(v6atyp, "atyp", Blob, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
121 SECDB_ATTR(v6port, "port", Number, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
122 SECDB_ATTR(v6path, "path", Blob, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
123 // cert only | | | | | | | | | | | | | | | |
124 SECDB_ATTR(v6ctyp, "ctyp", Number, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
125 SECDB_ATTR(v6cenc, "cenc", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
126 SECDB_ATTR(v6subj, "subj", Data, SecDbFlags( ,L,I,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
127 SECDB_ATTR(v6issr, "issr", Data, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
128 SECDB_ATTR(v6slnr, "slnr", Data, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
129 SECDB_ATTR(v6skid, "skid", Data, SecDbFlags( ,L,I,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
130 SECDB_ATTR(v6pkhh, "pkhh", Data, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
131 // cert attributes that share names with common ones but have different flags
132 SECDB_ATTR(v6certalis, "alis", Blob, SecDbFlags( ,L,I,S,A, , ,C,H, , , , , , ,Y), NULL, NULL);
133 // keys only | | | | | | | | | | | | | | | |
134 SECDB_ATTR(v6kcls, "kcls", Number, SecDbFlags(P,L,I,S,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
135 SECDB_ATTR(v6perm, "perm", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
136 SECDB_ATTR(v6priv, "priv", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
137 SECDB_ATTR(v6modi, "modi", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
138 SECDB_ATTR(v6klbl, "klbl", Data, SecDbFlags(P,L,I, ,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
139 SECDB_ATTR(v6atag, "atag", Blob, SecDbFlags(P,L,I,S,A, , ,C,H, , ,E,N, ,V0,Y), NULL, NULL);
140 SECDB_ATTR(v6bsiz, "bsiz", Number, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
141 SECDB_ATTR(v6esiz, "esiz", Number, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
142 SECDB_ATTR(v6sdat, "sdat", Date, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
143 SECDB_ATTR(v6edat, "edat", Date, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
144 SECDB_ATTR(v6sens, "sens", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
145 SECDB_ATTR(v6asen, "asen", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
146 SECDB_ATTR(v6extr, "extr", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
147 SECDB_ATTR(v6next, "next", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
148 SECDB_ATTR(v6encr, "encr", Number, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
149 SECDB_ATTR(v6decr, "decr", Number, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
150 SECDB_ATTR(v6drve, "drve", Number, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
151 SECDB_ATTR(v6sign, "sign", Number, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
152 SECDB_ATTR(v6vrfy, "vrfy", Number, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
153 SECDB_ATTR(v6snrc, "snrc", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
154 SECDB_ATTR(v6vyrc, "vyrc", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
155 SECDB_ATTR(v6wrap, "wrap", Number, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
156 SECDB_ATTR(v6unwp, "unwp", Number, SecDbFlags( ,L,I, ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
157 // keys attributes that share names with common ones but have different flags
158 SECDB_ATTR(v6keytype, "type", Number, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
159 SECDB_ATTR(v6keycrtr, "crtr", Number, SecDbFlags(P,L,I, ,A, , ,C,H, ,Z, ,N, ,V0,Y), NULL, NULL);
160 // | | | | | | | | | | | | | | |
161 SECDB_ATTR(v6version, "version", Number, SecDbFlags(P,L,I, , , , , , , , , ,N, , ,Y), NULL, NULL);
162 SECDB_ATTR(v91minor, "minor", Number, SecDbFlags( ,L, , , , , , , , ,Z, ,N, , ,Y), NULL, NULL);
163
164 SECDB_ATTR(v10_1pcsservice, "pcss", Number, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
165 SECDB_ATTR(v10_1pcspublickey, "pcsk", Blob, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
166 SECDB_ATTR(v10_1pcspublicidentity,"pcsi", Blob, SecDbFlags( ,L, , ,A, , ,C,H, , , , , , ,Y), NULL, NULL);
167
168 SECDB_ATTR(v10itemuuid, "UUID", String, SecDbFlags( ,L,I, , , , , , , , , , ,U, , ), NULL, NULL);
169 SECDB_ATTR(v10syncuuid, "UUID", String, SecDbFlags(P,L,I, , , , , , , , , , ,U, , ), NULL, NULL);
170 SECDB_ATTR(v10parentKeyUUID, "parentKeyUUID", String, SecDbFlags( ,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
171 SECDB_ATTR(v10currentKeyUUID,"currentKeyUUID",String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
172 SECDB_ATTR(v10wrappedkey, "wrappedkey", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
173 SECDB_ATTR(v10encrypteditem, "encitem", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
174 SECDB_ATTR(v10gencount, "gencount", Number, SecDbFlags( ,L, , , , , , , , ,Z, ,N, , , ), NULL, NULL);
175 SECDB_ATTR(v10action, "action", String, SecDbFlags( ,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
176 SECDB_ATTR(v10state, "state", String, SecDbFlags(P,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
177 SECDB_ATTR(v10waituntiltime, "waituntil", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
178 SECDB_ATTR(v10encodedCKRecord, "ckrecord", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
179 SECDB_ATTR(v10_1wasCurrent, "wascurrent", Number, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
180 SECDB_ATTR(v10accessgroup, "accessgroup", String, SecDbFlags( ,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
181 SECDB_ATTR(v10keyclass, "keyclass", String, SecDbFlags(P,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
182 SECDB_ATTR(v10currentkey, "currentkey", Number, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
183 SECDB_ATTR(v10ckzone, "ckzone", String, SecDbFlags(P,L,I, , , , , , , , , ,N,U, , ), NULL, NULL);
184 SECDB_ATTR(v10ckzonecreated, "ckzonecreated", Number, SecDbFlags( ,L, , , , , , , , ,Z, , ,N, , ), NULL, NULL);
185 SECDB_ATTR(v10ckzonesubscribed,"ckzonesubscribed", Number, SecDbFlags( ,L, , , , , , , , ,Z, ,N, , , ), NULL, NULL);
186 SECDB_ATTR(v10ratelimiter, "ratelimiter", Blob, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
187 SECDB_ATTR(v10changetoken, "changetoken", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
188 SECDB_ATTR(v10lastfetchtime, "lastfetch", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
189 SECDB_ATTR(v10itempersistentref,"persistref", UUID, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
190 SECDB_ATTR(v10sysbound, "sysb", Number, SecDbFlags( ,L, , ,A, , ,C,H, ,Z, , , , , ), NULL, NULL);
191 SECDB_ATTR(v10encryptionver, "encver", Number, SecDbFlags( ,L, , , , , , , , ,Z, ,N,U, , ), NULL, NULL);
192
193 SECDB_ATTR(v10primaryKey, "primaryKey", String, SecDbFlags(P,L,I, ,A, , , , , , , ,N,U, , ), NULL, NULL);
194 SECDB_ATTR(v10publickeyHash, "publickeyHash", Blob, SecDbFlags(P,L,I, , , , , , , , , ,N,U, , ), NULL, NULL);
195 SECDB_ATTR(v10publickey, "publickey", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
196 SECDB_ATTR(v10backupData, "backupData", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
197
198 SECDB_ATTR(v10_1digest, "digest", Blob, SecDbFlags( ,L, , , , , , , , , , ,N,U, , ), NULL, NULL);
199 SECDB_ATTR(v10_1signatures, "signatures", Blob, SecDbFlags( ,L, , , , , , , , , , ,N,U, , ), NULL, NULL);
200 SECDB_ATTR(v10_1signerID, "signerID", String, SecDbFlags( ,L, , , , , , , , , , ,N,U, , ), NULL, NULL);
201 SECDB_ATTR(v10_1leafIDs, "leafIDs", Blob, SecDbFlags( ,L, , , , , , , , , , ,N,U, , ), NULL, NULL);
202 SECDB_ATTR(v10_1peerManIDs, "peerManifests", Blob, SecDbFlags( ,L, , , , , , , , , , ,N,U, , ), NULL, NULL);
203 SECDB_ATTR(v10_1entryDigests,"entryDigests", Blob, SecDbFlags( ,L, , , , , , , , , , ,N,U, , ), NULL, NULL);
204 SECDB_ATTR(v10_2currentItems,"currentItems", Blob, SecDbFlags( ,L, , , , , , , , , , ,N,U, , ), NULL, NULL);
205 SECDB_ATTR(v10_2futureData, "futureData", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
206 SECDB_ATTR(v10_2schema, "schema", Blob, SecDbFlags( ,L, , , , , , , , , , ,N,U, , ), NULL, NULL);
207 SECDB_ATTR(v10_1encRecord, "ckrecord", Blob, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
208
209 SECDB_ATTR(v10_1keyArchiveHash, "key_archive_hash", String, SecDbFlags(P,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
210 SECDB_ATTR(v10_1keyArchive, "key_archive", String, SecDbFlags(P,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
211 SECDB_ATTR(v10_1archivedKey, "archived_key", String, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
212 SECDB_ATTR(v10_1keyArchiveName, "keyarchive_name", String, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
213 SECDB_ATTR(v10_1optionalEncodedCKRecord, "ckrecord", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
214 SECDB_ATTR(v10_1archiveEscrowID,"archive_escrowid", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
215
216 SECDB_ATTR(v10_1itempersistentref,"persistref", UUID, SecDbFlags( ,L,I, , , , , , , , , ,N,U, , ), NULL, NULL);
217
218 SECDB_ATTR(v10_1currentItemUUID,"currentItemUUID",String, SecDbFlags(P,L,I, , , , , , , , , , , , , ), NULL, NULL);
219 SECDB_ATTR(v10_4currentItemUUID,"currentItemUUID",String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
220 SECDB_ATTR(v10_1currentPtrIdentifier,"identifier",String, SecDbFlags(P,L,I, , , , , , , , , , , , , ), NULL, NULL);
221
222 SECDB_ATTR(v10_2device, "device", String, SecDbFlags(P,L,I, , , , , , , , , , , , , ), NULL, NULL);
223 SECDB_ATTR(v10_2peerid, "peerid", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
224 SECDB_ATTR(v10_2circleStatus,"circlestatus", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
225 SECDB_ATTR(v10_2keyState, "keystate", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
226 SECDB_ATTR(v10_2currentTLK, "currentTLK", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
227 SECDB_ATTR(v10_2currentClassA,"currentClassA",String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
228 SECDB_ATTR(v10_2currentClassC,"currentClassC",String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
229
230 SECDB_ATTR(v10_4lastFixup, "lastfixup", Number, SecDbFlags( ,L, , , , , , , , ,Z, , ,N, , ), NULL, NULL);
231
232 SECDB_ATTR(v10_5senderPeerID,"senderpeerid", String, SecDbFlags(P,L,I, , , , , , , , , , , , , ), NULL, NULL);
233 SECDB_ATTR(v10_5recvPeerID, "recvpeerid", String, SecDbFlags(P,L,I, , , , , , , , , , , , , ), NULL, NULL);
234 SECDB_ATTR(v10_5recvPubKey, "recvpubenckey", Blob, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
235 SECDB_ATTR(v10_5curve, "curve", Number, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
236 SECDB_ATTR(v10_5poisoned, "poisoned", Number, SecDbFlags( ,L, , , , , , , , ,Z, ,N, , , ), NULL, NULL);
237 SECDB_ATTR(v10_5epoch, "epoch", Number, SecDbFlags( ,L, , , , , , , , ,Z, ,N, , , ), NULL, NULL);
238 SECDB_ATTR(v10_5signature, "signature", Blob, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
239 SECDB_ATTR(v10_5version, "version", Number, SecDbFlags( ,L, , , , , , , , ,Z, ,N,U, , ), NULL, NULL);
240
241 SECDB_ATTR(v11_1osversion, "osversion", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
242 SECDB_ATTR(v11_1lastunlock, "lastunlock", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
243
244 SECDB_ATTR(v11_2actualKeyclass, "actualKeyclass", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
245
246 SECDB_ATTR(v11_5octagonpeerid, "octagonpeerid", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
247 SECDB_ATTR(v11_5octagonStatus, "octagonstatus", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
248
249 SECDB_ATTR(v11_6moreComing, "morecoming", Number, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
250
251 SECDB_ATTR(v11_8_bin_notes, "binn", Data, SecDbFlags( , , , , ,D, ,C, , , , , , , ,X), NULL, NULL);
252 SECDB_ATTR(v11_8_bin_history, "bini", Data, SecDbFlags( , , , , ,D, ,C, , , , , , , ,X), NULL, NULL);
253 SECDB_ATTR(v11_8_bin_client0, "bin0", Data, SecDbFlags( , , , , ,D, ,C, , , , , , , ,X), NULL, NULL);
254 SECDB_ATTR(v11_8_bin_client1, "bin1", Data, SecDbFlags( , , , , ,D, ,C, , , , , , , ,X), NULL, NULL);
255 SECDB_ATTR(v11_8_bin_client2, "bin2", Data, SecDbFlags( , , , , ,D, ,C, , , , , , , ,X), NULL, NULL);
256 SECDB_ATTR(v11_8_bin_client3, "bin3", Data, SecDbFlags( , , , , ,D, ,C, , , , , , , ,X), NULL, NULL);
257
258 SECDB_ATTR(v11_9_lastscan, "lastscan", String, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
259 SECDB_ATTR(v11_9_extra, "extra", Blob, SecDbFlags( ,L, , , , , , , , , , , , , , ), NULL, NULL);
260
261 SECDB_ATTR(v12_backupUUIDPrimary, "backupUUID", UUID, SecDbFlags(P,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
262 SECDB_ATTR(v12_backupUUID, "backupUUID", UUID, SecDbFlags( ,L,I, , , , , , , , ,E, , , , ), NULL, NULL);
263 SECDB_ATTR(v12_backupBag, "backupbag", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
264 SECDB_ATTR(v12_defaultValue, "defaultvalue", Number, SecDbFlags( ,L,I, , , , , , , ,Z, , , , , ), NULL, NULL);
265 SECDB_ATTR(v12_keyClassSigningKey, "signingkey", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
266 SECDB_ATTR(v12_recoveryType, "recoverytype", String, SecDbFlags(P,L,I, , , , , , , , , ,N, , , ), NULL, NULL);
267 SECDB_ATTR(v12_recoverySet, "recoveryset", Blob, SecDbFlags( ,L, , , , , , , , , , ,N, , , ), NULL, NULL);
268 SECDB_ATTR(v12_metadatakeydata, "metadatakeydata", Blob, SecDbFlags( ,L, , , , , , , , , ,E, , , , ), NULL, NULL);
269
270 const SecDbClass v12_backupbags_class = {
271 .name = CFSTR("backupbags"),
272 .itemclass = false,
273 .attrs = {
274 &v12_backupUUIDPrimary, // primary
275 &v12_backupBag,
276 &v12_defaultValue,
277 0
278 }
279 };
280
281 const SecDbClass v12_backupkeyclasssigningkeys_class = {
282 .name = CFSTR("backupkeyclasssigningkeys"),
283 .itemclass = false,
284 .attrs = {
285 &v10keyclass, // primary
286 &v12_backupUUIDPrimary, // primary
287 &v12_keyClassSigningKey,
288 0
289 }
290 };
291
292 const SecDbClass v12_backuprecoverysets_class = {
293 .name = CFSTR("backuprecoverysets"),
294 .itemclass = false,
295 .attrs = {
296 &v12_backupUUIDPrimary, // primary
297 &v12_recoveryType, // primary
298 &v12_recoverySet,
299 0
300 }
301 };
302
303 const SecDbClass v12_metadatakeys_class = {
304 .name = CFSTR("metadatakeys"),
305 .itemclass = false,
306 .attrs = {
307 &v10keyclass,
308 &v11_2actualKeyclass,
309 &v6data,
310 &v12_metadatakeydata,
311 0
312 }
313 };
314
315 const SecDbClass v12_genp_class = {
316 .name = CFSTR("genp"),
317 .itemclass = true,
318 .attrs = {
319 &v6rowid,
320 &v6cdat,
321 &v6mdat,
322 &v6desc,
323 &v6icmt,
324 &v6crtr,
325 &v6type,
326 &v6scrp,
327 &v6labl,
328 &v6alis,
329 &v6invi,
330 &v6nega,
331 &v6cusi,
332 &v6prot,
333 &v6acct,
334 &v6svce,
335 &v6gena,
336 &v6data,
337 &v6agrp,
338 &v6pdmn,
339 &v6sync,
340 &v6tomb,
341 &v6sha1,
342 &v7vwht,
343 &v7tkid,
344 &v6v_Data,
345 &v6v_pk,
346 &v6accc,
347 &v7utomb,
348 &v8musr,
349 &v10itemuuid,
350 &v10sysbound,
351 &v10_1pcsservice,
352 &v10_1pcspublickey,
353 &v10_1pcspublicidentity,
354 &v10_1itempersistentref,
355 &v11_7appclip,
356 &v12_backupUUID,
357 0
358 },
359 };
360
361 const SecDbClass v12_inet_class = {
362 .name = CFSTR("inet"),
363 .itemclass = true,
364 .attrs = {
365 &v6rowid,
366 &v6cdat,
367 &v6mdat,
368 &v6desc,
369 &v6icmt,
370 &v6crtr,
371 &v6type,
372 &v6scrp,
373 &v6labl,
374 &v6alis,
375 &v6invi,
376 &v6nega,
377 &v6cusi,
378 &v6prot,
379 &v6acct,
380 &v6sdmn,
381 &v6srvr,
382 &v6ptcl,
383 &v6atyp,
384 &v6port,
385 &v6path,
386 &v6data,
387 &v6agrp,
388 &v6pdmn,
389 &v6sync,
390 &v6tomb,
391 &v6sha1,
392 &v7vwht,
393 &v7tkid,
394 &v6v_Data,
395 &v6v_pk,
396 &v6accc,
397 &v7utomb,
398 &v8musr,
399 &v10itemuuid,
400 &v10sysbound,
401 &v10_1pcsservice,
402 &v10_1pcspublickey,
403 &v10_1pcspublicidentity,
404 &v10_1itempersistentref,
405 &v11_7appclip,
406 &v11_8_bin_notes,
407 &v11_8_bin_history,
408 &v11_8_bin_client0,
409 &v11_8_bin_client1,
410 &v11_8_bin_client2,
411 &v11_8_bin_client3,
412 &v12_backupUUID,
413 0
414 },
415 };
416
417 const SecDbClass v12_cert_class = {
418 .name = CFSTR("cert"),
419 .itemclass = true,
420 .attrs = {
421 &v6rowid,
422 &v6cdat,
423 &v6mdat,
424 &v6ctyp,
425 &v6cenc,
426 &v6labl,
427 &v6certalis,
428 &v6subj,
429 &v6issr,
430 &v6slnr,
431 &v6skid,
432 &v6pkhh,
433 &v6data,
434 &v6agrp,
435 &v6pdmn,
436 &v6sync,
437 &v6tomb,
438 &v6sha1,
439 &v7vwht,
440 &v7tkid,
441 &v6v_Data,
442 &v6v_pk,
443 &v6accc,
444 &v7utomb,
445 &v8musr,
446 &v10itemuuid,
447 &v10sysbound,
448 &v10_1pcsservice,
449 &v10_1pcspublickey,
450 &v10_1pcspublicidentity,
451 &v10_1itempersistentref,
452 &v11_7appclip,
453 &v12_backupUUID,
454 0
455 },
456 };
457
458 const SecDbClass v12_keys_class = {
459 .name = CFSTR("keys"),
460 .itemclass = true,
461 .attrs = {
462 &v6rowid,
463 &v6cdat,
464 &v6mdat,
465 &v6kcls,
466 &v6labl,
467 &v6alis,
468 &v6perm,
469 &v6priv,
470 &v6modi,
471 &v6klbl,
472 &v6atag,
473 &v6keycrtr,
474 &v6keytype,
475 &v6bsiz,
476 &v6esiz,
477 &v6sdat,
478 &v6edat,
479 &v6sens,
480 &v6asen,
481 &v6extr,
482 &v6next,
483 &v6encr,
484 &v6decr,
485 &v6drve,
486 &v6sign,
487 &v6vrfy,
488 &v6snrc,
489 &v6vyrc,
490 &v6wrap,
491 &v6unwp,
492 &v6data,
493 &v6agrp,
494 &v6pdmn,
495 &v6sync,
496 &v6tomb,
497 &v6sha1,
498 &v7vwht,
499 &v7tkid,
500 &v6v_Data,
501 &v6v_pk,
502 &v6accc,
503 &v7utomb,
504 &v8musr,
505 &v10itemuuid,
506 &v10sysbound,
507 &v10_1pcsservice,
508 &v10_1pcspublickey,
509 &v10_1pcspublicidentity,
510 &v10_1itempersistentref,
511 &v11_7appclip,
512 &v12_backupUUID,
513 0
514 }
515 };
516
517 const SecDbClass v11_9_ckstate_class = {
518 .name = CFSTR("ckstate"),
519 .itemclass = false,
520 .attrs = {
521 &v10ckzone,
522 &v10ckzonecreated,
523 &v10ckzonesubscribed,
524 &v10lastfetchtime,
525 &v10changetoken,
526 &v10ratelimiter,
527 &v10_4lastFixup,
528 &v11_6moreComing,
529 &v11_9_lastscan,
530 &v11_9_extra,
531 0
532 }
533 };
534
535 const SecDbClass v11_8_inet_class = {
536 .name = CFSTR("inet"),
537 .itemclass = true,
538 .attrs = {
539 &v6rowid,
540 &v6cdat,
541 &v6mdat,
542 &v6desc,
543 &v6icmt,
544 &v6crtr,
545 &v6type,
546 &v6scrp,
547 &v6labl,
548 &v6alis,
549 &v6invi,
550 &v6nega,
551 &v6cusi,
552 &v6prot,
553 &v6acct,
554 &v6sdmn,
555 &v6srvr,
556 &v6ptcl,
557 &v6atyp,
558 &v6port,
559 &v6path,
560 &v6data,
561 &v6agrp,
562 &v6pdmn,
563 &v6sync,
564 &v6tomb,
565 &v6sha1,
566 &v7vwht,
567 &v7tkid,
568 &v6v_Data,
569 &v6v_pk,
570 &v6accc,
571 &v7utomb,
572 &v8musr,
573 &v10itemuuid,
574 &v10sysbound,
575 &v10_1pcsservice,
576 &v10_1pcspublickey,
577 &v10_1pcspublicidentity,
578 &v10_1itempersistentref,
579 &v11_7appclip,
580 &v11_8_bin_notes,
581 &v11_8_bin_history,
582 &v11_8_bin_client0,
583 &v11_8_bin_client1,
584 &v11_8_bin_client2,
585 &v11_8_bin_client3,
586 0
587 },
588 };
589
590 const SecDbClass v11_7_genp_class = {
591 .name = CFSTR("genp"),
592 .itemclass = true,
593 .attrs = {
594 &v6rowid,
595 &v6cdat,
596 &v6mdat,
597 &v6desc,
598 &v6icmt,
599 &v6crtr,
600 &v6type,
601 &v6scrp,
602 &v6labl,
603 &v6alis,
604 &v6invi,
605 &v6nega,
606 &v6cusi,
607 &v6prot,
608 &v6acct,
609 &v6svce,
610 &v6gena,
611 &v6data,
612 &v6agrp,
613 &v6pdmn,
614 &v6sync,
615 &v6tomb,
616 &v6sha1,
617 &v7vwht,
618 &v7tkid,
619 &v6v_Data,
620 &v6v_pk,
621 &v6accc,
622 &v7utomb,
623 &v8musr,
624 &v10itemuuid,
625 &v10sysbound,
626 &v10_1pcsservice,
627 &v10_1pcspublickey,
628 &v10_1pcspublicidentity,
629 &v10_1itempersistentref,
630 &v11_7appclip,
631 0
632 },
633 };
634
635 const SecDbClass v11_7_inet_class = {
636 .name = CFSTR("inet"),
637 .itemclass = true,
638 .attrs = {
639 &v6rowid,
640 &v6cdat,
641 &v6mdat,
642 &v6desc,
643 &v6icmt,
644 &v6crtr,
645 &v6type,
646 &v6scrp,
647 &v6labl,
648 &v6alis,
649 &v6invi,
650 &v6nega,
651 &v6cusi,
652 &v6prot,
653 &v6acct,
654 &v6sdmn,
655 &v6srvr,
656 &v6ptcl,
657 &v6atyp,
658 &v6port,
659 &v6path,
660 &v6data,
661 &v6agrp,
662 &v6pdmn,
663 &v6sync,
664 &v6tomb,
665 &v6sha1,
666 &v7vwht,
667 &v7tkid,
668 &v6v_Data,
669 &v6v_pk,
670 &v6accc,
671 &v7utomb,
672 &v8musr,
673 &v10itemuuid,
674 &v10sysbound,
675 &v10_1pcsservice,
676 &v10_1pcspublickey,
677 &v10_1pcspublicidentity,
678 &v10_1itempersistentref,
679 &v11_7appclip,
680 0
681 },
682 };
683
684 const SecDbClass v11_7_cert_class = {
685 .name = CFSTR("cert"),
686 .itemclass = true,
687 .attrs = {
688 &v6rowid,
689 &v6cdat,
690 &v6mdat,
691 &v6ctyp,
692 &v6cenc,
693 &v6labl,
694 &v6certalis,
695 &v6subj,
696 &v6issr,
697 &v6slnr,
698 &v6skid,
699 &v6pkhh,
700 &v6data,
701 &v6agrp,
702 &v6pdmn,
703 &v6sync,
704 &v6tomb,
705 &v6sha1,
706 &v7vwht,
707 &v7tkid,
708 &v6v_Data,
709 &v6v_pk,
710 &v6accc,
711 &v7utomb,
712 &v8musr,
713 &v10itemuuid,
714 &v10sysbound,
715 &v10_1pcsservice,
716 &v10_1pcspublickey,
717 &v10_1pcspublicidentity,
718 &v10_1itempersistentref,
719 &v11_7appclip,
720 0
721 },
722 };
723
724 const SecDbClass v11_7_keys_class = {
725 .name = CFSTR("keys"),
726 .itemclass = true,
727 .attrs = {
728 &v6rowid,
729 &v6cdat,
730 &v6mdat,
731 &v6kcls,
732 &v6labl,
733 &v6alis,
734 &v6perm,
735 &v6priv,
736 &v6modi,
737 &v6klbl,
738 &v6atag,
739 &v6keycrtr,
740 &v6keytype,
741 &v6bsiz,
742 &v6esiz,
743 &v6sdat,
744 &v6edat,
745 &v6sens,
746 &v6asen,
747 &v6extr,
748 &v6next,
749 &v6encr,
750 &v6decr,
751 &v6drve,
752 &v6sign,
753 &v6vrfy,
754 &v6snrc,
755 &v6vyrc,
756 &v6wrap,
757 &v6unwp,
758 &v6data,
759 &v6agrp,
760 &v6pdmn,
761 &v6sync,
762 &v6tomb,
763 &v6sha1,
764 &v7vwht,
765 &v7tkid,
766 &v6v_Data,
767 &v6v_pk,
768 &v6accc,
769 &v7utomb,
770 &v8musr,
771 &v10itemuuid,
772 &v10sysbound,
773 &v10_1pcsservice,
774 &v10_1pcspublickey,
775 &v10_1pcspublicidentity,
776 &v10_1itempersistentref,
777 &v11_7appclip,
778 0
779 }
780 };
781
782 const SecDbClass v11_6_ckstate_class = {
783 .name = CFSTR("ckstate"),
784 .itemclass = false,
785 .attrs = {
786 &v10ckzone,
787 &v10ckzonecreated,
788 &v10ckzonesubscribed,
789 &v10lastfetchtime,
790 &v10changetoken,
791 &v10ratelimiter,
792 &v10_4lastFixup,
793 &v11_6moreComing,
794 0
795 }
796 };
797
798 const SecDbClass v11_5_ckdevicestate_class = {
799 .name = CFSTR("ckdevicestate"),
800 .itemclass = false,
801 .attrs = {
802 &v10ckzone,
803 &v10_2device,
804 &v11_1osversion,
805 &v11_1lastunlock,
806 &v10_2peerid,
807 &v10_2circleStatus,
808 &v11_5octagonpeerid,
809 &v11_5octagonStatus,
810 &v10_2keyState,
811 &v10_2currentTLK,
812 &v10_2currentClassA,
813 &v10_2currentClassC,
814 &v10_1encRecord,
815 0
816 }
817 };
818
819 const SecDbClass v11_2_metadatakeys_class = {
820 .name = CFSTR("metadatakeys"),
821 .itemclass = false,
822 .attrs = {
823 &v10keyclass,
824 &v11_2actualKeyclass,
825 &v6data,
826 0
827 }
828 };
829
830 const SecDbClass v11_1_ckdevicestate_class = {
831 .name = CFSTR("ckdevicestate"),
832 .itemclass = false,
833 .attrs = {
834 &v10ckzone,
835 &v10_2device,
836 &v11_1osversion,
837 &v11_1lastunlock,
838 &v10_2peerid,
839 &v10_2circleStatus,
840 &v10_2keyState,
841 &v10_2currentTLK,
842 &v10_2currentClassA,
843 &v10_2currentClassC,
844 &v10_1encRecord,
845 0
846 }
847 };
848
849 const SecDbClass v11_metadatakeys_class = {
850 .name = CFSTR("metadatakeys"),
851 .itemclass = false,
852 .attrs = {
853 &v10keyclass,
854 &v6data,
855 0
856 }
857 };
858
859 const SecDbClass v10_5_tlkshare_class = {
860 .name = CFSTR("tlkshare"),
861 .itemclass = false,
862 .attrs = {
863 &v10ckzone,
864 &v10syncuuid,
865 &v10_5senderPeerID,
866 &v10_5recvPeerID,
867 &v10_5recvPubKey,
868 &v10_5curve,
869 &v10_5poisoned,
870 &v10_5epoch,
871 &v10wrappedkey,
872 &v10_5signature,
873 &v10_1encRecord,
874 &v10_5version,
875 0
876 }
877 };
878
879
880 const SecDbClass v10_4_current_item_class = {
881 .name = CFSTR("currentitems"),
882 .itemclass = false,
883 .attrs = {
884 &v10ckzone,
885 &v10_1currentPtrIdentifier,
886 &v10_4currentItemUUID,
887 &v10state,
888 &v10encodedCKRecord,
889 0
890 }
891 };
892
893 const SecDbClass v10_4_ckstate_class = {
894 .name = CFSTR("ckstate"),
895 .itemclass = false,
896 .attrs = {
897 &v10ckzone,
898 &v10ckzonecreated,
899 &v10ckzonesubscribed,
900 &v10lastfetchtime,
901 &v10changetoken,
902 &v10ratelimiter,
903 &v10_4lastFixup,
904 0
905 }
906 };
907
908 const SecDbClass v10_3_ckdevicestate_class = {
909 .name = CFSTR("ckdevicestate"),
910 .itemclass = false,
911 .attrs = {
912 &v10ckzone,
913 &v10_2device,
914 &v10_2peerid,
915 &v10_2circleStatus,
916 &v10_2keyState,
917 &v10_2currentTLK,
918 &v10_2currentClassA,
919 &v10_2currentClassC,
920 &v10_1encRecord,
921 0
922 }
923 };
924
925 const SecDbClass v10_2_ckmanifest_class = {
926 .name = CFSTR("ckmanifest"),
927 .itemclass = false,
928 .attrs = {
929 &v10ckzone,
930 &v10gencount,
931 &v10_1digest,
932 &v10_1signatures,
933 &v10_1signerID,
934 &v10_1leafIDs,
935 &v10_1peerManIDs,
936 &v10_2currentItems,
937 &v10_2futureData,
938 &v10_2schema,
939 &v10_1encRecord,
940 0
941 }
942 };
943
944 const SecDbClass v10_2_pending_manifest_class = {
945 .name = CFSTR("pending_manifest"),
946 .itemclass = false,
947 .attrs = {
948 &v10ckzone,
949 &v10gencount,
950 &v10_1digest,
951 &v10_1signatures,
952 &v10_1signerID,
953 &v10_1leafIDs,
954 &v10_1peerManIDs,
955 &v10_2currentItems,
956 &v10_2futureData,
957 &v10_2schema,
958 &v10_1encRecord,
959 0
960 }
961 };
962
963 const SecDbClass v10_1_ckmanifest_class = {
964 .name = CFSTR("ckmanifest"),
965 .itemclass = false,
966 .attrs = {
967 &v10ckzone,
968 &v10gencount,
969 &v10_1digest,
970 &v10_1signatures,
971 &v10_1signerID,
972 &v10_1leafIDs,
973 &v10_1peerManIDs,
974 &v10_1encRecord,
975 0
976 }
977 };
978
979 const SecDbClass v10_1_pending_manifest_class = {
980 .name = CFSTR("pending_manifest"),
981 .itemclass = false,
982 .attrs = {
983 &v10ckzone,
984 &v10gencount,
985 &v10_1digest,
986 &v10_1signatures,
987 &v10_1signerID,
988 &v10_1leafIDs,
989 &v10_1peerManIDs,
990 &v10_1encRecord,
991 0
992 }
993 };
994
995 const SecDbClass v10_1_ckmanifest_leaf_class = {
996 .name = CFSTR("ckmanifest_leaf"),
997 .itemclass = false,
998 .attrs = {
999 &v10ckzone,
1000 &v10syncuuid,
1001 &v10_1digest,
1002 &v10_1entryDigests,
1003 &v10_1encRecord,
1004 0
1005 }
1006 };
1007
1008 const SecDbClass v10_1_pending_manifest_leaf_class = {
1009 .name = CFSTR("pending_manifest_leaf"),
1010 .itemclass = false,
1011 .attrs = {
1012 &v10ckzone,
1013 &v10syncuuid,
1014 &v10_1digest,
1015 &v10_1entryDigests,
1016 &v10_1encRecord,
1017 0
1018 }
1019 };
1020
1021 const SecDbClass v10_1_genp_class = {
1022 .name = CFSTR("genp"),
1023 .itemclass = true,
1024 .attrs = {
1025 &v6rowid,
1026 &v6cdat,
1027 &v6mdat,
1028 &v6desc,
1029 &v6icmt,
1030 &v6crtr,
1031 &v6type,
1032 &v6scrp,
1033 &v6labl,
1034 &v6alis,
1035 &v6invi,
1036 &v6nega,
1037 &v6cusi,
1038 &v6prot,
1039 &v6acct,
1040 &v6svce,
1041 &v6gena,
1042 &v6data,
1043 &v6agrp,
1044 &v6pdmn,
1045 &v6sync,
1046 &v6tomb,
1047 &v6sha1,
1048 &v7vwht,
1049 &v7tkid,
1050 &v6v_Data,
1051 &v6v_pk,
1052 &v6accc,
1053 &v7utomb,
1054 &v8musr,
1055 &v10itemuuid,
1056 &v10sysbound,
1057 &v10_1pcsservice,
1058 &v10_1pcspublickey,
1059 &v10_1pcspublicidentity,
1060 &v10_1itempersistentref,
1061 0
1062 },
1063 };
1064
1065 const SecDbClass v10_1_inet_class = {
1066 .name = CFSTR("inet"),
1067 .itemclass = true,
1068 .attrs = {
1069 &v6rowid,
1070 &v6cdat,
1071 &v6mdat,
1072 &v6desc,
1073 &v6icmt,
1074 &v6crtr,
1075 &v6type,
1076 &v6scrp,
1077 &v6labl,
1078 &v6alis,
1079 &v6invi,
1080 &v6nega,
1081 &v6cusi,
1082 &v6prot,
1083 &v6acct,
1084 &v6sdmn,
1085 &v6srvr,
1086 &v6ptcl,
1087 &v6atyp,
1088 &v6port,
1089 &v6path,
1090 &v6data,
1091 &v6agrp,
1092 &v6pdmn,
1093 &v6sync,
1094 &v6tomb,
1095 &v6sha1,
1096 &v7vwht,
1097 &v7tkid,
1098 &v6v_Data,
1099 &v6v_pk,
1100 &v6accc,
1101 &v7utomb,
1102 &v8musr,
1103 &v10itemuuid,
1104 &v10sysbound,
1105 &v10_1pcsservice,
1106 &v10_1pcspublickey,
1107 &v10_1pcspublicidentity,
1108 &v10_1itempersistentref,
1109 0
1110 },
1111 };
1112
1113 const SecDbClass v10_1_cert_class = {
1114 .name = CFSTR("cert"),
1115 .itemclass = true,
1116 .attrs = {
1117 &v6rowid,
1118 &v6cdat,
1119 &v6mdat,
1120 &v6ctyp,
1121 &v6cenc,
1122 &v6labl,
1123 &v6certalis,
1124 &v6subj,
1125 &v6issr,
1126 &v6slnr,
1127 &v6skid,
1128 &v6pkhh,
1129 &v6data,
1130 &v6agrp,
1131 &v6pdmn,
1132 &v6sync,
1133 &v6tomb,
1134 &v6sha1,
1135 &v7vwht,
1136 &v7tkid,
1137 &v6v_Data,
1138 &v6v_pk,
1139 &v6accc,
1140 &v7utomb,
1141 &v8musr,
1142 &v10itemuuid,
1143 &v10sysbound,
1144 &v10_1pcsservice,
1145 &v10_1pcspublickey,
1146 &v10_1pcspublicidentity,
1147 &v10_1itempersistentref,
1148 0
1149 },
1150 };
1151
1152 const SecDbClass v10_1_keys_class = {
1153 .name = CFSTR("keys"),
1154 .itemclass = true,
1155 .attrs = {
1156 &v6rowid,
1157 &v6cdat,
1158 &v6mdat,
1159 &v6kcls,
1160 &v6labl,
1161 &v6alis,
1162 &v6perm,
1163 &v6priv,
1164 &v6modi,
1165 &v6klbl,
1166 &v6atag,
1167 &v6keycrtr,
1168 &v6keytype,
1169 &v6bsiz,
1170 &v6esiz,
1171 &v6sdat,
1172 &v6edat,
1173 &v6sens,
1174 &v6asen,
1175 &v6extr,
1176 &v6next,
1177 &v6encr,
1178 &v6decr,
1179 &v6drve,
1180 &v6sign,
1181 &v6vrfy,
1182 &v6snrc,
1183 &v6vyrc,
1184 &v6wrap,
1185 &v6unwp,
1186 &v6data,
1187 &v6agrp,
1188 &v6pdmn,
1189 &v6sync,
1190 &v6tomb,
1191 &v6sha1,
1192 &v7vwht,
1193 &v7tkid,
1194 &v6v_Data,
1195 &v6v_pk,
1196 &v6accc,
1197 &v7utomb,
1198 &v8musr,
1199 &v10itemuuid,
1200 &v10sysbound,
1201 &v10_1pcsservice,
1202 &v10_1pcspublickey,
1203 &v10_1pcspublicidentity,
1204 &v10_1itempersistentref,
1205 0
1206 }
1207 };
1208
1209 const SecDbClass v10_0_tversion_class = {
1210 .name = CFSTR("tversion"),
1211 .itemclass = false,
1212 .attrs = {
1213 &v6rowid,
1214 &v6version,
1215 &v91minor,
1216 0
1217 }
1218 };
1219
1220 const SecDbClass v10_2_outgoing_queue_class = {
1221 .name = CFSTR("outgoingqueue"),
1222 .itemclass = false,
1223 .attrs = {
1224 &v10ckzone,
1225 &v10syncuuid,
1226 &v10parentKeyUUID,
1227 &v10action,
1228 &v10state,
1229 &v10waituntiltime,
1230 &v10accessgroup,
1231 &v10gencount,
1232 &v10wrappedkey,
1233 &v10encrypteditem,
1234 &v10encryptionver,
1235 &v10_1optionalEncodedCKRecord,
1236 &v10_1pcsservice,
1237 &v10_1pcspublickey,
1238 &v10_1pcspublicidentity,
1239 0
1240 }
1241 };
1242
1243 const SecDbClass v10_2_incoming_queue_class = {
1244 .name = CFSTR("incomingqueue"),
1245 .itemclass = false,
1246 .attrs = {
1247 &v10ckzone,
1248 &v10syncuuid,
1249 &v10parentKeyUUID,
1250 &v10action,
1251 &v10state,
1252 &v10gencount,
1253 &v10wrappedkey,
1254 &v10encrypteditem,
1255 &v10encryptionver,
1256 &v10_1optionalEncodedCKRecord,
1257 &v10_1pcsservice,
1258 &v10_1pcspublickey,
1259 &v10_1pcspublicidentity,
1260 0
1261 }
1262 };
1263
1264
1265 const SecDbClass v10_1_outgoing_queue_class = {
1266 .name = CFSTR("outgoingqueue"),
1267 .itemclass = false,
1268 .attrs = {
1269 &v10ckzone,
1270 &v10syncuuid,
1271 &v10parentKeyUUID,
1272 &v10action,
1273 &v10state,
1274 &v10waituntiltime,
1275 &v10accessgroup,
1276 &v10gencount,
1277 &v10wrappedkey,
1278 &v10encrypteditem,
1279 &v10encryptionver,
1280 &v10_1pcsservice,
1281 &v10_1pcspublickey,
1282 &v10_1pcspublicidentity,
1283 0
1284 }
1285 };
1286
1287 const SecDbClass v10_1_incoming_queue_class = {
1288 .name = CFSTR("incomingqueue"),
1289 .itemclass = false,
1290 .attrs = {
1291 &v10ckzone,
1292 &v10syncuuid,
1293 &v10parentKeyUUID,
1294 &v10action,
1295 &v10state,
1296 &v10gencount,
1297 &v10wrappedkey,
1298 &v10encrypteditem,
1299 &v10encryptionver,
1300 &v10_1pcsservice,
1301 &v10_1pcspublickey,
1302 &v10_1pcspublicidentity,
1303 0
1304 }
1305 };
1306
1307
1308 const SecDbClass v10_0_outgoing_queue_class = {
1309 .name = CFSTR("outgoingqueue"),
1310 .itemclass = false,
1311 .attrs = {
1312 &v10ckzone,
1313 &v10syncuuid,
1314 &v10parentKeyUUID,
1315 &v10action,
1316 &v10state,
1317 &v10waituntiltime,
1318 &v10accessgroup,
1319 &v10gencount,
1320 &v10wrappedkey,
1321 &v10encrypteditem,
1322 &v10encryptionver,
1323 0
1324 }
1325 };
1326
1327 const SecDbClass v10_0_incoming_queue_class = {
1328 .name = CFSTR("incomingqueue"),
1329 .itemclass = false,
1330 .attrs = {
1331 &v10ckzone,
1332 &v10syncuuid,
1333 &v10parentKeyUUID,
1334 &v10action,
1335 &v10state,
1336 &v10gencount,
1337 &v10wrappedkey,
1338 &v10encrypteditem,
1339 &v10encryptionver,
1340 0
1341 }
1342 };
1343
1344 const SecDbClass v10_0_sync_key_class = {
1345 .name = CFSTR("synckeys"),
1346 .itemclass = false,
1347 .attrs = {
1348 &v10ckzone,
1349 &v10syncuuid,
1350 &v10keyclass,
1351 &v10currentkey,
1352 &v10parentKeyUUID,
1353 &v10state,
1354 &v10wrappedkey,
1355 &v10encodedCKRecord,
1356 0
1357 }
1358 };
1359
1360 // Stores the "Current Key" records, and parentKeyUUID refers to items in the synckeys table
1361 // Wouldn't foreign keys be nice?
1362 const SecDbClass v10_0_current_key_class = {
1363 .name = CFSTR("currentkeys"),
1364 .itemclass = false,
1365 .attrs = {
1366 &v10ckzone,
1367 &v10keyclass,
1368 &v10currentKeyUUID,
1369 &v10encodedCKRecord,
1370 0
1371 }
1372 };
1373
1374 const SecDbClass v10_1_current_item_class = {
1375 .name = CFSTR("currentitems"),
1376 .itemclass = false,
1377 .attrs = {
1378 &v10ckzone,
1379 &v10_1currentPtrIdentifier,
1380 &v10_1currentItemUUID,
1381 &v10state,
1382 &v10encodedCKRecord,
1383 0
1384 }
1385 };
1386
1387 const SecDbClass v10_1_ckmirror_class = {
1388 .name = CFSTR("ckmirror"),
1389 .itemclass = false,
1390 .attrs = {
1391 &v10ckzone,
1392 &v10syncuuid,
1393 &v10parentKeyUUID,
1394 &v10gencount,
1395 &v10wrappedkey,
1396 &v10encrypteditem,
1397 &v10encodedCKRecord,
1398 &v10encryptionver,
1399 &v10_1wasCurrent,
1400 &v10_1pcsservice,
1401 &v10_1pcspublickey,
1402 &v10_1pcspublicidentity,
1403 0
1404 }
1405 };
1406
1407 const SecDbClass v10_0_ckmirror_class = {
1408 .name = CFSTR("ckmirror"),
1409 .itemclass = false,
1410 .attrs = {
1411 &v10ckzone,
1412 &v10syncuuid,
1413 &v10parentKeyUUID,
1414 &v10gencount,
1415 &v10wrappedkey,
1416 &v10encrypteditem,
1417 &v10encodedCKRecord,
1418 &v10encryptionver,
1419 0
1420 }
1421 };
1422
1423 const SecDbClass v10_0_ckstate_class = {
1424 .name = CFSTR("ckstate"),
1425 .itemclass = false,
1426 .attrs = {
1427 &v10ckzone,
1428 &v10ckzonecreated,
1429 &v10ckzonesubscribed,
1430 &v10lastfetchtime,
1431 &v10changetoken,
1432 &v10ratelimiter,
1433 0
1434 }
1435 };
1436
1437 /* Backup table */
1438 /* Primary keys: v10primaryKey, v8musr */
1439 /* This table is currently unused */
1440 const SecDbClass v10_0_item_backup_class = {
1441 .name = CFSTR("item_backup"),
1442 .itemclass = false,
1443 .attrs = {
1444 &v6rowid,
1445 &v10primaryKey, // Primary key of the original item, from v6v_pk
1446 &v8musr, //
1447 &v6sha1, // Hash of the original item
1448 &v10backupData, // Data wrapped to backup keybag
1449 &v6pkhh, // Hash of the public key of the backup bag [v10publickeyHash]
1450 0
1451 }
1452 };
1453
1454 /* Backup Keybag table */
1455 /* Primary keys: v10publickeyHash, v8musr */
1456 /* This table is currently unused */
1457 const SecDbClass v10_0_backup_keybag_class = {
1458 .name = CFSTR("backup_keybag"),
1459 .itemclass = false,
1460 .attrs = {
1461 &v6rowid,
1462 &v10publickeyHash, // Hash of the public key of the backup bag
1463 &v8musr, //
1464 &v10publickey, // Public key for the asymmetric backup bag
1465 &v6agrp, // Used for backup agent
1466 0
1467 }
1468 };
1469
1470 const SecDbClass v10_1_backup_keyarchive_class = {
1471 .name = CFSTR("backup_keyarchive"),
1472 .itemclass = false,
1473 .attrs = {
1474 &v10_1keyArchiveHash, // Hash of the key archive
1475 &v8musr, //
1476 &v10_1keyArchive, // Serialised key archive
1477 &v10ckzone,
1478 &v10_1optionalEncodedCKRecord,
1479 &v10_1archiveEscrowID,
1480 0
1481 }
1482 };
1483
1484 const SecDbClass v10_1_current_archived_keys_class = {
1485 .name = CFSTR("archived_key_backup"),
1486 .itemclass = false,
1487 .attrs = {
1488 &v6pdmn,
1489 &v10syncuuid,
1490 &v8musr,
1491 &v6agrp,
1492 &v10_1keyArchiveHash,
1493 &v10_1archivedKey,
1494 &v10ckzone,
1495 &v10_1optionalEncodedCKRecord,
1496 &v10_1archiveEscrowID,
1497 0
1498 }
1499 };
1500
1501 const SecDbClass v10_1_current_keyarchive_class = {
1502 .name = CFSTR("currentkeyarchives"),
1503 .itemclass = false,
1504 .attrs = {
1505 &v10_1keyArchiveHash,
1506 &v10_1keyArchiveName,
1507 0
1508 }
1509 };
1510
1511 /* An identity which is really a cert + a key, so all cert and keys attrs are
1512 allowed. */
1513 const SecDbClass v_identity_class = {
1514 .name = CFSTR("idnt"),
1515 .itemclass = true,
1516 .attrs = {
1517 0
1518 },
1519 };
1520
1521 /*
1522 * Version 12.0
1523 * Add backup/restore mechanism
1524 */
1525 const SecDbSchema v12_0_schema = {
1526 .majorVersion = 12,
1527 .minorVersion = 0,
1528 .classes = {
1529 &v12_genp_class,
1530 &v12_inet_class,
1531 &v12_cert_class,
1532 &v12_keys_class,
1533 &v10_0_tversion_class,
1534 &v10_2_outgoing_queue_class,
1535 &v10_2_incoming_queue_class,
1536 &v10_0_sync_key_class,
1537 &v10_1_ckmirror_class,
1538 &v10_0_current_key_class,
1539 &v11_9_ckstate_class,
1540 &v10_0_item_backup_class,
1541 &v10_0_backup_keybag_class,
1542 &v10_2_ckmanifest_class,
1543 &v10_2_pending_manifest_class,
1544 &v10_1_ckmanifest_leaf_class,
1545 &v10_1_backup_keyarchive_class,
1546 &v10_1_current_keyarchive_class,
1547 &v10_1_current_archived_keys_class,
1548 &v10_1_pending_manifest_leaf_class,
1549 &v10_4_current_item_class,
1550 &v11_5_ckdevicestate_class,
1551 &v10_5_tlkshare_class,
1552 &v12_metadatakeys_class,
1553 &v12_backupbags_class,
1554 &v12_backupkeyclasssigningkeys_class,
1555 &v12_backuprecoverysets_class,
1556 0
1557 }
1558 };
1559
1560 /*
1561 * Version 11.9
1562 * Add extra columns for CKState
1563 */
1564 const SecDbSchema v11_9_schema = {
1565 .majorVersion = 11,
1566 .minorVersion = 9,
1567 .classes = {
1568 &v11_7_genp_class,
1569 &v11_8_inet_class,
1570 &v11_7_cert_class,
1571 &v11_7_keys_class,
1572 &v10_0_tversion_class,
1573 &v10_2_outgoing_queue_class,
1574 &v10_2_incoming_queue_class,
1575 &v10_0_sync_key_class,
1576 &v10_1_ckmirror_class,
1577 &v10_0_current_key_class,
1578 &v11_9_ckstate_class,
1579 &v10_0_item_backup_class,
1580 &v10_0_backup_keybag_class,
1581 &v10_2_ckmanifest_class,
1582 &v10_2_pending_manifest_class,
1583 &v10_1_ckmanifest_leaf_class,
1584 &v10_1_backup_keyarchive_class,
1585 &v10_1_current_keyarchive_class,
1586 &v10_1_current_archived_keys_class,
1587 &v10_1_pending_manifest_leaf_class,
1588 &v10_4_current_item_class,
1589 &v11_5_ckdevicestate_class,
1590 &v10_5_tlkshare_class,
1591 &v11_2_metadatakeys_class,
1592 0
1593 }
1594 };
1595
1596 /*
1597 * Version 11.8
1598 * Add extra binary columns to inet
1599 */
1600 const SecDbSchema v11_8_schema = {
1601 .majorVersion = 11,
1602 .minorVersion = 8,
1603 .classes = {
1604 &v11_7_genp_class,
1605 &v11_8_inet_class,
1606 &v11_7_cert_class,
1607 &v11_7_keys_class,
1608 &v10_0_tversion_class,
1609 &v10_2_outgoing_queue_class,
1610 &v10_2_incoming_queue_class,
1611 &v10_0_sync_key_class,
1612 &v10_1_ckmirror_class,
1613 &v10_0_current_key_class,
1614 &v11_6_ckstate_class,
1615 &v10_0_item_backup_class,
1616 &v10_0_backup_keybag_class,
1617 &v10_2_ckmanifest_class,
1618 &v10_2_pending_manifest_class,
1619 &v10_1_ckmanifest_leaf_class,
1620 &v10_1_backup_keyarchive_class,
1621 &v10_1_current_keyarchive_class,
1622 &v10_1_current_archived_keys_class,
1623 &v10_1_pending_manifest_leaf_class,
1624 &v10_4_current_item_class,
1625 &v11_5_ckdevicestate_class,
1626 &v10_5_tlkshare_class,
1627 &v11_2_metadatakeys_class,
1628 0
1629 }
1630 };
1631
1632 /*
1633 * Version 11.7
1634 * Add 'clip' column to denote item was made by App Clip
1635 */
1636 const SecDbSchema v11_7_schema = {
1637 .majorVersion = 11,
1638 .minorVersion = 7,
1639 .classes = {
1640 &v11_7_genp_class,
1641 &v11_7_inet_class,
1642 &v11_7_cert_class,
1643 &v11_7_keys_class,
1644 &v10_0_tversion_class,
1645 &v10_2_outgoing_queue_class,
1646 &v10_2_incoming_queue_class,
1647 &v10_0_sync_key_class,
1648 &v10_1_ckmirror_class,
1649 &v10_0_current_key_class,
1650 &v11_6_ckstate_class,
1651 &v10_0_item_backup_class,
1652 &v10_0_backup_keybag_class,
1653 &v10_2_ckmanifest_class,
1654 &v10_2_pending_manifest_class,
1655 &v10_1_ckmanifest_leaf_class,
1656 &v10_1_backup_keyarchive_class,
1657 &v10_1_current_keyarchive_class,
1658 &v10_1_current_archived_keys_class,
1659 &v10_1_pending_manifest_leaf_class,
1660 &v10_4_current_item_class,
1661 &v11_5_ckdevicestate_class,
1662 &v10_5_tlkshare_class,
1663 &v11_2_metadatakeys_class,
1664 0
1665 }
1666 };
1667
1668 /*
1669 * Version 11.6 (Add 'moreComing' field to zone state)
1670 */
1671 const SecDbSchema v11_6_schema = {
1672 .majorVersion = 11,
1673 .minorVersion = 6,
1674 .classes = {
1675 &v10_1_genp_class,
1676 &v10_1_inet_class,
1677 &v10_1_cert_class,
1678 &v10_1_keys_class,
1679 &v10_0_tversion_class,
1680 &v10_2_outgoing_queue_class,
1681 &v10_2_incoming_queue_class,
1682 &v10_0_sync_key_class,
1683 &v10_1_ckmirror_class,
1684 &v10_0_current_key_class,
1685 &v11_6_ckstate_class,
1686 &v10_0_item_backup_class,
1687 &v10_0_backup_keybag_class,
1688 &v10_2_ckmanifest_class,
1689 &v10_2_pending_manifest_class,
1690 &v10_1_ckmanifest_leaf_class,
1691 &v10_1_backup_keyarchive_class,
1692 &v10_1_current_keyarchive_class,
1693 &v10_1_current_archived_keys_class,
1694 &v10_1_pending_manifest_leaf_class,
1695 &v10_4_current_item_class,
1696 &v11_5_ckdevicestate_class,
1697 &v10_5_tlkshare_class,
1698 &v11_2_metadatakeys_class,
1699 0
1700 }
1701 };
1702
1703 /*
1704 * Version 11.5 (Add octagon fields to device state)
1705 */
1706 const SecDbSchema v11_5_schema = {
1707 .majorVersion = 11,
1708 .minorVersion = 5,
1709 .classes = {
1710 &v10_1_genp_class,
1711 &v10_1_inet_class,
1712 &v10_1_cert_class,
1713 &v10_1_keys_class,
1714 &v10_0_tversion_class,
1715 &v10_2_outgoing_queue_class,
1716 &v10_2_incoming_queue_class,
1717 &v10_0_sync_key_class,
1718 &v10_1_ckmirror_class,
1719 &v10_0_current_key_class,
1720 &v10_4_ckstate_class,
1721 &v10_0_item_backup_class,
1722 &v10_0_backup_keybag_class,
1723 &v10_2_ckmanifest_class,
1724 &v10_2_pending_manifest_class,
1725 &v10_1_ckmanifest_leaf_class,
1726 &v10_1_backup_keyarchive_class,
1727 &v10_1_current_keyarchive_class,
1728 &v10_1_current_archived_keys_class,
1729 &v10_1_pending_manifest_leaf_class,
1730 &v10_4_current_item_class,
1731 &v11_5_ckdevicestate_class,
1732 &v10_5_tlkshare_class,
1733 &v11_2_metadatakeys_class,
1734 0
1735 }
1736 };
1737
1738
1739 /*
1740 * Version 11.4 (Add some more indexes)
1741 */
1742 const SecDbSchema v11_4_schema = {
1743 .majorVersion = 11,
1744 .minorVersion = 4,
1745 .classes = {
1746 &v10_1_genp_class,
1747 &v10_1_inet_class,
1748 &v10_1_cert_class,
1749 &v10_1_keys_class,
1750 &v10_0_tversion_class,
1751 &v10_2_outgoing_queue_class,
1752 &v10_2_incoming_queue_class,
1753 &v10_0_sync_key_class,
1754 &v10_1_ckmirror_class,
1755 &v10_0_current_key_class,
1756 &v10_4_ckstate_class,
1757 &v10_0_item_backup_class,
1758 &v10_0_backup_keybag_class,
1759 &v10_2_ckmanifest_class,
1760 &v10_2_pending_manifest_class,
1761 &v10_1_ckmanifest_leaf_class,
1762 &v10_1_backup_keyarchive_class,
1763 &v10_1_current_keyarchive_class,
1764 &v10_1_current_archived_keys_class,
1765 &v10_1_pending_manifest_leaf_class,
1766 &v10_4_current_item_class,
1767 &v11_1_ckdevicestate_class,
1768 &v10_5_tlkshare_class,
1769 &v11_2_metadatakeys_class,
1770 0
1771 }
1772 };
1773
1774 /*
1775 * Version 11.3 (no changes, restores the use of indexes in upgrade code. Gotta go fast!)
1776 */
1777 const SecDbSchema v11_3_schema = {
1778 .majorVersion = 11,
1779 .minorVersion = 3,
1780 .classes = {
1781 &v10_1_genp_class,
1782 &v10_1_inet_class,
1783 &v10_1_cert_class,
1784 &v10_1_keys_class,
1785 &v10_0_tversion_class,
1786 &v10_2_outgoing_queue_class,
1787 &v10_2_incoming_queue_class,
1788 &v10_0_sync_key_class,
1789 &v10_1_ckmirror_class,
1790 &v10_0_current_key_class,
1791 &v10_4_ckstate_class,
1792 &v10_0_item_backup_class,
1793 &v10_0_backup_keybag_class,
1794 &v10_2_ckmanifest_class,
1795 &v10_2_pending_manifest_class,
1796 &v10_1_ckmanifest_leaf_class,
1797 &v10_1_backup_keyarchive_class,
1798 &v10_1_current_keyarchive_class,
1799 &v10_1_current_archived_keys_class,
1800 &v10_1_pending_manifest_leaf_class,
1801 &v10_4_current_item_class,
1802 &v11_1_ckdevicestate_class,
1803 &v10_5_tlkshare_class,
1804 &v11_2_metadatakeys_class,
1805 0
1806 }
1807 };
1808
1809 /*
1810 * Version 11.2
1811 */
1812 const SecDbSchema v11_2_schema = {
1813 .majorVersion = 11,
1814 .minorVersion = 2,
1815 .classes = {
1816 &v10_1_genp_class,
1817 &v10_1_inet_class,
1818 &v10_1_cert_class,
1819 &v10_1_keys_class,
1820 &v10_0_tversion_class,
1821 &v10_2_outgoing_queue_class,
1822 &v10_2_incoming_queue_class,
1823 &v10_0_sync_key_class,
1824 &v10_1_ckmirror_class,
1825 &v10_0_current_key_class,
1826 &v10_4_ckstate_class,
1827 &v10_0_item_backup_class,
1828 &v10_0_backup_keybag_class,
1829 &v10_2_ckmanifest_class,
1830 &v10_2_pending_manifest_class,
1831 &v10_1_ckmanifest_leaf_class,
1832 &v10_1_backup_keyarchive_class,
1833 &v10_1_current_keyarchive_class,
1834 &v10_1_current_archived_keys_class,
1835 &v10_1_pending_manifest_leaf_class,
1836 &v10_4_current_item_class,
1837 &v11_1_ckdevicestate_class,
1838 &v10_5_tlkshare_class,
1839 &v11_2_metadatakeys_class,
1840 0
1841 }
1842 };
1843
1844 /*
1845 * Version 11.1
1846 */
1847 const SecDbSchema v11_1_schema = {
1848 .majorVersion = 11,
1849 .minorVersion = 1,
1850 .classes = {
1851 &v10_1_genp_class,
1852 &v10_1_inet_class,
1853 &v10_1_cert_class,
1854 &v10_1_keys_class,
1855 &v10_0_tversion_class,
1856 &v10_2_outgoing_queue_class,
1857 &v10_2_incoming_queue_class,
1858 &v10_0_sync_key_class,
1859 &v10_1_ckmirror_class,
1860 &v10_0_current_key_class,
1861 &v10_4_ckstate_class,
1862 &v10_0_item_backup_class,
1863 &v10_0_backup_keybag_class,
1864 &v10_2_ckmanifest_class,
1865 &v10_2_pending_manifest_class,
1866 &v10_1_ckmanifest_leaf_class,
1867 &v10_1_backup_keyarchive_class,
1868 &v10_1_current_keyarchive_class,
1869 &v10_1_current_archived_keys_class,
1870 &v10_1_pending_manifest_leaf_class,
1871 &v10_4_current_item_class,
1872 &v11_1_ckdevicestate_class,
1873 &v10_5_tlkshare_class,
1874 &v11_metadatakeys_class,
1875 0
1876 }
1877 };
1878
1879 /*
1880 * Version 11
1881 */
1882 const SecDbSchema v11_schema = {
1883 .majorVersion = 11,
1884 .minorVersion = 0,
1885 .classes = {
1886 &v10_1_genp_class,
1887 &v10_1_inet_class,
1888 &v10_1_cert_class,
1889 &v10_1_keys_class,
1890 &v10_0_tversion_class,
1891 &v10_2_outgoing_queue_class,
1892 &v10_2_incoming_queue_class,
1893 &v10_0_sync_key_class,
1894 &v10_1_ckmirror_class,
1895 &v10_0_current_key_class,
1896 &v10_4_ckstate_class,
1897 &v10_0_item_backup_class,
1898 &v10_0_backup_keybag_class,
1899 &v10_2_ckmanifest_class,
1900 &v10_2_pending_manifest_class,
1901 &v10_1_ckmanifest_leaf_class,
1902 &v10_1_backup_keyarchive_class,
1903 &v10_1_current_keyarchive_class,
1904 &v10_1_current_archived_keys_class,
1905 &v10_1_pending_manifest_leaf_class,
1906 &v10_4_current_item_class,
1907 &v10_3_ckdevicestate_class,
1908 &v10_5_tlkshare_class,
1909 &v11_metadatakeys_class,
1910 0
1911 }
1912 };
1913
1914
1915 /*
1916 * Version 10.5
1917 */
1918 const SecDbSchema v10_5_schema = {
1919 .majorVersion = 10,
1920 .minorVersion = 5,
1921 .classes = {
1922 &v10_1_genp_class,
1923 &v10_1_inet_class,
1924 &v10_1_cert_class,
1925 &v10_1_keys_class,
1926 &v10_0_tversion_class,
1927 &v10_2_outgoing_queue_class,
1928 &v10_2_incoming_queue_class,
1929 &v10_0_sync_key_class,
1930 &v10_1_ckmirror_class,
1931 &v10_0_current_key_class,
1932 &v10_4_ckstate_class,
1933 &v10_0_item_backup_class,
1934 &v10_0_backup_keybag_class,
1935 &v10_2_ckmanifest_class,
1936 &v10_2_pending_manifest_class,
1937 &v10_1_ckmanifest_leaf_class,
1938 &v10_1_backup_keyarchive_class,
1939 &v10_1_current_keyarchive_class,
1940 &v10_1_current_archived_keys_class,
1941 &v10_1_pending_manifest_leaf_class,
1942 &v10_4_current_item_class,
1943 &v10_3_ckdevicestate_class,
1944 &v10_5_tlkshare_class,
1945 0
1946 }
1947 };
1948
1949 /*
1950 * Version 10.4
1951 */
1952 const SecDbSchema v10_4_schema = {
1953 .majorVersion = 10,
1954 .minorVersion = 4,
1955 .classes = {
1956 &v10_1_genp_class,
1957 &v10_1_inet_class,
1958 &v10_1_cert_class,
1959 &v10_1_keys_class,
1960 &v10_0_tversion_class,
1961 &v10_2_outgoing_queue_class,
1962 &v10_2_incoming_queue_class,
1963 &v10_0_sync_key_class,
1964 &v10_1_ckmirror_class,
1965 &v10_0_current_key_class,
1966 &v10_4_ckstate_class,
1967 &v10_0_item_backup_class,
1968 &v10_0_backup_keybag_class,
1969 &v10_2_ckmanifest_class,
1970 &v10_2_pending_manifest_class,
1971 &v10_1_ckmanifest_leaf_class,
1972 &v10_1_backup_keyarchive_class,
1973 &v10_1_current_keyarchive_class,
1974 &v10_1_current_archived_keys_class,
1975 &v10_1_pending_manifest_leaf_class,
1976 &v10_4_current_item_class,
1977 &v10_3_ckdevicestate_class,
1978 0
1979 }
1980 };
1981
1982 /*
1983 * Version 10.3
1984 */
1985 const SecDbSchema v10_3_schema = {
1986 .majorVersion = 10,
1987 .minorVersion = 3,
1988 .classes = {
1989 &v10_1_genp_class,
1990 &v10_1_inet_class,
1991 &v10_1_cert_class,
1992 &v10_1_keys_class,
1993 &v10_0_tversion_class,
1994 &v10_2_outgoing_queue_class,
1995 &v10_2_incoming_queue_class,
1996 &v10_0_sync_key_class,
1997 &v10_1_ckmirror_class,
1998 &v10_0_current_key_class,
1999 &v10_0_ckstate_class,
2000 &v10_0_item_backup_class,
2001 &v10_0_backup_keybag_class,
2002 &v10_2_ckmanifest_class,
2003 &v10_2_pending_manifest_class,
2004 &v10_1_ckmanifest_leaf_class,
2005 &v10_1_backup_keyarchive_class,
2006 &v10_1_current_keyarchive_class,
2007 &v10_1_current_archived_keys_class,
2008 &v10_1_pending_manifest_leaf_class,
2009 &v10_1_current_item_class,
2010 &v10_3_ckdevicestate_class,
2011 0
2012 }
2013 };
2014
2015 /*
2016 * Version 10.2
2017 */
2018 const SecDbSchema v10_2_schema = {
2019 .majorVersion = 10,
2020 .minorVersion = 2,
2021 .classes = {
2022 &v10_1_genp_class,
2023 &v10_1_inet_class,
2024 &v10_1_cert_class,
2025 &v10_1_keys_class,
2026 &v10_0_tversion_class,
2027 &v10_2_outgoing_queue_class,
2028 &v10_2_incoming_queue_class,
2029 &v10_0_sync_key_class,
2030 &v10_1_ckmirror_class,
2031 &v10_0_current_key_class,
2032 &v10_0_ckstate_class,
2033 &v10_0_item_backup_class,
2034 &v10_0_backup_keybag_class,
2035 &v10_2_ckmanifest_class,
2036 &v10_2_pending_manifest_class,
2037 &v10_1_ckmanifest_leaf_class,
2038 &v10_1_backup_keyarchive_class,
2039 &v10_1_current_keyarchive_class,
2040 &v10_1_current_archived_keys_class,
2041 &v10_1_pending_manifest_leaf_class,
2042 &v10_1_current_item_class,
2043 0
2044 }
2045 };
2046
2047 /*
2048 * Version 10.1
2049 */
2050 const SecDbSchema v10_1_schema = {
2051 .majorVersion = 10,
2052 .minorVersion = 1,
2053 .classes = {
2054 &v10_1_genp_class,
2055 &v10_1_inet_class,
2056 &v10_1_cert_class,
2057 &v10_1_keys_class,
2058 &v10_0_tversion_class,
2059 &v10_1_outgoing_queue_class,
2060 &v10_1_incoming_queue_class,
2061 &v10_0_sync_key_class,
2062 &v10_1_ckmirror_class,
2063 &v10_0_current_key_class,
2064 &v10_0_ckstate_class,
2065 &v10_0_item_backup_class,
2066 &v10_0_backup_keybag_class,
2067 &v10_1_ckmanifest_class,
2068 &v10_1_pending_manifest_class,
2069 &v10_1_ckmanifest_leaf_class,
2070 &v10_1_backup_keyarchive_class,
2071 &v10_1_current_keyarchive_class,
2072 &v10_1_current_archived_keys_class,
2073 &v10_1_pending_manifest_leaf_class,
2074 &v10_1_current_item_class,
2075 0
2076 }
2077 };
2078
2079 /*
2080 * Version 10.0
2081 */
2082
2083 const SecDbClass v10_0_genp_class = {
2084 .name = CFSTR("genp"),
2085 .itemclass = true,
2086 .attrs = {
2087 &v6rowid,
2088 &v6cdat,
2089 &v6mdat,
2090 &v6desc,
2091 &v6icmt,
2092 &v6crtr,
2093 &v6type,
2094 &v6scrp,
2095 &v6labl,
2096 &v6alis,
2097 &v6invi,
2098 &v6nega,
2099 &v6cusi,
2100 &v6prot,
2101 &v6acct,
2102 &v6svce,
2103 &v6gena,
2104 &v6data,
2105 &v6agrp,
2106 &v6pdmn,
2107 &v6sync,
2108 &v6tomb,
2109 &v6sha1,
2110 &v7vwht,
2111 &v7tkid,
2112 &v6v_Data,
2113 &v6v_pk,
2114 &v6accc,
2115 &v7utomb,
2116 &v8musr,
2117 &v10itemuuid,
2118 &v10itempersistentref,
2119 &v10sysbound,
2120 0
2121 },
2122 };
2123
2124 const SecDbClass v10_0_inet_class = {
2125 .name = CFSTR("inet"),
2126 .itemclass = true,
2127 .attrs = {
2128 &v6rowid,
2129 &v6cdat,
2130 &v6mdat,
2131 &v6desc,
2132 &v6icmt,
2133 &v6crtr,
2134 &v6type,
2135 &v6scrp,
2136 &v6labl,
2137 &v6alis,
2138 &v6invi,
2139 &v6nega,
2140 &v6cusi,
2141 &v6prot,
2142 &v6acct,
2143 &v6sdmn,
2144 &v6srvr,
2145 &v6ptcl,
2146 &v6atyp,
2147 &v6port,
2148 &v6path,
2149 &v6data,
2150 &v6agrp,
2151 &v6pdmn,
2152 &v6sync,
2153 &v6tomb,
2154 &v6sha1,
2155 &v7vwht,
2156 &v7tkid,
2157 &v6v_Data,
2158 &v6v_pk,
2159 &v6accc,
2160 &v7utomb,
2161 &v8musr,
2162 &v10itemuuid,
2163 &v10itempersistentref,
2164 &v10sysbound,
2165 0
2166 },
2167 };
2168
2169 const SecDbClass v10_0_cert_class = {
2170 .name = CFSTR("cert"),
2171 .itemclass = true,
2172 .attrs = {
2173 &v6rowid,
2174 &v6cdat,
2175 &v6mdat,
2176 &v6ctyp,
2177 &v6cenc,
2178 &v6labl,
2179 &v6certalis,
2180 &v6subj,
2181 &v6issr,
2182 &v6slnr,
2183 &v6skid,
2184 &v6pkhh,
2185 &v6data,
2186 &v6agrp,
2187 &v6pdmn,
2188 &v6sync,
2189 &v6tomb,
2190 &v6sha1,
2191 &v7vwht,
2192 &v7tkid,
2193 &v6v_Data,
2194 &v6v_pk,
2195 &v6accc,
2196 &v7utomb,
2197 &v8musr,
2198 &v10itemuuid,
2199 &v10itempersistentref,
2200 &v10sysbound,
2201 0
2202 },
2203 };
2204
2205 const SecDbClass v10_0_keys_class = {
2206 .name = CFSTR("keys"),
2207 .itemclass = true,
2208 .attrs = {
2209 &v6rowid,
2210 &v6cdat,
2211 &v6mdat,
2212 &v6kcls,
2213 &v6labl,
2214 &v6alis,
2215 &v6perm,
2216 &v6priv,
2217 &v6modi,
2218 &v6klbl,
2219 &v6atag,
2220 &v6keycrtr,
2221 &v6keytype,
2222 &v6bsiz,
2223 &v6esiz,
2224 &v6sdat,
2225 &v6edat,
2226 &v6sens,
2227 &v6asen,
2228 &v6extr,
2229 &v6next,
2230 &v6encr,
2231 &v6decr,
2232 &v6drve,
2233 &v6sign,
2234 &v6vrfy,
2235 &v6snrc,
2236 &v6vyrc,
2237 &v6wrap,
2238 &v6unwp,
2239 &v6data,
2240 &v6agrp,
2241 &v6pdmn,
2242 &v6sync,
2243 &v6tomb,
2244 &v6sha1,
2245 &v7vwht,
2246 &v7tkid,
2247 &v6v_Data,
2248 &v6v_pk,
2249 &v6accc,
2250 &v7utomb,
2251 &v8musr,
2252 &v10itemuuid,
2253 &v10itempersistentref,
2254 &v10sysbound,
2255 0
2256 }
2257 };
2258
2259 const SecDbSchema v10_0_schema = {
2260 .majorVersion = 10,
2261 .minorVersion = 0,
2262 .classes = {
2263 &v10_0_genp_class,
2264 &v10_0_inet_class,
2265 &v10_0_cert_class,
2266 &v10_0_keys_class,
2267 &v10_0_tversion_class,
2268 &v10_0_outgoing_queue_class,
2269 &v10_0_incoming_queue_class,
2270 &v10_0_sync_key_class,
2271 &v10_0_ckmirror_class,
2272 &v10_0_current_key_class,
2273 &v10_0_ckstate_class,
2274 &v10_0_item_backup_class,
2275 &v10_0_backup_keybag_class,
2276 0
2277 }
2278 };
2279
2280 const SecDbClass v9_1_tversion_class = {
2281 .name = CFSTR("tversion91"),
2282 .itemclass = false,
2283 .attrs = {
2284 &v6rowid,
2285 &v6version,
2286 &v91minor,
2287 0
2288 }
2289 };
2290
2291 const SecDbClass v9_1_genp_class = {
2292 .name = CFSTR("genp91"),
2293 .itemclass = true,
2294 .attrs = {
2295 &v6rowid,
2296 &v6cdat,
2297 &v6mdat,
2298 &v6desc,
2299 &v6icmt,
2300 &v6crtr,
2301 &v6type,
2302 &v6scrp,
2303 &v6labl,
2304 &v6alis,
2305 &v6invi,
2306 &v6nega,
2307 &v6cusi,
2308 &v6prot,
2309 &v6acct,
2310 &v6svce,
2311 &v6gena,
2312 &v6data,
2313 &v6agrp,
2314 &v6pdmn,
2315 &v6sync,
2316 &v6tomb,
2317 &v6sha1,
2318 &v7vwht,
2319 &v7tkid,
2320 &v6v_Data,
2321 &v6v_pk,
2322 &v6accc,
2323 &v7utomb,
2324 &v8musr,
2325 0
2326 },
2327 };
2328
2329 const SecDbClass v9_1_inet_class = {
2330 .name = CFSTR("inet91"),
2331 .itemclass = true,
2332 .attrs = {
2333 &v6rowid,
2334 &v6cdat,
2335 &v6mdat,
2336 &v6desc,
2337 &v6icmt,
2338 &v6crtr,
2339 &v6type,
2340 &v6scrp,
2341 &v6labl,
2342 &v6alis,
2343 &v6invi,
2344 &v6nega,
2345 &v6cusi,
2346 &v6prot,
2347 &v6acct,
2348 &v6sdmn,
2349 &v6srvr,
2350 &v6ptcl,
2351 &v6atyp,
2352 &v6port,
2353 &v6path,
2354 &v6data,
2355 &v6agrp,
2356 &v6pdmn,
2357 &v6sync,
2358 &v6tomb,
2359 &v6sha1,
2360 &v7vwht,
2361 &v7tkid,
2362 &v6v_Data,
2363 &v6v_pk,
2364 &v6accc,
2365 &v7utomb,
2366 &v8musr,
2367 0
2368 },
2369 };
2370
2371 const SecDbClass v9_1_cert_class = {
2372 .name = CFSTR("cert91"),
2373 .itemclass = true,
2374 .attrs = {
2375 &v6rowid,
2376 &v6cdat,
2377 &v6mdat,
2378 &v6ctyp,
2379 &v6cenc,
2380 &v6labl,
2381 &v6certalis,
2382 &v6subj,
2383 &v6issr,
2384 &v6slnr,
2385 &v6skid,
2386 &v6pkhh,
2387 &v6data,
2388 &v6agrp,
2389 &v6pdmn,
2390 &v6sync,
2391 &v6tomb,
2392 &v6sha1,
2393 &v7vwht,
2394 &v7tkid,
2395 &v6v_Data,
2396 &v6v_pk,
2397 &v6accc,
2398 &v7utomb,
2399 &v8musr,
2400 0
2401 },
2402 };
2403
2404 const SecDbClass v9_1_keys_class = {
2405 .name = CFSTR("keys91"),
2406 .itemclass = true,
2407 .attrs = {
2408 &v6rowid,
2409 &v6cdat,
2410 &v6mdat,
2411 &v6kcls,
2412 &v6labl,
2413 &v6alis,
2414 &v6perm,
2415 &v6priv,
2416 &v6modi,
2417 &v6klbl,
2418 &v6atag,
2419 &v6keycrtr,
2420 &v6keytype,
2421 &v6bsiz,
2422 &v6esiz,
2423 &v6sdat,
2424 &v6edat,
2425 &v6sens,
2426 &v6asen,
2427 &v6extr,
2428 &v6next,
2429 &v6encr,
2430 &v6decr,
2431 &v6drve,
2432 &v6sign,
2433 &v6vrfy,
2434 &v6snrc,
2435 &v6vyrc,
2436 &v6wrap,
2437 &v6unwp,
2438 &v6data,
2439 &v6agrp,
2440 &v6pdmn,
2441 &v6sync,
2442 &v6tomb,
2443 &v6sha1,
2444 &v7vwht,
2445 &v7tkid,
2446 &v6v_Data,
2447 &v6v_pk,
2448 &v6accc,
2449 &v7utomb,
2450 &v8musr,
2451 0
2452 }
2453 };
2454
2455 /*
2456 * Version 9.1 (iOS 10.0 and OSX 10.11.8/10.12 addded minor version.
2457 */
2458 const SecDbSchema v9_1_schema = {
2459 .majorVersion = 9,
2460 .minorVersion = 1,
2461 .classes = {
2462 &v9_1_genp_class,
2463 &v9_1_inet_class,
2464 &v9_1_cert_class,
2465 &v9_1_keys_class,
2466 &v9_1_tversion_class,
2467 0
2468 }
2469 };
2470
2471 const SecDbClass v9genp_class = {
2472 .name = CFSTR("genp9"),
2473 .itemclass = true,
2474 .attrs = {
2475 &v6rowid,
2476 &v6cdat,
2477 &v6mdat,
2478 &v6desc,
2479 &v6icmt,
2480 &v6crtr,
2481 &v6type,
2482 &v6scrp,
2483 &v6labl,
2484 &v6alis,
2485 &v6invi,
2486 &v6nega,
2487 &v6cusi,
2488 &v6prot,
2489 &v6acct,
2490 &v6svce,
2491 &v6gena,
2492 &v6data,
2493 &v6agrp,
2494 &v6pdmn,
2495 &v6sync,
2496 &v6tomb,
2497 &v6sha1,
2498 &v7vwht,
2499 &v7tkid,
2500 &v6v_Data,
2501 &v6v_pk,
2502 &v6accc,
2503 &v7utomb,
2504 &v8musr,
2505 0
2506 },
2507 };
2508
2509 const SecDbClass v9inet_class = {
2510 .name = CFSTR("inet9"),
2511 .itemclass = true,
2512 .attrs = {
2513 &v6rowid,
2514 &v6cdat,
2515 &v6mdat,
2516 &v6desc,
2517 &v6icmt,
2518 &v6crtr,
2519 &v6type,
2520 &v6scrp,
2521 &v6labl,
2522 &v6alis,
2523 &v6invi,
2524 &v6nega,
2525 &v6cusi,
2526 &v6prot,
2527 &v6acct,
2528 &v6sdmn,
2529 &v6srvr,
2530 &v6ptcl,
2531 &v6atyp,
2532 &v6port,
2533 &v6path,
2534 &v6data,
2535 &v6agrp,
2536 &v6pdmn,
2537 &v6sync,
2538 &v6tomb,
2539 &v6sha1,
2540 &v7vwht,
2541 &v7tkid,
2542 &v6v_Data,
2543 &v6v_pk,
2544 &v6accc,
2545 &v7utomb,
2546 &v8musr,
2547 0
2548 },
2549 };
2550
2551 const SecDbClass v9cert_class = {
2552 .name = CFSTR("cert9"),
2553 .itemclass = true,
2554 .attrs = {
2555 &v6rowid,
2556 &v6cdat,
2557 &v6mdat,
2558 &v6ctyp,
2559 &v6cenc,
2560 &v6labl,
2561 &v6certalis,
2562 &v6subj,
2563 &v6issr,
2564 &v6slnr,
2565 &v6skid,
2566 &v6pkhh,
2567 &v6data,
2568 &v6agrp,
2569 &v6pdmn,
2570 &v6sync,
2571 &v6tomb,
2572 &v6sha1,
2573 &v7vwht,
2574 &v7tkid,
2575 &v6v_Data,
2576 &v6v_pk,
2577 &v6accc,
2578 &v7utomb,
2579 &v8musr,
2580 0
2581 },
2582 };
2583
2584 const SecDbClass v9keys_class = {
2585 .name = CFSTR("keys9"),
2586 .itemclass = true,
2587 .attrs = {
2588 &v6rowid,
2589 &v6cdat,
2590 &v6mdat,
2591 &v6kcls,
2592 &v6labl,
2593 &v6alis,
2594 &v6perm,
2595 &v6priv,
2596 &v6modi,
2597 &v6klbl,
2598 &v6atag,
2599 &v6keycrtr,
2600 &v6keytype,
2601 &v6bsiz,
2602 &v6esiz,
2603 &v6sdat,
2604 &v6edat,
2605 &v6sens,
2606 &v6asen,
2607 &v6extr,
2608 &v6next,
2609 &v6encr,
2610 &v6decr,
2611 &v6drve,
2612 &v6sign,
2613 &v6vrfy,
2614 &v6snrc,
2615 &v6vyrc,
2616 &v6wrap,
2617 &v6unwp,
2618 &v6data,
2619 &v6agrp,
2620 &v6pdmn,
2621 &v6sync,
2622 &v6tomb,
2623 &v6sha1,
2624 &v7vwht,
2625 &v7tkid,
2626 &v6v_Data,
2627 &v6v_pk,
2628 &v6accc,
2629 &v7utomb,
2630 &v8musr,
2631 0
2632 }
2633 };
2634
2635 const SecDbClass v5tversion_class = {
2636 .name = CFSTR("tversion5"),
2637 .itemclass = false,
2638 .attrs = {
2639 &v6version,
2640 0
2641 }
2642 };
2643
2644 /* Version 9 (iOS 9.3 and OSX 10.11.5) database schema
2645 * Same contents as v8 tables; table names changed to force upgrade
2646 * and correct default values in table.
2647 */
2648 const SecDbSchema v9_schema = {
2649 .majorVersion = 9,
2650 .classes = {
2651 &v9genp_class,
2652 &v9inet_class,
2653 &v9cert_class,
2654 &v9keys_class,
2655 &v5tversion_class,
2656 0
2657 }
2658 };
2659
2660 // Version 8 (Internal release iOS 9.3 and OSX 10.11.5) database schema
2661 const SecDbClass v8genp_class = {
2662 .name = CFSTR("genp8"),
2663 .itemclass = true,
2664 .attrs = {
2665 &v6rowid,
2666 &v6cdat,
2667 &v6mdat,
2668 &v6desc,
2669 &v6icmt,
2670 &v6crtr,
2671 &v6type,
2672 &v6scrp,
2673 &v6labl,
2674 &v6alis,
2675 &v6invi,
2676 &v6nega,
2677 &v6cusi,
2678 &v6prot,
2679 &v6acct,
2680 &v6svce,
2681 &v6gena,
2682 &v6data,
2683 &v6agrp,
2684 &v6pdmn,
2685 &v6sync,
2686 &v6tomb,
2687 &v6sha1,
2688 &v7vwht,
2689 &v7tkid,
2690 &v6v_Data,
2691 &v6v_pk,
2692 &v6accc,
2693 &v7utomb,
2694 &v8musr,
2695 0
2696 },
2697 };
2698
2699 const SecDbClass v8inet_class = {
2700 .name = CFSTR("inet8"),
2701 .itemclass = true,
2702 .attrs = {
2703 &v6rowid,
2704 &v6cdat,
2705 &v6mdat,
2706 &v6desc,
2707 &v6icmt,
2708 &v6crtr,
2709 &v6type,
2710 &v6scrp,
2711 &v6labl,
2712 &v6alis,
2713 &v6invi,
2714 &v6nega,
2715 &v6cusi,
2716 &v6prot,
2717 &v6acct,
2718 &v6sdmn,
2719 &v6srvr,
2720 &v6ptcl,
2721 &v6atyp,
2722 &v6port,
2723 &v6path,
2724 &v6data,
2725 &v6agrp,
2726 &v6pdmn,
2727 &v6sync,
2728 &v6tomb,
2729 &v6sha1,
2730 &v7vwht,
2731 &v7tkid,
2732 &v6v_Data,
2733 &v6v_pk,
2734 &v6accc,
2735 &v7utomb,
2736 &v8musr,
2737 0
2738 },
2739 };
2740
2741 const SecDbClass v8cert_class = {
2742 .name = CFSTR("cert8"),
2743 .itemclass = true,
2744 .attrs = {
2745 &v6rowid,
2746 &v6cdat,
2747 &v6mdat,
2748 &v6ctyp,
2749 &v6cenc,
2750 &v6labl,
2751 &v6certalis,
2752 &v6subj,
2753 &v6issr,
2754 &v6slnr,
2755 &v6skid,
2756 &v6pkhh,
2757 &v6data,
2758 &v6agrp,
2759 &v6pdmn,
2760 &v6sync,
2761 &v6tomb,
2762 &v6sha1,
2763 &v7vwht,
2764 &v7tkid,
2765 &v6v_Data,
2766 &v6v_pk,
2767 &v6accc,
2768 &v7utomb,
2769 &v8musr,
2770 0
2771 },
2772 };
2773
2774 const SecDbClass v8keys_class = {
2775 .name = CFSTR("keys8"),
2776 .itemclass = true,
2777 .attrs = {
2778 &v6rowid,
2779 &v6cdat,
2780 &v6mdat,
2781 &v6kcls,
2782 &v6labl,
2783 &v6alis,
2784 &v6perm,
2785 &v6priv,
2786 &v6modi,
2787 &v6klbl,
2788 &v6atag,
2789 &v6keycrtr,
2790 &v6keytype,
2791 &v6bsiz,
2792 &v6esiz,
2793 &v6sdat,
2794 &v6edat,
2795 &v6sens,
2796 &v6asen,
2797 &v6extr,
2798 &v6next,
2799 &v6encr,
2800 &v6decr,
2801 &v6drve,
2802 &v6sign,
2803 &v6vrfy,
2804 &v6snrc,
2805 &v6vyrc,
2806 &v6wrap,
2807 &v6unwp,
2808 &v6data,
2809 &v6agrp,
2810 &v6pdmn,
2811 &v6sync,
2812 &v6tomb,
2813 &v6sha1,
2814 &v7vwht,
2815 &v7tkid,
2816 &v6v_Data,
2817 &v6v_pk,
2818 &v6accc,
2819 &v7utomb,
2820 &v8musr,
2821 0
2822 }
2823 };
2824
2825 const SecDbSchema v8_schema = {
2826 .majorVersion = 8,
2827 .classes = {
2828 &v8genp_class,
2829 &v8inet_class,
2830 &v8cert_class,
2831 &v8keys_class,
2832 &v5tversion_class,
2833 0
2834 }
2835 };
2836
2837 // Version 7 (iOS 9 and OSX 10.11) database schema
2838 const SecDbClass v7genp_class = {
2839 .name = CFSTR("genp7"),
2840 .itemclass = true,
2841 .attrs = {
2842 &v6rowid,
2843 &v6cdat,
2844 &v6mdat,
2845 &v6desc,
2846 &v6icmt,
2847 &v6crtr,
2848 &v6type,
2849 &v6scrp,
2850 &v6labl,
2851 &v6alis,
2852 &v6invi,
2853 &v6nega,
2854 &v6cusi,
2855 &v6prot,
2856 &v6acct,
2857 &v6svce,
2858 &v6gena,
2859 &v6data,
2860 &v6agrp,
2861 &v6pdmn,
2862 &v6sync,
2863 &v6tomb,
2864 &v6sha1,
2865 &v7vwht,
2866 &v7tkid,
2867 &v6v_Data,
2868 &v6v_pk,
2869 &v6accc,
2870 &v7utomb,
2871 0
2872 },
2873 };
2874
2875 const SecDbClass v7inet_class = {
2876 .name = CFSTR("inet7"),
2877 .itemclass = true,
2878 .attrs = {
2879 &v6rowid,
2880 &v6cdat,
2881 &v6mdat,
2882 &v6desc,
2883 &v6icmt,
2884 &v6crtr,
2885 &v6type,
2886 &v6scrp,
2887 &v6labl,
2888 &v6alis,
2889 &v6invi,
2890 &v6nega,
2891 &v6cusi,
2892 &v6prot,
2893 &v6acct,
2894 &v6sdmn,
2895 &v6srvr,
2896 &v6ptcl,
2897 &v6atyp,
2898 &v6port,
2899 &v6path,
2900 &v6data,
2901 &v6agrp,
2902 &v6pdmn,
2903 &v6sync,
2904 &v6tomb,
2905 &v6sha1,
2906 &v7vwht,
2907 &v7tkid,
2908 &v6v_Data,
2909 &v6v_pk,
2910 &v6accc,
2911 &v7utomb,
2912 0
2913 },
2914 };
2915
2916 const SecDbClass v7cert_class = {
2917 .name = CFSTR("cert7"),
2918 .itemclass = true,
2919 .attrs = {
2920 &v6rowid,
2921 &v6cdat,
2922 &v6mdat,
2923 &v6ctyp,
2924 &v6cenc,
2925 &v6labl,
2926 &v6certalis,
2927 &v6subj,
2928 &v6issr,
2929 &v6slnr,
2930 &v6skid,
2931 &v6pkhh,
2932 &v6data,
2933 &v6agrp,
2934 &v6pdmn,
2935 &v6sync,
2936 &v6tomb,
2937 &v6sha1,
2938 &v7vwht,
2939 &v7tkid,
2940 &v6v_Data,
2941 &v6v_pk,
2942 &v6accc,
2943 &v7utomb,
2944 0
2945 },
2946 };
2947
2948 const SecDbClass v7keys_class = {
2949 .name = CFSTR("keys7"),
2950 .itemclass = true,
2951 .attrs = {
2952 &v6rowid,
2953 &v6cdat,
2954 &v6mdat,
2955 &v6kcls,
2956 &v6labl,
2957 &v6alis,
2958 &v6perm,
2959 &v6priv,
2960 &v6modi,
2961 &v6klbl,
2962 &v6atag,
2963 &v6keycrtr,
2964 &v6keytype,
2965 &v6bsiz,
2966 &v6esiz,
2967 &v6sdat,
2968 &v6edat,
2969 &v6sens,
2970 &v6asen,
2971 &v6extr,
2972 &v6next,
2973 &v6encr,
2974 &v6decr,
2975 &v6drve,
2976 &v6sign,
2977 &v6vrfy,
2978 &v6snrc,
2979 &v6vyrc,
2980 &v6wrap,
2981 &v6unwp,
2982 &v6data,
2983 &v6agrp,
2984 &v6pdmn,
2985 &v6sync,
2986 &v6tomb,
2987 &v6sha1,
2988 &v7vwht,
2989 &v7tkid,
2990 &v6v_Data,
2991 &v6v_pk,
2992 &v6accc,
2993 &v7utomb,
2994 0
2995 }
2996 };
2997
2998
2999 const SecDbSchema v7_schema = {
3000 .majorVersion = 7,
3001 .classes = {
3002 &v7genp_class,
3003 &v7inet_class,
3004 &v7cert_class,
3005 &v7keys_class,
3006 &v5tversion_class,
3007 0
3008 }
3009 };
3010
3011
3012 // Version 6 (iOS 7 and OSX 10.9) database schema
3013 static const SecDbClass v6genp_class = {
3014 .name = CFSTR("genp6"),
3015 .itemclass = true,
3016 .attrs = {
3017 &v6rowid,
3018 &v6cdat,
3019 &v6mdat,
3020 &v6desc,
3021 &v6icmt,
3022 &v6crtr,
3023 &v6type,
3024 &v6scrp,
3025 &v6labl,
3026 &v6alis,
3027 &v6invi,
3028 &v6nega,
3029 &v6cusi,
3030 &v6prot,
3031 &v6acct,
3032 &v6svce,
3033 &v6gena,
3034 &v6data,
3035 &v6agrp,
3036 &v6pdmn,
3037 &v6sync,
3038 &v6tomb,
3039 &v6sha1,
3040 &v6v_Data,
3041 &v6v_pk,
3042 &v6accc,
3043 0
3044 },
3045 };
3046
3047 static const SecDbClass v6inet_class = {
3048 .name = CFSTR("inet6"),
3049 .itemclass = true,
3050 .attrs = {
3051 &v6rowid,
3052 &v6cdat,
3053 &v6mdat,
3054 &v6desc,
3055 &v6icmt,
3056 &v6crtr,
3057 &v6type,
3058 &v6scrp,
3059 &v6labl,
3060 &v6alis,
3061 &v6invi,
3062 &v6nega,
3063 &v6cusi,
3064 &v6prot,
3065 &v6acct,
3066 &v6sdmn,
3067 &v6srvr,
3068 &v6ptcl,
3069 &v6atyp,
3070 &v6port,
3071 &v6path,
3072 &v6data,
3073 &v6agrp,
3074 &v6pdmn,
3075 &v6sync,
3076 &v6tomb,
3077 &v6sha1,
3078 &v6v_Data,
3079 &v6v_pk,
3080 &v6accc,
3081 0
3082 },
3083 };
3084
3085 static const SecDbClass v6cert_class = {
3086 .name = CFSTR("cert6"),
3087 .itemclass = true,
3088 .attrs = {
3089 &v6rowid,
3090 &v6cdat,
3091 &v6mdat,
3092 &v6ctyp,
3093 &v6cenc,
3094 &v6labl,
3095 &v6certalis,
3096 &v6subj,
3097 &v6issr,
3098 &v6slnr,
3099 &v6skid,
3100 &v6pkhh,
3101 &v6data,
3102 &v6agrp,
3103 &v6pdmn,
3104 &v6sync,
3105 &v6tomb,
3106 &v6sha1,
3107 &v6v_Data,
3108 &v6v_pk,
3109 &v6accc,
3110 0
3111 },
3112 };
3113
3114 static const SecDbClass v6keys_class = {
3115 .name = CFSTR("keys6"),
3116 .itemclass = true,
3117 .attrs = {
3118 &v6rowid,
3119 &v6cdat,
3120 &v6mdat,
3121 &v6kcls,
3122 &v6labl,
3123 &v6alis,
3124 &v6perm,
3125 &v6priv,
3126 &v6modi,
3127 &v6klbl,
3128 &v6atag,
3129 &v6keycrtr,
3130 &v6keytype,
3131 &v6bsiz,
3132 &v6esiz,
3133 &v6sdat,
3134 &v6edat,
3135 &v6sens,
3136 &v6asen,
3137 &v6extr,
3138 &v6next,
3139 &v6encr,
3140 &v6decr,
3141 &v6drve,
3142 &v6sign,
3143 &v6vrfy,
3144 &v6snrc,
3145 &v6vyrc,
3146 &v6wrap,
3147 &v6unwp,
3148 &v6data,
3149 &v6agrp,
3150 &v6pdmn,
3151 &v6sync,
3152 &v6tomb,
3153 &v6sha1,
3154 &v6v_Data,
3155 &v6v_pk,
3156 &v6accc,
3157 0
3158 }
3159 };
3160
3161 static const SecDbSchema v6_schema = {
3162 .majorVersion = 6,
3163 .classes = {
3164 &v6genp_class,
3165 &v6inet_class,
3166 &v6cert_class,
3167 &v6keys_class,
3168 &v5tversion_class,
3169 0
3170 }
3171 };
3172
3173
3174 // Version 5 (iOS 5 & iOS 6) database schema.
3175 static const SecDbClass v5genp_class = {
3176 .name = CFSTR("genp5"),
3177 .itemclass = true,
3178 .attrs = {
3179 &v6rowid,
3180 &v6cdat,
3181 &v6mdat,
3182 &v6desc,
3183 &v6icmt,
3184 &v6crtr,
3185 &v6type,
3186 &v6scrp,
3187 &v6labl,
3188 &v6alis,
3189 &v6invi,
3190 &v6nega,
3191 &v6cusi,
3192 &v6prot,
3193 &v6acct,
3194 &v6svce,
3195 &v6gena,
3196 &v6data,
3197 &v6agrp,
3198 &v6pdmn,
3199 &v6v_Data,
3200 0
3201 },
3202 };
3203
3204 static const SecDbClass v5inet_class = {
3205 .name = CFSTR("inet5"),
3206 .itemclass = true,
3207 .attrs = {
3208 &v6rowid,
3209 &v6cdat,
3210 &v6mdat,
3211 &v6desc,
3212 &v6icmt,
3213 &v6crtr,
3214 &v6type,
3215 &v6scrp,
3216 &v6labl,
3217 &v6alis,
3218 &v6invi,
3219 &v6nega,
3220 &v6cusi,
3221 &v6prot,
3222 &v6acct,
3223 &v6sdmn,
3224 &v6srvr,
3225 &v6ptcl,
3226 &v6atyp,
3227 &v6port,
3228 &v6path,
3229 &v6data,
3230 &v6agrp,
3231 &v6pdmn,
3232 &v6v_Data,
3233 0
3234 },
3235 };
3236
3237 static const SecDbClass v5cert_class = {
3238 .name = CFSTR("cert5"),
3239 .itemclass = true,
3240 .attrs = {
3241 &v6rowid,
3242 &v6cdat,
3243 &v6mdat,
3244 &v6ctyp,
3245 &v6cenc,
3246 &v6labl,
3247 &v6certalis,
3248 &v6subj,
3249 &v6issr,
3250 &v6slnr,
3251 &v6skid,
3252 &v6pkhh,
3253 &v6data,
3254 &v6agrp,
3255 &v6pdmn,
3256 &v6v_Data,
3257 0
3258 },
3259 };
3260
3261 static const SecDbClass v5keys_class = {
3262 .name = CFSTR("keys5"),
3263 .itemclass = true,
3264 .attrs = {
3265 &v6rowid,
3266 &v6cdat,
3267 &v6mdat,
3268 &v6kcls,
3269 &v6labl,
3270 &v6alis,
3271 &v6perm,
3272 &v6priv,
3273 &v6modi,
3274 &v6klbl,
3275 &v6atag,
3276 &v6keycrtr,
3277 &v6keytype,
3278 &v6bsiz,
3279 &v6esiz,
3280 &v6sdat,
3281 &v6edat,
3282 &v6sens,
3283 &v6asen,
3284 &v6extr,
3285 &v6next,
3286 &v6encr,
3287 &v6decr,
3288 &v6drve,
3289 &v6sign,
3290 &v6vrfy,
3291 &v6snrc,
3292 &v6vyrc,
3293 &v6wrap,
3294 &v6unwp,
3295 &v6data,
3296 &v6agrp,
3297 &v6pdmn,
3298 &v6v_Data,
3299 0
3300 }
3301 };
3302
3303 static const SecDbSchema v5_schema = {
3304 .majorVersion = 5,
3305 .classes = {
3306 &v5genp_class,
3307 &v5inet_class,
3308 &v5cert_class,
3309 &v5keys_class,
3310 &v5tversion_class,
3311 0
3312 }
3313 };
3314
3315 SecDbSchema const * const * kc_schemas = NULL;
3316
3317 const SecDbSchema *v10_kc_schemas_dev[] = {
3318 &v12_0_schema,
3319 &v11_9_schema,
3320 &v11_8_schema,
3321 &v11_7_schema,
3322 &v11_6_schema,
3323 &v11_5_schema,
3324 &v11_4_schema,
3325 &v11_3_schema,
3326 &v11_2_schema,
3327 &v11_1_schema,
3328 &v11_schema,
3329 &v10_5_schema,
3330 &v10_4_schema,
3331 &v10_3_schema,
3332 &v10_2_schema,
3333 &v10_1_schema,
3334 &v10_0_schema,
3335 &v9_1_schema,
3336 &v9_schema,
3337 &v8_schema,
3338 &v7_schema,
3339 &v6_schema,
3340 &v5_schema,
3341 0
3342 };
3343
3344 const SecDbSchema *v10_kc_schemas[] = {
3345 &v11_9_schema,
3346 &v11_8_schema,
3347 &v11_7_schema,
3348 &v11_6_schema,
3349 &v11_5_schema,
3350 &v11_4_schema,
3351 &v11_3_schema,
3352 &v11_2_schema,
3353 &v11_1_schema,
3354 &v11_schema,
3355 &v10_5_schema,
3356 &v10_4_schema,
3357 &v10_3_schema,
3358 &v10_2_schema,
3359 &v10_1_schema,
3360 &v10_0_schema,
3361 &v9_1_schema,
3362 &v9_schema,
3363 &v8_schema,
3364 &v7_schema,
3365 &v6_schema,
3366 &v5_schema,
3367 0
3368 };
3369
3370 const SecDbSchema * const * all_schemas() {
3371 static dispatch_once_t onceToken;
3372 dispatch_once(&onceToken, ^{
3373 if (checkV12DevEnabled()) {
3374 secwarning("SecItemSchema: v12 development enabled, returning experimental schema");
3375 } else {
3376 secnotice("SecItemSchema", "v12 development disabled, returning production schemas");
3377 }
3378 });
3379 if (checkV12DevEnabled() != 0) {
3380 return v10_kc_schemas_dev;
3381 } else {
3382 return v10_kc_schemas;
3383 }
3384 }
3385
3386 const SecDbSchema* current_schema() {
3387 // For now, the current schema is the first in the list.
3388 return all_schemas()[0];
3389 }
3390
3391 // class accessors for current schema.
3392 static const SecDbClass* find_class(const SecDbSchema* schema, CFStringRef class_name) {
3393 for (const SecDbClass * const *pclass = schema->classes; *pclass; ++pclass) {
3394 if( CFEqualSafe((*pclass)->name, class_name) ) {
3395 return *pclass;
3396 }
3397 }
3398 return NULL;
3399 }
3400
3401 const SecDbClass* genp_class() {
3402 static const SecDbClass* genp = NULL;
3403 static dispatch_once_t onceToken;
3404 dispatch_once(&onceToken, ^{
3405 genp = find_class(current_schema(), CFSTR("genp"));
3406 });
3407 return genp;
3408 }
3409 const SecDbClass* inet_class() {
3410 static const SecDbClass* inet = NULL;
3411 static dispatch_once_t onceToken;
3412 dispatch_once(&onceToken, ^{
3413 inet = find_class(current_schema(), CFSTR("inet"));
3414 });
3415 return inet;
3416 }
3417 const SecDbClass* cert_class() {
3418 static const SecDbClass* cert = NULL;
3419 static dispatch_once_t onceToken;
3420 dispatch_once(&onceToken, ^{
3421 cert = find_class(current_schema(), CFSTR("cert"));
3422 });
3423 return cert;
3424 }
3425 const SecDbClass* keys_class() {
3426 static const SecDbClass* keys = NULL;
3427 static dispatch_once_t onceToken;
3428 dispatch_once(&onceToken, ^{
3429 keys = find_class(current_schema(), CFSTR("keys"));
3430 });
3431 return keys;
3432 }
3433
3434 // Not really a class per-se
3435 const SecDbClass* identity_class() {
3436 return &v_identity_class;
3437 }
3438
3439 // Class with 1 element in it which is the database version->
3440 const SecDbClass* tversion_class() {
3441 static const SecDbClass* tversion = NULL;
3442 static dispatch_once_t onceToken;
3443 dispatch_once(&onceToken, ^{
3444 tversion = find_class(current_schema(), CFSTR("tversion"));
3445 });
3446 return tversion;
3447 }
3448
3449