Skip to content

Commit 4db43bf

Browse files
committed
rename enrolledFingerprints to enrolledBiometrics
1 parent 612ca5e commit 4db43bf

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

src/main/java/app/attestation/server/AttestationProtocol.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ private static void verify(final byte[] fingerprint,
10981098
"pinnedVerifiedBootKey = ?, verifiedBootHash = ?, " +
10991099
"pinnedOsVersion = ?, pinnedOsPatchLevel = ?, " +
11001100
"pinnedVendorPatchLevel = ?, pinnedBootPatchLevel = ?, " +
1101-
"pinnedAppVersion = ?, pinnedSecurityLevel = ?, userProfileSecure = ?, enrolledFingerprints = ?, " +
1101+
"pinnedAppVersion = ?, pinnedSecurityLevel = ?, userProfileSecure = ?, enrolledBiometrics = ?, " +
11021102
"accessibility = ?, deviceAdmin = ?, adbEnabled = ?, " +
11031103
"addUsersWhenLocked = ?, denyNewUsb = ?, oemUnlockAllowed = ?, " +
11041104
"systemUser = ?, verifiedTimeLast = ? " +
@@ -1138,7 +1138,7 @@ private static void verify(final byte[] fingerprint,
11381138
"(fingerprint, pinnedCertificate0, pinnedCertificate1, pinnedCertificate2, pinnedCertificate3, " +
11391139
"pinnedVerifiedBootKey, verifiedBootHash, pinnedOsVersion, pinnedOsPatchLevel, " +
11401140
"pinnedVendorPatchLevel, pinnedBootPatchLevel, pinnedAppVersion, pinnedSecurityLevel, " +
1141-
"userProfileSecure, enrolledFingerprints, accessibility, deviceAdmin, " +
1141+
"userProfileSecure, enrolledBiometrics, accessibility, deviceAdmin, " +
11421142
"adbEnabled, addUsersWhenLocked, denyNewUsb, oemUnlockAllowed, systemUser, " +
11431143
"verifiedTimeFirst, verifiedTimeLast, userId) " +
11441144
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

src/main/java/app/attestation/server/AttestationServer.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static void createDevicesTable(final SQLiteConnection conn) throws SQLit
153153
"pinnedAppVersion INTEGER NOT NULL,\n" +
154154
"pinnedSecurityLevel INTEGER NOT NULL,\n" +
155155
"userProfileSecure INTEGER NOT NULL CHECK (userProfileSecure in (0, 1)),\n" +
156-
"enrolledFingerprints INTEGER NOT NULL CHECK (enrolledFingerprints in (0, 1)),\n" +
156+
"enrolledBiometrics INTEGER NOT NULL CHECK (enrolledBiometrics in (0, 1)),\n" +
157157
"accessibility INTEGER NOT NULL CHECK (accessibility in (0, 1)),\n" +
158158
"deviceAdmin INTEGER NOT NULL CHECK (deviceAdmin in (0, 1, 2)),\n" +
159159
"adbEnabled INTEGER NOT NULL CHECK (adbEnabled in (0, 1)),\n" +
@@ -215,7 +215,7 @@ public static void main(final String[] args) throws Exception {
215215

216216
final SQLiteStatement selectCreated = attestationConn.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='Configuration'");
217217
if (!selectCreated.step()) {
218-
attestationConn.exec("PRAGMA user_version = 3");
218+
attestationConn.exec("PRAGMA user_version = 4");
219219
}
220220
selectCreated.dispose();
221221

@@ -322,6 +322,25 @@ public static void main(final String[] args) throws Exception {
322322
attestationConn.exec("PRAGMA foreign_keys = ON");
323323
}
324324

325+
// rename enrolledFingerprints to enrolledBiometrics
326+
if (userVersion == 3) {
327+
attestationConn.exec("PRAGMA foreign_keys = OFF");
328+
attestationConn.exec("BEGIN TRANSACTION");
329+
attestationConn.exec("ALTER TABLE Devices RENAME TO DevicesOld");
330+
createDevicesTable(attestationConn);
331+
attestationConn.exec("INSERT INTO Devices " +
332+
"(fingerprint, pinnedCertificate0, pinnedCertificate1, pinnedCertificate2, pinnedCertificate3, pinnedVerifiedBootKey, verifiedBootHash, pinnedOsVersion, pinnedOsPatchLevel, pinnedVendorPatchLevel, pinnedBootPatchLevel, pinnedAppVersion, pinnedSecurityLevel, userProfileSecure, enrolledBiometrics, accessibility, deviceAdmin, adbEnabled, addUsersWhenLocked, denyNewUsb, oemUnlockAllowed, systemUser, verifiedTimeFirst, verifiedTimeLast, expiredTimeLast, failureTimeLast, userId, deletionTime) " +
333+
"SELECT " +
334+
"fingerprint, pinnedCertificate0, pinnedCertificate1, pinnedCertificate2, pinnedCertificate3, pinnedVerifiedBootKey, verifiedBootHash, pinnedOsVersion, pinnedOsPatchLevel, pinnedVendorPatchLevel, pinnedBootPatchLevel, pinnedAppVersion, pinnedSecurityLevel, userProfileSecure, enrolledFingerprints, accessibility, deviceAdmin, adbEnabled, addUsersWhenLocked, denyNewUsb, oemUnlockAllowed, systemUser, verifiedTimeFirst, verifiedTimeLast, expiredTimeLast, failureTimeLast, userId, deletionTime " +
335+
"FROM DevicesOld");
336+
attestationConn.exec("DROP TABLE DevicesOld");
337+
createDevicesIndices(attestationConn);
338+
attestationConn.exec("PRAGMA user_version = 4");
339+
userVersion = 4;
340+
attestationConn.exec("END TRANSACTION");
341+
attestationConn.exec("PRAGMA foreign_keys = ON");
342+
}
343+
325344
logger.info("New schema version: " + userVersion);
326345

327346
logger.info("Analyze database");
@@ -1058,7 +1077,7 @@ private static void writeDevicesJson(final HttpExchange exchange, final long use
10581077
"(SELECT hex(verifiedBootHash) where verifiedBootHash IS NOT NULL), " +
10591078
"pinnedOsVersion, pinnedOsPatchLevel, pinnedVendorPatchLevel, " +
10601079
"pinnedBootPatchLevel, pinnedAppVersion, pinnedSecurityLevel, " +
1061-
"userProfileSecure, enrolledFingerprints, accessibility, deviceAdmin, " +
1080+
"userProfileSecure, enrolledBiometrics, accessibility, deviceAdmin, " +
10621081
"adbEnabled, addUsersWhenLocked, denyNewUsb, oemUnlockAllowed, " +
10631082
"systemUser, verifiedTimeFirst, verifiedTimeLast " +
10641083
"FROM Devices WHERE userId is ? AND deletionTime IS NULL " +

0 commit comments

Comments
 (0)