resolve merge conflicts of d254ce4
to master
Change-Id: Ia8dff82cb7648b568006d10bc99e2dd40a2d6e8e
This commit is contained in:
commit
030d7007ad
13 changed files with 240 additions and 130 deletions
|
@ -61,7 +61,7 @@ common_shared_libraries := \
|
||||||
libkeymaster_messages \
|
libkeymaster_messages \
|
||||||
|
|
||||||
common_static_libraries := \
|
common_static_libraries := \
|
||||||
libbootloader_message_writer \
|
libbootloader_message \
|
||||||
libfs_mgr \
|
libfs_mgr \
|
||||||
libfec \
|
libfec \
|
||||||
libfec_rs \
|
libfec_rs \
|
||||||
|
|
|
@ -220,7 +220,7 @@ close(t3450f22);
|
||||||
t3450f22 = TEMP_FAILURE_RETRY(open("file14", O_RDONLY|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC));
|
t3450f22 = TEMP_FAILURE_RETRY(open("file14", O_RDONLY|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC));
|
||||||
close(t3450f22);
|
close(t3450f22);
|
||||||
t3450f22 = TEMP_FAILURE_RETRY(open("file15", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3450f22 = TEMP_FAILURE_RETRY(open("file15", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3450f22, buf, 1));
|
TEMP_FAILURE_RETRY(write(t3450f22, buf, 1));
|
||||||
TEMP_FAILURE_RETRY(fsync(t3450f22));
|
TEMP_FAILURE_RETRY(fsync(t3450f22));
|
||||||
close(t3450f22);
|
close(t3450f22);
|
||||||
close(t3450f18);
|
close(t3450f18);
|
||||||
|
@ -405,7 +405,7 @@ close(t3455f19);
|
||||||
t3455f19 = TEMP_FAILURE_RETRY(open("file14", O_RDONLY|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC));
|
t3455f19 = TEMP_FAILURE_RETRY(open("file14", O_RDONLY|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC));
|
||||||
close(t3455f19);
|
close(t3455f19);
|
||||||
t3455f19 = TEMP_FAILURE_RETRY(open("file15", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3455f19 = TEMP_FAILURE_RETRY(open("file15", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3455f19, buf, 1));
|
TEMP_FAILURE_RETRY(write(t3455f19, buf, 1));
|
||||||
TEMP_FAILURE_RETRY(fsync(t3455f19));
|
TEMP_FAILURE_RETRY(fsync(t3455f19));
|
||||||
close(t3455f19);
|
close(t3455f19);
|
||||||
close(t3455f18);
|
close(t3455f18);
|
||||||
|
@ -1944,7 +1944,7 @@ TEMP_FAILURE_RETRY(fdatasync(t3499f55));
|
||||||
TEMP_FAILURE_RETRY(pwrite(t3499f55, buf, 28, 0));
|
TEMP_FAILURE_RETRY(pwrite(t3499f55, buf, 28, 0));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3499f55));
|
TEMP_FAILURE_RETRY(fdatasync(t3499f55));
|
||||||
close(t3499f55);
|
close(t3499f55);
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 20552));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 20552));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 35601253));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 35601253));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 36, 35601283));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 36, 35601283));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 3224, 35598336)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 3224, 35598336)); // mmap2
|
||||||
|
@ -1969,11 +1969,11 @@ TEMP_FAILURE_RETRY(pread(t3455f17, buf, 3721, 34443264)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 35513539));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 35513539));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 37, 35513569));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 37, 35513569));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 1673, 35512320)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 1673, 35512320)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 16008));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 16008));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 31153857));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 31153857));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 48, 31153887));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 48, 31153887));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 4461, 31150080)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 4461, 31150080)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 10864));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 10864));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 34907552));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 34907552));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 39, 34907582));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 39, 34907582));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 2551, 34906112)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 2551, 34906112)); // mmap2
|
||||||
|
@ -1986,7 +1986,7 @@ TEMP_FAILURE_RETRY(pread(t3455f17, buf, 1203, 34422784)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 30431338));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 30431338));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 42, 30431368));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 42, 30431368));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 4400, 30429184)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 4400, 30429184)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 14320));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 14320));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 34416128));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 34416128));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 43, 34416158));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 43, 34416158));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 1855, 34414592)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 1855, 34414592)); // mmap2
|
||||||
|
@ -1996,18 +1996,18 @@ TEMP_FAILURE_RETRY(pread(t3455f17, buf, 1244, 29892608)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 29892892));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 29892892));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 58, 29892922));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 58, 29892922));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 755, 29892608)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 755, 29892608)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 12208));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 12208));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 20736));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 20736));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 36353719));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 36353719));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 43, 36353749));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 43, 36353749));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 2179, 36352000)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 2179, 36352000)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 35512004));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 35512004));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 33, 35512034));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 33, 35512034));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 4299, 35508224)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 4299, 35508224)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 8936));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 8936));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 2800));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 2800));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 20216));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 20216));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f56, buf, 16912));
|
TEMP_FAILURE_RETRY(write(t3505f56, buf, 16912));
|
||||||
close(t3505f56);
|
close(t3505f56);
|
||||||
t3505f56 = TEMP_FAILURE_RETRY(open("file31", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
t3505f56 = TEMP_FAILURE_RETRY(open("file31", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3505f56, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3505f56, buf, 1, 0));
|
||||||
|
@ -2409,9 +2409,9 @@ int t3526f70 = TEMP_FAILURE_RETRY(open("file129", O_RDWR|O_CREAT|O_EXCL|O_LARGE
|
||||||
int t3519f75 = TEMP_FAILURE_RETRY(open("file128", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
int t3519f75 = TEMP_FAILURE_RETRY(open("file128", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
close(t3526f70);
|
close(t3526f70);
|
||||||
t3526f70 = TEMP_FAILURE_RETRY(open("file129", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3526f70 = TEMP_FAILURE_RETRY(open("file129", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3519f75, buf, 2991));
|
TEMP_FAILURE_RETRY(write(t3519f75, buf, 2991));
|
||||||
close(t3519f75);
|
close(t3519f75);
|
||||||
TEMP_FAILURE_RETRY(read(t3526f70, buf, 3974));
|
TEMP_FAILURE_RETRY(write(t3526f70, buf, 3974));
|
||||||
close(t3526f70);
|
close(t3526f70);
|
||||||
t3519f67 = TEMP_FAILURE_RETRY(open("file130", O_RDONLY|O_LARGEFILE));
|
t3519f67 = TEMP_FAILURE_RETRY(open("file130", O_RDONLY|O_LARGEFILE));
|
||||||
TEMP_FAILURE_RETRY(read(t3519f67, buf, 16384));
|
TEMP_FAILURE_RETRY(read(t3519f67, buf, 16384));
|
||||||
|
@ -2444,18 +2444,18 @@ close(t3499f72);
|
||||||
t3526f70 = TEMP_FAILURE_RETRY(open("file131", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
t3526f70 = TEMP_FAILURE_RETRY(open("file131", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f70);
|
close(t3526f70);
|
||||||
t3526f70 = TEMP_FAILURE_RETRY(open("file131", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3526f70 = TEMP_FAILURE_RETRY(open("file131", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f70, buf, 4622));
|
TEMP_FAILURE_RETRY(write(t3526f70, buf, 4622));
|
||||||
close(t3526f70);
|
close(t3526f70);
|
||||||
int t3526f72 = TEMP_FAILURE_RETRY(open("file132", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3526f72 = TEMP_FAILURE_RETRY(open("file132", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f72);
|
close(t3526f72);
|
||||||
t3526f72 = TEMP_FAILURE_RETRY(open("file132", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3526f72 = TEMP_FAILURE_RETRY(open("file132", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f72, buf, 16384));
|
TEMP_FAILURE_RETRY(write(t3526f72, buf, 16384));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f72, buf, 6849));
|
TEMP_FAILURE_RETRY(write(t3526f72, buf, 6849));
|
||||||
close(t3526f72);
|
close(t3526f72);
|
||||||
t3526f70 = TEMP_FAILURE_RETRY(open("file133", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
t3526f70 = TEMP_FAILURE_RETRY(open("file133", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f70);
|
close(t3526f70);
|
||||||
int t3526f75 = TEMP_FAILURE_RETRY(open("file133", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
int t3526f75 = TEMP_FAILURE_RETRY(open("file133", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f75, buf, 13332));
|
TEMP_FAILURE_RETRY(write(t3526f75, buf, 13332));
|
||||||
close(t3526f75);
|
close(t3526f75);
|
||||||
int t3495f70 = TEMP_FAILURE_RETRY(open("file31", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
int t3495f70 = TEMP_FAILURE_RETRY(open("file31", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3495f70, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3495f70, buf, 1, 0));
|
||||||
|
@ -2484,7 +2484,7 @@ close(t3495f70);
|
||||||
int t3526f93 = TEMP_FAILURE_RETRY(open("file134", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3526f93 = TEMP_FAILURE_RETRY(open("file134", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f93);
|
close(t3526f93);
|
||||||
int t3526f88 = TEMP_FAILURE_RETRY(open("file134", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
int t3526f88 = TEMP_FAILURE_RETRY(open("file134", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f88, buf, 15056));
|
TEMP_FAILURE_RETRY(write(t3526f88, buf, 15056));
|
||||||
close(t3526f88);
|
close(t3526f88);
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 34433108));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 34433108));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 56, 34433138));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 56, 34433138));
|
||||||
|
@ -2546,13 +2546,13 @@ close(t3499f74);
|
||||||
int t3526f64 = TEMP_FAILURE_RETRY(open("file135", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3526f64 = TEMP_FAILURE_RETRY(open("file135", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f64);
|
close(t3526f64);
|
||||||
t3526f64 = TEMP_FAILURE_RETRY(open("file135", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3526f64 = TEMP_FAILURE_RETRY(open("file135", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f64, buf, 16384));
|
TEMP_FAILURE_RETRY(write(t3526f64, buf, 16384));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f64, buf, 4873));
|
TEMP_FAILURE_RETRY(write(t3526f64, buf, 4873));
|
||||||
close(t3526f64);
|
close(t3526f64);
|
||||||
int t3526f90 = TEMP_FAILURE_RETRY(open("file136", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3526f90 = TEMP_FAILURE_RETRY(open("file136", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f90);
|
close(t3526f90);
|
||||||
t3526f90 = TEMP_FAILURE_RETRY(open("file136", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3526f90 = TEMP_FAILURE_RETRY(open("file136", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f90, buf, 4199));
|
TEMP_FAILURE_RETRY(write(t3526f90, buf, 4199));
|
||||||
close(t3526f90);
|
close(t3526f90);
|
||||||
int t3499f90 = TEMP_FAILURE_RETRY(open("file18", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
int t3499f90 = TEMP_FAILURE_RETRY(open("file18", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3499f90, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3499f90, buf, 1, 0));
|
||||||
|
@ -2759,8 +2759,8 @@ TEMP_FAILURE_RETRY(read(t3526f70, buf, 16384));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f70, buf, 16384));
|
TEMP_FAILURE_RETRY(read(t3526f70, buf, 16384));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f70, buf, 16384));
|
TEMP_FAILURE_RETRY(read(t3526f70, buf, 16384));
|
||||||
close(t3526f70);
|
close(t3526f70);
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 10432));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 10432));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 4464));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 4464));
|
||||||
t3495f70 = TEMP_FAILURE_RETRY(open("file31", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
t3495f70 = TEMP_FAILURE_RETRY(open("file31", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3495f70, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3495f70, buf, 1, 0));
|
||||||
close(t3495f70);
|
close(t3495f70);
|
||||||
|
@ -2785,26 +2785,26 @@ TEMP_FAILURE_RETRY(fdatasync(t3495f70));
|
||||||
TEMP_FAILURE_RETRY(pwrite(t3495f70, buf, 28, 0));
|
TEMP_FAILURE_RETRY(pwrite(t3495f70, buf, 28, 0));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3495f70));
|
TEMP_FAILURE_RETRY(fdatasync(t3495f70));
|
||||||
close(t3495f70);
|
close(t3495f70);
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 10592));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 10592));
|
||||||
int t3533f70 = TEMP_FAILURE_RETRY(open("file140", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3533f70 = TEMP_FAILURE_RETRY(open("file140", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3533f70);
|
close(t3533f70);
|
||||||
t3533f70 = TEMP_FAILURE_RETRY(open("file140", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3533f70 = TEMP_FAILURE_RETRY(open("file140", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3533f70, buf, 4042));
|
TEMP_FAILURE_RETRY(write(t3533f70, buf, 4042));
|
||||||
close(t3533f70);
|
close(t3533f70);
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 9664));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 9664));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 23656));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 23656));
|
||||||
t3533f70 = TEMP_FAILURE_RETRY(open("file141", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
t3533f70 = TEMP_FAILURE_RETRY(open("file141", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3533f70);
|
close(t3533f70);
|
||||||
t3526f70 = TEMP_FAILURE_RETRY(open("file142", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
t3526f70 = TEMP_FAILURE_RETRY(open("file142", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
int t3533f72 = TEMP_FAILURE_RETRY(open("file141", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
int t3533f72 = TEMP_FAILURE_RETRY(open("file141", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
close(t3526f70);
|
close(t3526f70);
|
||||||
t3526f70 = TEMP_FAILURE_RETRY(open("file142", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3526f70 = TEMP_FAILURE_RETRY(open("file142", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f70, buf, 5057));
|
TEMP_FAILURE_RETRY(write(t3526f70, buf, 5057));
|
||||||
TEMP_FAILURE_RETRY(read(t3533f72, buf, 4595));
|
TEMP_FAILURE_RETRY(write(t3533f72, buf, 4595));
|
||||||
close(t3526f70);
|
close(t3526f70);
|
||||||
close(t3533f72);
|
close(t3533f72);
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 19744));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 19744));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 9344));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 9344));
|
||||||
t3499f70 = TEMP_FAILURE_RETRY(open("file18", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
t3499f70 = TEMP_FAILURE_RETRY(open("file18", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3499f70, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3499f70, buf, 1, 0));
|
||||||
close(t3499f70);
|
close(t3499f70);
|
||||||
|
@ -2821,7 +2821,7 @@ TEMP_FAILURE_RETRY(pwrite(t3499f70, buf, 4096, 8724));
|
||||||
TEMP_FAILURE_RETRY(pwrite(t3499f70, buf, 4, 12820));
|
TEMP_FAILURE_RETRY(pwrite(t3499f70, buf, 4, 12820));
|
||||||
TEMP_FAILURE_RETRY(pread(t3499f70, buf, 8, 13312));
|
TEMP_FAILURE_RETRY(pread(t3499f70, buf, 8, 13312));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3499f70));
|
TEMP_FAILURE_RETRY(fdatasync(t3499f70));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 24672));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 24672));
|
||||||
t3499f72 = TEMP_FAILURE_RETRY(open("file22", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
t3499f72 = TEMP_FAILURE_RETRY(open("file22", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3499f72));
|
TEMP_FAILURE_RETRY(fdatasync(t3499f72));
|
||||||
close(t3499f72);
|
close(t3499f72);
|
||||||
|
@ -2830,8 +2830,8 @@ TEMP_FAILURE_RETRY(fdatasync(t3499f70));
|
||||||
TEMP_FAILURE_RETRY(pwrite(t3499f70, buf, 28, 0));
|
TEMP_FAILURE_RETRY(pwrite(t3499f70, buf, 28, 0));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3499f70));
|
TEMP_FAILURE_RETRY(fdatasync(t3499f70));
|
||||||
close(t3499f70);
|
close(t3499f70);
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 7584));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 7584));
|
||||||
TEMP_FAILURE_RETRY(read(t3505f66, buf, 10736));
|
TEMP_FAILURE_RETRY(write(t3505f66, buf, 10736));
|
||||||
close(t3505f66);
|
close(t3505f66);
|
||||||
t3505f66 = TEMP_FAILURE_RETRY(open("file31", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
t3505f66 = TEMP_FAILURE_RETRY(open("file31", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3505f66, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3505f66, buf, 1, 0));
|
||||||
|
@ -2928,9 +2928,9 @@ close(t3533f91);
|
||||||
t3533f91 = TEMP_FAILURE_RETRY(open("file143", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3533f91 = TEMP_FAILURE_RETRY(open("file143", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 31210525));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 30, 31210525));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 44, 31210555));
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 44, 31210555));
|
||||||
TEMP_FAILURE_RETRY(read(t3533f91, buf, 16384));
|
TEMP_FAILURE_RETRY(write(t3533f91, buf, 16384));
|
||||||
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 3673, 31207424)); // mmap2
|
TEMP_FAILURE_RETRY(pread(t3455f17, buf, 3673, 31207424)); // mmap2
|
||||||
TEMP_FAILURE_RETRY(read(t3533f91, buf, 2024));
|
TEMP_FAILURE_RETRY(write(t3533f91, buf, 2024));
|
||||||
close(t3533f91);
|
close(t3533f91);
|
||||||
int t3499f91 = TEMP_FAILURE_RETRY(open("file18", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
int t3499f91 = TEMP_FAILURE_RETRY(open("file18", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3499f91, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3499f91, buf, 1, 0));
|
||||||
|
@ -2983,40 +2983,40 @@ close(t3505f84);
|
||||||
int t3533f102 = TEMP_FAILURE_RETRY(open("file144", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3533f102 = TEMP_FAILURE_RETRY(open("file144", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3533f102);
|
close(t3533f102);
|
||||||
t3533f72 = TEMP_FAILURE_RETRY(open("file144", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3533f72 = TEMP_FAILURE_RETRY(open("file144", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3533f72, buf, 5550));
|
TEMP_FAILURE_RETRY(write(t3533f72, buf, 5550));
|
||||||
close(t3533f72);
|
close(t3533f72);
|
||||||
int t3526f84 = TEMP_FAILURE_RETRY(open("file145", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3526f84 = TEMP_FAILURE_RETRY(open("file145", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f84);
|
close(t3526f84);
|
||||||
int t3526f101 = TEMP_FAILURE_RETRY(open("file145", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
int t3526f101 = TEMP_FAILURE_RETRY(open("file145", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f101, buf, 3612));
|
TEMP_FAILURE_RETRY(write(t3526f101, buf, 3612));
|
||||||
close(t3526f101);
|
close(t3526f101);
|
||||||
t3526f90 = TEMP_FAILURE_RETRY(open("file146", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
t3526f90 = TEMP_FAILURE_RETRY(open("file146", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f90);
|
close(t3526f90);
|
||||||
t3526f90 = TEMP_FAILURE_RETRY(open("file146", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3526f90 = TEMP_FAILURE_RETRY(open("file146", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f90, buf, 5414));
|
TEMP_FAILURE_RETRY(write(t3526f90, buf, 5414));
|
||||||
int t3533f96 = TEMP_FAILURE_RETRY(open("file147", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3533f96 = TEMP_FAILURE_RETRY(open("file147", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3533f96);
|
close(t3533f96);
|
||||||
t3533f96 = TEMP_FAILURE_RETRY(open("file147", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3533f96 = TEMP_FAILURE_RETRY(open("file147", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
close(t3526f90);
|
close(t3526f90);
|
||||||
TEMP_FAILURE_RETRY(read(t3533f96, buf, 3834));
|
TEMP_FAILURE_RETRY(write(t3533f96, buf, 3834));
|
||||||
close(t3533f96);
|
close(t3533f96);
|
||||||
int t3519f90 = TEMP_FAILURE_RETRY(open("file148", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3519f90 = TEMP_FAILURE_RETRY(open("file148", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3519f90);
|
close(t3519f90);
|
||||||
t3519f90 = TEMP_FAILURE_RETRY(open("file148", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3519f90 = TEMP_FAILURE_RETRY(open("file148", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3519f90, buf, 3461));
|
TEMP_FAILURE_RETRY(write(t3519f90, buf, 3461));
|
||||||
int t3526f96 = TEMP_FAILURE_RETRY(open("file149", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3526f96 = TEMP_FAILURE_RETRY(open("file149", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3526f96);
|
close(t3526f96);
|
||||||
close(t3519f90);
|
close(t3519f90);
|
||||||
t3526f90 = TEMP_FAILURE_RETRY(open("file149", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3526f90 = TEMP_FAILURE_RETRY(open("file149", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f90, buf, 16384));
|
TEMP_FAILURE_RETRY(write(t3526f90, buf, 16384));
|
||||||
TEMP_FAILURE_RETRY(read(t3526f90, buf, 12766));
|
TEMP_FAILURE_RETRY(write(t3526f90, buf, 12766));
|
||||||
close(t3526f90);
|
close(t3526f90);
|
||||||
int t3533f90 = TEMP_FAILURE_RETRY(open("file150", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
int t3533f90 = TEMP_FAILURE_RETRY(open("file150", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600));
|
||||||
close(t3533f90);
|
close(t3533f90);
|
||||||
t3533f90 = TEMP_FAILURE_RETRY(open("file150", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3533f90 = TEMP_FAILURE_RETRY(open("file150", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
int t3505f96 = TEMP_FAILURE_RETRY(open("file151", O_RDWR|O_CREAT|O_LARGEFILE|O_CLOEXEC, 0600));
|
int t3505f96 = TEMP_FAILURE_RETRY(open("file151", O_RDWR|O_CREAT|O_LARGEFILE|O_CLOEXEC, 0600));
|
||||||
TEMP_FAILURE_RETRY(pread(t3505f96, buf, 100, 0));
|
TEMP_FAILURE_RETRY(pread(t3505f96, buf, 100, 0));
|
||||||
TEMP_FAILURE_RETRY(read(t3533f90, buf, 10056));
|
TEMP_FAILURE_RETRY(write(t3533f90, buf, 10056));
|
||||||
close(t3533f90);
|
close(t3533f90);
|
||||||
t3505f90 = TEMP_FAILURE_RETRY(open("file152", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
t3505f90 = TEMP_FAILURE_RETRY(open("file152", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3505f90, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3505f90, buf, 1, 0));
|
||||||
|
@ -3042,7 +3042,7 @@ TEMP_FAILURE_RETRY(pread(t3505f90, buf, 1, 0));
|
||||||
close(t3505f90);
|
close(t3505f90);
|
||||||
t3533f90 = TEMP_FAILURE_RETRY(open("file153", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
t3533f90 = TEMP_FAILURE_RETRY(open("file153", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600));
|
||||||
TEMP_FAILURE_RETRY(pread(t3505f96, buf, 16, 24));
|
TEMP_FAILURE_RETRY(pread(t3505f96, buf, 16, 24));
|
||||||
TEMP_FAILURE_RETRY(read(t3533f90, buf, 13271));
|
TEMP_FAILURE_RETRY(write(t3533f90, buf, 13271));
|
||||||
close(t3533f90);
|
close(t3533f90);
|
||||||
TEMP_FAILURE_RETRY(pread(t3505f96, buf, 4096, 16384));
|
TEMP_FAILURE_RETRY(pread(t3505f96, buf, 4096, 16384));
|
||||||
TEMP_FAILURE_RETRY(pread(t3505f96, buf, 4096, 12288));
|
TEMP_FAILURE_RETRY(pread(t3505f96, buf, 4096, 12288));
|
||||||
|
@ -3461,7 +3461,7 @@ TEMP_FAILURE_RETRY(pwrite(t3545f97, buf, 28, 0));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3545f97));
|
TEMP_FAILURE_RETRY(fdatasync(t3545f97));
|
||||||
close(t3545f97);
|
close(t3545f97);
|
||||||
int t3575f29 = TEMP_FAILURE_RETRY(open("file16", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0));
|
int t3575f29 = TEMP_FAILURE_RETRY(open("file16", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0));
|
||||||
TEMP_FAILURE_RETRY(read(t3575f29, buf, 17344));
|
TEMP_FAILURE_RETRY(write(t3575f29, buf, 17344));
|
||||||
close(t3575f29);
|
close(t3575f29);
|
||||||
t3545f97 = TEMP_FAILURE_RETRY(open("file155", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
t3545f97 = TEMP_FAILURE_RETRY(open("file155", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(pread(t3545f97, buf, 1, 0));
|
TEMP_FAILURE_RETRY(pread(t3545f97, buf, 1, 0));
|
||||||
|
@ -3801,11 +3801,11 @@ TEMP_FAILURE_RETRY(pread(t3499f103, buf, 8, 13312));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3499f103));
|
TEMP_FAILURE_RETRY(fdatasync(t3499f103));
|
||||||
t3499f105 = TEMP_FAILURE_RETRY(open("file22", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
t3499f105 = TEMP_FAILURE_RETRY(open("file22", O_RDONLY|O_LARGEFILE|O_CLOEXEC));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3499f105));
|
TEMP_FAILURE_RETRY(fdatasync(t3499f105));
|
||||||
TEMP_FAILURE_RETRY(read(t3496f28, buf, 8188));
|
TEMP_FAILURE_RETRY(write(t3496f28, buf, 8188));
|
||||||
close(t3499f105);
|
close(t3499f105);
|
||||||
TEMP_FAILURE_RETRY(pwrite(t3499f103, buf, 12, 0));
|
TEMP_FAILURE_RETRY(pwrite(t3499f103, buf, 12, 0));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3499f103));
|
TEMP_FAILURE_RETRY(fdatasync(t3499f103));
|
||||||
TEMP_FAILURE_RETRY(read(t3496f28, buf, 3166));
|
TEMP_FAILURE_RETRY(write(t3496f28, buf, 3166));
|
||||||
TEMP_FAILURE_RETRY(pwrite(t3499f103, buf, 28, 0));
|
TEMP_FAILURE_RETRY(pwrite(t3499f103, buf, 28, 0));
|
||||||
TEMP_FAILURE_RETRY(fdatasync(t3499f103));
|
TEMP_FAILURE_RETRY(fdatasync(t3499f103));
|
||||||
close(t3499f103);
|
close(t3499f103);
|
||||||
|
|
|
@ -385,11 +385,14 @@ int CryptCommandListener::CryptfsCmd::runCommand(SocketClient *cli,
|
||||||
if (!check_argc(cli, subcommand, argc, 3, "<user>")) return 0;
|
if (!check_argc(cli, subcommand, argc, 3, "<user>")) return 0;
|
||||||
return sendGenericOkFailOnBool(cli, e4crypt_destroy_user_key(atoi(argv[2])));
|
return sendGenericOkFailOnBool(cli, e4crypt_destroy_user_key(atoi(argv[2])));
|
||||||
|
|
||||||
} else if (subcommand == "change_user_key") {
|
} else if (subcommand == "add_user_key_auth") {
|
||||||
if (!check_argc(cli, subcommand, argc, 7,
|
if (!check_argc(cli, subcommand, argc, 6, "<user> <serial> <token> <secret>")) return 0;
|
||||||
"<user> <serial> <token> <old_secret> <new_secret>")) return 0;
|
return sendGenericOkFailOnBool(cli, e4crypt_add_user_key_auth(
|
||||||
return sendGenericOkFailOnBool(cli, e4crypt_change_user_key(
|
atoi(argv[2]), atoi(argv[3]), argv[4], argv[5]));
|
||||||
atoi(argv[2]), atoi(argv[3]), argv[4], argv[5], argv[6]));
|
|
||||||
|
} else if (subcommand == "fixate_newest_user_key_auth") {
|
||||||
|
if (!check_argc(cli, subcommand, argc, 3, "<user>")) return 0;
|
||||||
|
return sendGenericOkFailOnBool(cli, e4crypt_fixate_newest_user_key_auth(atoi(argv[2])));
|
||||||
|
|
||||||
} else if (subcommand == "unlock_user_key") {
|
} else if (subcommand == "unlock_user_key") {
|
||||||
if (!check_argc(cli, subcommand, argc, 6, "<user> <serial> <token> <secret>")) return 0;
|
if (!check_argc(cli, subcommand, argc, 6, "<user> <serial> <token> <secret>")) return 0;
|
||||||
|
|
185
Ext4Crypt.cpp
185
Ext4Crypt.cpp
|
@ -19,16 +19,17 @@
|
||||||
#include "KeyStorage.h"
|
#include "KeyStorage.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <cutils/properties.h>
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <selinux/android.h>
|
#include <selinux/android.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -59,7 +60,7 @@ static constexpr int FLAG_STORAGE_DE = 1 << 0;
|
||||||
static constexpr int FLAG_STORAGE_CE = 1 << 1;
|
static constexpr int FLAG_STORAGE_CE = 1 << 1;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const std::string device_key_dir = std::string() + DATA_MNT_POINT + "/unencrypted";
|
const std::string device_key_dir = std::string() + DATA_MNT_POINT + e4crypt_unencrypted_folder;
|
||||||
const std::string device_key_path = device_key_dir + "/key";
|
const std::string device_key_path = device_key_dir + "/key";
|
||||||
const std::string device_key_temp = device_key_dir + "/temp";
|
const std::string device_key_temp = device_key_dir + "/temp";
|
||||||
|
|
||||||
|
@ -93,13 +94,6 @@ struct ext4_encryption_key {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO replace with proper function to test for file encryption
|
|
||||||
bool e4crypt_is_native() {
|
|
||||||
char value[PROPERTY_VALUE_MAX];
|
|
||||||
property_get("ro.crypto.type", value, "none");
|
|
||||||
return !strcmp(value, "file");
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool e4crypt_is_emulated() {
|
static bool e4crypt_is_emulated() {
|
||||||
return property_get_bool("persist.sys.emulate_fbe", false);
|
return property_get_bool("persist.sys.emulate_fbe", false);
|
||||||
}
|
}
|
||||||
|
@ -176,6 +170,7 @@ static bool install_key(const std::string& key, std::string* raw_ref) {
|
||||||
}
|
}
|
||||||
LOG(DEBUG) << "Added key " << key_id << " (" << ref << ") to keyring " << device_keyring
|
LOG(DEBUG) << "Added key " << key_id << " (" << ref << ") to keyring " << device_keyring
|
||||||
<< " in process " << getpid();
|
<< " in process " << getpid();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,16 +178,100 @@ static std::string get_de_key_path(userid_t user_id) {
|
||||||
return StringPrintf("%s/de/%d", user_key_dir.c_str(), user_id);
|
return StringPrintf("%s/de/%d", user_key_dir.c_str(), user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string get_ce_key_path(userid_t user_id) {
|
static std::string get_ce_key_directory_path(userid_t user_id) {
|
||||||
return StringPrintf("%s/ce/%d/current", user_key_dir.c_str(), user_id);
|
return StringPrintf("%s/ce/%d", user_key_dir.c_str(), user_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the keys newest first
|
||||||
|
static std::vector<std::string> get_ce_key_paths(const std::string& directory_path) {
|
||||||
|
auto dirp = std::unique_ptr<DIR, int (*)(DIR*)>(opendir(directory_path.c_str()), closedir);
|
||||||
|
if (!dirp) {
|
||||||
|
PLOG(ERROR) << "Unable to open ce key directory: " + directory_path;
|
||||||
|
return std::vector<std::string>();
|
||||||
|
}
|
||||||
|
std::vector<std::string> result;
|
||||||
|
for (;;) {
|
||||||
|
errno = 0;
|
||||||
|
auto const entry = readdir(dirp.get());
|
||||||
|
if (!entry) {
|
||||||
|
if (errno) {
|
||||||
|
PLOG(ERROR) << "Unable to read ce key directory: " + directory_path;
|
||||||
|
return std::vector<std::string>();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (entry->d_type != DT_DIR || entry->d_name[0] != 'c') {
|
||||||
|
LOG(DEBUG) << "Skipping non-key " << entry->d_name;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result.emplace_back(directory_path + "/" + entry->d_name);
|
||||||
|
}
|
||||||
|
std::sort(result.begin(), result.end());
|
||||||
|
std::reverse(result.begin(), result.end());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string get_ce_key_current_path(const std::string& directory_path) {
|
||||||
|
return directory_path + "/current";
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool get_ce_key_new_path(const std::string& directory_path,
|
||||||
|
const std::vector<std::string>& paths,
|
||||||
|
std::string *ce_key_path) {
|
||||||
|
if (paths.empty()) {
|
||||||
|
*ce_key_path = get_ce_key_current_path(directory_path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (unsigned int i = 0; i < UINT_MAX; i++) {
|
||||||
|
auto const candidate = StringPrintf("%s/cx%010u", directory_path.c_str(), i);
|
||||||
|
if (paths[0] < candidate) {
|
||||||
|
*ce_key_path = candidate;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discard all keys but the named one; rename it to canonical name.
|
||||||
|
// No point in acting on errors in this; ignore them.
|
||||||
|
static void fixate_user_ce_key(const std::string& directory_path, const std::string &to_fix,
|
||||||
|
const std::vector<std::string>& paths) {
|
||||||
|
for (auto const other_path: paths) {
|
||||||
|
if (other_path != to_fix) {
|
||||||
|
android::vold::destroyKey(other_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto const current_path = get_ce_key_current_path(directory_path);
|
||||||
|
if (to_fix != current_path) {
|
||||||
|
LOG(DEBUG) << "Renaming " << to_fix << " to " << current_path;
|
||||||
|
if (rename(to_fix.c_str(), current_path.c_str()) != 0) {
|
||||||
|
PLOG(WARNING) << "Unable to rename " << to_fix << " to " << current_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool read_and_fixate_user_ce_key(userid_t user_id,
|
||||||
|
const android::vold::KeyAuthentication& auth,
|
||||||
|
std::string *ce_key) {
|
||||||
|
auto const directory_path = get_ce_key_directory_path(user_id);
|
||||||
|
auto const paths = get_ce_key_paths(directory_path);
|
||||||
|
for (auto const ce_key_path: paths) {
|
||||||
|
LOG(DEBUG) << "Trying user CE key " << ce_key_path;
|
||||||
|
if (android::vold::retrieveKey(ce_key_path, auth, ce_key)) {
|
||||||
|
LOG(DEBUG) << "Successfully retrieved key";
|
||||||
|
fixate_user_ce_key(directory_path, ce_key_path, paths);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG(ERROR) << "Failed to find working ce key for user " << user_id;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool read_and_install_user_ce_key(userid_t user_id,
|
static bool read_and_install_user_ce_key(userid_t user_id,
|
||||||
const android::vold::KeyAuthentication& auth) {
|
const android::vold::KeyAuthentication& auth) {
|
||||||
if (s_ce_key_raw_refs.count(user_id) != 0) return true;
|
if (s_ce_key_raw_refs.count(user_id) != 0) return true;
|
||||||
const auto ce_key_path = get_ce_key_path(user_id);
|
|
||||||
std::string ce_key;
|
std::string ce_key;
|
||||||
if (!android::vold::retrieveKey(ce_key_path, auth, &ce_key)) return false;
|
if (!read_and_fixate_user_ce_key(user_id, auth, &ce_key)) return false;
|
||||||
std::string ce_raw_ref;
|
std::string ce_raw_ref;
|
||||||
if (!install_key(ce_key, &ce_raw_ref)) return false;
|
if (!install_key(ce_key, &ce_raw_ref)) return false;
|
||||||
s_ce_keys[user_id] = ce_key;
|
s_ce_keys[user_id] = ce_key;
|
||||||
|
@ -260,12 +339,17 @@ static bool create_and_install_user_keys(userid_t user_id, bool create_ephemeral
|
||||||
// If the key should be created as ephemeral, don't store it.
|
// If the key should be created as ephemeral, don't store it.
|
||||||
s_ephemeral_users.insert(user_id);
|
s_ephemeral_users.insert(user_id);
|
||||||
} else {
|
} else {
|
||||||
|
auto const directory_path = get_ce_key_directory_path(user_id);
|
||||||
|
if (!prepare_dir(directory_path, 0700, AID_ROOT, AID_ROOT)) return false;
|
||||||
|
auto const paths = get_ce_key_paths(directory_path);
|
||||||
|
std::string ce_key_path;
|
||||||
|
if (!get_ce_key_new_path(directory_path, paths, &ce_key_path)) return false;
|
||||||
|
if (!store_key(ce_key_path, user_key_temp,
|
||||||
|
kEmptyAuthentication, ce_key)) return false;
|
||||||
|
fixate_user_ce_key(directory_path, ce_key_path, paths);
|
||||||
|
// Write DE key second; once this is written, all is good.
|
||||||
if (!store_key(get_de_key_path(user_id), user_key_temp,
|
if (!store_key(get_de_key_path(user_id), user_key_temp,
|
||||||
kEmptyAuthentication, de_key)) return false;
|
kEmptyAuthentication, de_key)) return false;
|
||||||
if (!prepare_dir(user_key_dir + "/ce/" + std::to_string(user_id),
|
|
||||||
0700, AID_ROOT, AID_ROOT)) return false;
|
|
||||||
if (!store_key(get_ce_key_path(user_id), user_key_temp,
|
|
||||||
kEmptyAuthentication, ce_key)) return false;
|
|
||||||
}
|
}
|
||||||
std::string de_raw_ref;
|
std::string de_raw_ref;
|
||||||
if (!install_key(de_key, &de_raw_ref)) return false;
|
if (!install_key(de_key, &de_raw_ref)) return false;
|
||||||
|
@ -290,7 +374,9 @@ static bool lookup_key_ref(const std::map<userid_t, std::string>& key_map, useri
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ensure_policy(const std::string& raw_ref, const std::string& path) {
|
static bool ensure_policy(const std::string& raw_ref, const std::string& path) {
|
||||||
if (e4crypt_policy_ensure(path.c_str(), raw_ref.data(), raw_ref.size()) != 0) {
|
if (e4crypt_policy_ensure(path.c_str(),
|
||||||
|
raw_ref.data(), raw_ref.size(),
|
||||||
|
cryptfs_get_file_encryption_mode()) != 0) {
|
||||||
LOG(ERROR) << "Failed to set policy on: " << path;
|
LOG(ERROR) << "Failed to set policy on: " << path;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -349,6 +435,13 @@ bool e4crypt_initialize_global_de() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string mode_filename = std::string("/data") + e4crypt_key_mode;
|
||||||
|
std::string mode = cryptfs_get_file_encryption_mode();
|
||||||
|
if (!android::base::WriteStringToFile(mode, mode_filename)) {
|
||||||
|
PLOG(ERROR) << "Cannot save type";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::string device_key;
|
std::string device_key;
|
||||||
if (path_exists(device_key_path)) {
|
if (path_exists(device_key_path)) {
|
||||||
if (!android::vold::retrieveKey(device_key_path,
|
if (!android::vold::retrieveKey(device_key_path,
|
||||||
|
@ -382,15 +475,7 @@ bool e4crypt_init_user0() {
|
||||||
if (!prepare_dir(user_key_dir, 0700, AID_ROOT, AID_ROOT)) return false;
|
if (!prepare_dir(user_key_dir, 0700, AID_ROOT, AID_ROOT)) return false;
|
||||||
if (!prepare_dir(user_key_dir + "/ce", 0700, AID_ROOT, AID_ROOT)) return false;
|
if (!prepare_dir(user_key_dir + "/ce", 0700, AID_ROOT, AID_ROOT)) return false;
|
||||||
if (!prepare_dir(user_key_dir + "/de", 0700, AID_ROOT, AID_ROOT)) return false;
|
if (!prepare_dir(user_key_dir + "/de", 0700, AID_ROOT, AID_ROOT)) return false;
|
||||||
auto de_path = get_de_key_path(0);
|
if (!path_exists(get_de_key_path(0))) {
|
||||||
auto ce_path = get_ce_key_path(0);
|
|
||||||
if (!path_exists(de_path) || !path_exists(ce_path)) {
|
|
||||||
if (path_exists(de_path)) {
|
|
||||||
android::vold::destroyKey(de_path); // May be partially created so ignore errors
|
|
||||||
}
|
|
||||||
if (path_exists(ce_path)) {
|
|
||||||
android::vold::destroyKey(ce_path); // May be partially created so ignore errors
|
|
||||||
}
|
|
||||||
if (!create_and_install_user_keys(0, false)) return false;
|
if (!create_and_install_user_keys(0, false)) return false;
|
||||||
}
|
}
|
||||||
// TODO: switch to loading only DE_0 here once framework makes
|
// TODO: switch to loading only DE_0 here once framework makes
|
||||||
|
@ -464,7 +549,9 @@ bool e4crypt_destroy_user_key(userid_t user_id) {
|
||||||
if (it != s_ephemeral_users.end()) {
|
if (it != s_ephemeral_users.end()) {
|
||||||
s_ephemeral_users.erase(it);
|
s_ephemeral_users.erase(it);
|
||||||
} else {
|
} else {
|
||||||
success &= android::vold::destroyKey(get_ce_key_path(user_id));
|
for (auto const path: get_ce_key_paths(get_ce_key_directory_path(user_id))) {
|
||||||
|
success &= android::vold::destroyKey(path);
|
||||||
|
}
|
||||||
success &= android::vold::destroyKey(get_de_key_path(user_id));
|
success &= android::vold::destroyKey(get_de_key_path(user_id));
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
@ -512,35 +599,41 @@ static bool parse_hex(const char* hex, std::string* result) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool e4crypt_change_user_key(userid_t user_id, int serial, const char* token_hex,
|
bool e4crypt_add_user_key_auth(userid_t user_id, int serial, const char* token_hex,
|
||||||
const char* old_secret_hex, const char* new_secret_hex) {
|
const char* secret_hex) {
|
||||||
LOG(DEBUG) << "e4crypt_change_user_key " << user_id << " serial=" << serial
|
LOG(DEBUG) << "e4crypt_add_user_key_auth " << user_id << " serial=" << serial
|
||||||
<< " token_present=" << (strcmp(token_hex, "!") != 0);
|
<< " token_present=" << (strcmp(token_hex, "!") != 0);
|
||||||
if (!e4crypt_is_native()) return true;
|
if (!e4crypt_is_native()) return true;
|
||||||
if (s_ephemeral_users.count(user_id) != 0) return true;
|
if (s_ephemeral_users.count(user_id) != 0) return true;
|
||||||
std::string token, old_secret, new_secret;
|
std::string token, secret;
|
||||||
if (!parse_hex(token_hex, &token)) return false;
|
if (!parse_hex(token_hex, &token)) return false;
|
||||||
if (!parse_hex(old_secret_hex, &old_secret)) return false;
|
if (!parse_hex(secret_hex, &secret)) return false;
|
||||||
if (!parse_hex(new_secret_hex, &new_secret)) return false;
|
auto auth = secret.empty() ? kEmptyAuthentication
|
||||||
auto old_auth = old_secret.empty() ? kEmptyAuthentication
|
: android::vold::KeyAuthentication(token, secret);
|
||||||
: android::vold::KeyAuthentication(token, old_secret);
|
|
||||||
auto new_auth = new_secret.empty() ? kEmptyAuthentication
|
|
||||||
: android::vold::KeyAuthentication(token, new_secret);
|
|
||||||
auto it = s_ce_keys.find(user_id);
|
auto it = s_ce_keys.find(user_id);
|
||||||
if (it == s_ce_keys.end()) {
|
if (it == s_ce_keys.end()) {
|
||||||
LOG(ERROR) << "Key not loaded into memory, can't change for user " << user_id;
|
LOG(ERROR) << "Key not loaded into memory, can't change for user " << user_id;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto ce_key = it->second;
|
auto ce_key = it->second;
|
||||||
auto ce_key_path = get_ce_key_path(user_id);
|
auto const directory_path = get_ce_key_directory_path(user_id);
|
||||||
std::string trial_key;
|
auto const paths = get_ce_key_paths(directory_path);
|
||||||
if (!android::vold::retrieveKey(ce_key_path, old_auth, &trial_key)) {
|
std::string ce_key_path;
|
||||||
LOG(WARNING) << "change_user_key wasn't given enough info to reconstruct the key";
|
if (!get_ce_key_new_path(directory_path, paths, &ce_key_path)) return false;
|
||||||
} else if (ce_key != trial_key) {
|
if (!store_key(ce_key_path, user_key_temp, auth, ce_key)) return false;
|
||||||
LOG(WARNING) << "Reconstructed key != stored key";
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool e4crypt_fixate_newest_user_key_auth(userid_t user_id) {
|
||||||
|
LOG(DEBUG) << "e4crypt_fixate_newest_user_key_auth " << user_id;
|
||||||
|
if (!e4crypt_is_native()) return true;
|
||||||
|
auto const directory_path = get_ce_key_directory_path(user_id);
|
||||||
|
auto const paths = get_ce_key_paths(directory_path);
|
||||||
|
if (paths.empty()) {
|
||||||
|
LOG(ERROR) << "No ce keys present, cannot fixate for user " << user_id;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
android::vold::destroyKey(ce_key_path);
|
fixate_user_ce_key(directory_path, paths[0], paths);
|
||||||
if (!store_key(ce_key_path, user_key_temp, new_auth, ce_key)) return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,9 @@ bool e4crypt_initialize_global_de();
|
||||||
bool e4crypt_init_user0();
|
bool e4crypt_init_user0();
|
||||||
bool e4crypt_vold_create_user_key(userid_t user_id, int serial, bool ephemeral);
|
bool e4crypt_vold_create_user_key(userid_t user_id, int serial, bool ephemeral);
|
||||||
bool e4crypt_destroy_user_key(userid_t user_id);
|
bool e4crypt_destroy_user_key(userid_t user_id);
|
||||||
bool e4crypt_change_user_key(userid_t user_id, int serial, const char* token,
|
bool e4crypt_add_user_key_auth(userid_t user_id, int serial, const char* token,
|
||||||
const char* old_secret, const char* new_secret);
|
const char* secret);
|
||||||
|
bool e4crypt_fixate_newest_user_key_auth(userid_t user_id);
|
||||||
|
|
||||||
bool e4crypt_unlock_user_key(userid_t user_id, int serial, const char* token, const char* secret);
|
bool e4crypt_unlock_user_key(userid_t user_id, int serial, const char* token, const char* secret);
|
||||||
bool e4crypt_lock_user_key(userid_t user_id);
|
bool e4crypt_lock_user_key(userid_t user_id);
|
||||||
|
|
|
@ -56,6 +56,8 @@ static constexpr size_t SALT_BYTES = 1 << 4;
|
||||||
static constexpr size_t SECDISCARDABLE_BYTES = 1 << 14;
|
static constexpr size_t SECDISCARDABLE_BYTES = 1 << 14;
|
||||||
static constexpr size_t STRETCHED_BYTES = 1 << 6;
|
static constexpr size_t STRETCHED_BYTES = 1 << 6;
|
||||||
|
|
||||||
|
static constexpr uint32_t AUTH_TIMEOUT = 30; // Seconds
|
||||||
|
|
||||||
static const char* kCurrentVersion = "1";
|
static const char* kCurrentVersion = "1";
|
||||||
static const char* kRmPath = "/system/bin/rm";
|
static const char* kRmPath = "/system/bin/rm";
|
||||||
static const char* kSecdiscardPath = "/system/bin/secdiscard";
|
static const char* kSecdiscardPath = "/system/bin/secdiscard";
|
||||||
|
@ -115,7 +117,7 @@ static bool generateKeymasterKey(Keymaster& keymaster, const KeyAuthentication&
|
||||||
const hw_auth_token_t* at = reinterpret_cast<const hw_auth_token_t*>(auth.token.data());
|
const hw_auth_token_t* at = reinterpret_cast<const hw_auth_token_t*>(auth.token.data());
|
||||||
paramBuilder.Authorization(keymaster::TAG_USER_SECURE_ID, at->user_id);
|
paramBuilder.Authorization(keymaster::TAG_USER_SECURE_ID, at->user_id);
|
||||||
paramBuilder.Authorization(keymaster::TAG_USER_AUTH_TYPE, HW_AUTH_PASSWORD);
|
paramBuilder.Authorization(keymaster::TAG_USER_AUTH_TYPE, HW_AUTH_PASSWORD);
|
||||||
paramBuilder.Authorization(keymaster::TAG_AUTH_TIMEOUT, 5);
|
paramBuilder.Authorization(keymaster::TAG_AUTH_TIMEOUT, AUTH_TIMEOUT);
|
||||||
}
|
}
|
||||||
return keymaster.generateKey(paramBuilder.build(), key);
|
return keymaster.generateKey(paramBuilder.build(), key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#define CONSTRAIN(amount, low, high) (amount < low ? low : (amount > high ? high : amount))
|
#define CONSTRAIN(amount, low, high) ((amount) < (low) ? (low) : ((amount) > (high) ? (high) : (amount)))
|
||||||
|
|
||||||
using android::base::StringPrintf;
|
using android::base::StringPrintf;
|
||||||
|
|
||||||
|
|
|
@ -194,12 +194,10 @@ status_t PublicVolume::doMount() {
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t PublicVolume::doUnmount() {
|
status_t PublicVolume::doUnmount() {
|
||||||
if (mFusePid > 0) {
|
// Unmount the storage before we kill the FUSE process. If we kill
|
||||||
kill(mFusePid, SIGTERM);
|
// the FUSE process first, most file system operations will return
|
||||||
TEMP_FAILURE_RETRY(waitpid(mFusePid, nullptr, 0));
|
// ENOTCONN until the unmount completes. This is an exotic and unusual
|
||||||
mFusePid = 0;
|
// error code and might cause broken behaviour in applications.
|
||||||
}
|
|
||||||
|
|
||||||
KillProcessesUsingPath(getPath());
|
KillProcessesUsingPath(getPath());
|
||||||
|
|
||||||
ForceUnmount(kAsecPath);
|
ForceUnmount(kAsecPath);
|
||||||
|
@ -209,6 +207,12 @@ status_t PublicVolume::doUnmount() {
|
||||||
ForceUnmount(mFuseWrite);
|
ForceUnmount(mFuseWrite);
|
||||||
ForceUnmount(mRawPath);
|
ForceUnmount(mRawPath);
|
||||||
|
|
||||||
|
if (mFusePid > 0) {
|
||||||
|
kill(mFusePid, SIGTERM);
|
||||||
|
TEMP_FAILURE_RETRY(waitpid(mFusePid, nullptr, 0));
|
||||||
|
mFusePid = 0;
|
||||||
|
}
|
||||||
|
|
||||||
rmdir(mFuseDefault.c_str());
|
rmdir(mFuseDefault.c_str());
|
||||||
rmdir(mFuseRead.c_str());
|
rmdir(mFuseRead.c_str());
|
||||||
rmdir(mFuseWrite.c_str());
|
rmdir(mFuseWrite.c_str());
|
||||||
|
|
|
@ -63,8 +63,8 @@
|
||||||
|
|
||||||
#define MASS_STORAGE_FILE_PATH "/sys/class/android_usb/android0/f_mass_storage/lun/file"
|
#define MASS_STORAGE_FILE_PATH "/sys/class/android_usb/android0/f_mass_storage/lun/file"
|
||||||
|
|
||||||
#define ROUND_UP_POWER_OF_2(number, po2) (((!!(number & ((1U << po2) - 1))) << po2)\
|
#define ROUND_UP_POWER_OF_2(number, po2) (((!!((number) & ((1U << (po2)) - 1))) << (po2))\
|
||||||
+ (number & (~((1U << po2) - 1))))
|
+ ((number) & (~((1U << (po2)) - 1))))
|
||||||
|
|
||||||
using android::base::StringPrintf;
|
using android::base::StringPrintf;
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ private:
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
#define UNMOUNT_NOT_MOUNTED_ERR -2
|
#define UNMOUNT_NOT_MOUNTED_ERR (-2)
|
||||||
int vold_unmountAll(void);
|
int vold_unmountAll(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ static status_t BenchmarkRun() {
|
||||||
# TODO: track actual file size instead of guessing
|
# TODO: track actual file size instead of guessing
|
||||||
count = min(int(e.args[2]), bufsize)
|
count = min(int(e.args[2]), bufsize)
|
||||||
f.size += count
|
f.size += count
|
||||||
print >>bench, 'TEMP_FAILURE_RETRY(read(%s, buf, %d));' % (handle, count)
|
print >>bench, 'TEMP_FAILURE_RETRY(write(%s, buf, %d));' % (handle, count)
|
||||||
nwrite += 1
|
nwrite += 1
|
||||||
|
|
||||||
elif e.call == "pread64":
|
elif e.call == "pread64":
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
#include "CheckBattery.h"
|
#include "CheckBattery.h"
|
||||||
#include "Process.h"
|
#include "Process.h"
|
||||||
|
|
||||||
#include <bootloader_message_writer.h>
|
#include <bootloader_message/bootloader_message.h>
|
||||||
#include <hardware/keymaster0.h>
|
#include <hardware/keymaster0.h>
|
||||||
#include <hardware/keymaster1.h>
|
#include <hardware/keymaster1.h>
|
||||||
|
|
||||||
|
@ -3860,3 +3860,9 @@ int cryptfs_set_password(struct crypt_mnt_ftr* ftr, const char* password,
|
||||||
return encrypt_master_key(password, ftr->salt, master_key, ftr->master_key,
|
return encrypt_master_key(password, ftr->salt, master_key, ftr->master_key,
|
||||||
ftr);
|
ftr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* cryptfs_get_file_encryption_mode()
|
||||||
|
{
|
||||||
|
struct fstab_rec* rec = fs_mgr_get_entry_for_mount_point(fstab, DATA_MNT_POINT);
|
||||||
|
return fs_mgr_get_file_encryption_mode(rec);
|
||||||
|
}
|
||||||
|
|
29
cryptfs.h
29
cryptfs.h
|
@ -191,32 +191,32 @@ struct crypt_persist_data {
|
||||||
/* Return values for cryptfs_crypto_complete */
|
/* Return values for cryptfs_crypto_complete */
|
||||||
#define CRYPTO_COMPLETE_NOT_ENCRYPTED 1
|
#define CRYPTO_COMPLETE_NOT_ENCRYPTED 1
|
||||||
#define CRYPTO_COMPLETE_ENCRYPTED 0
|
#define CRYPTO_COMPLETE_ENCRYPTED 0
|
||||||
#define CRYPTO_COMPLETE_BAD_METADATA -1
|
#define CRYPTO_COMPLETE_BAD_METADATA (-1)
|
||||||
#define CRYPTO_COMPLETE_PARTIAL -2
|
#define CRYPTO_COMPLETE_PARTIAL (-2)
|
||||||
#define CRYPTO_COMPLETE_INCONSISTENT -3
|
#define CRYPTO_COMPLETE_INCONSISTENT (-3)
|
||||||
#define CRYPTO_COMPLETE_CORRUPT -4
|
#define CRYPTO_COMPLETE_CORRUPT (-4)
|
||||||
|
|
||||||
/* Return values for cryptfs_enable_inplace*() */
|
/* Return values for cryptfs_enable_inplace*() */
|
||||||
#define ENABLE_INPLACE_OK 0
|
#define ENABLE_INPLACE_OK 0
|
||||||
#define ENABLE_INPLACE_ERR_OTHER -1
|
#define ENABLE_INPLACE_ERR_OTHER (-1)
|
||||||
#define ENABLE_INPLACE_ERR_DEV -2 /* crypto_blkdev issue */
|
#define ENABLE_INPLACE_ERR_DEV (-2) /* crypto_blkdev issue */
|
||||||
|
|
||||||
/* Return values for cryptfs_getfield */
|
/* Return values for cryptfs_getfield */
|
||||||
#define CRYPTO_GETFIELD_OK 0
|
#define CRYPTO_GETFIELD_OK 0
|
||||||
#define CRYPTO_GETFIELD_ERROR_NO_FIELD -1
|
#define CRYPTO_GETFIELD_ERROR_NO_FIELD (-1)
|
||||||
#define CRYPTO_GETFIELD_ERROR_OTHER -2
|
#define CRYPTO_GETFIELD_ERROR_OTHER (-2)
|
||||||
#define CRYPTO_GETFIELD_ERROR_BUF_TOO_SMALL -3
|
#define CRYPTO_GETFIELD_ERROR_BUF_TOO_SMALL (-3)
|
||||||
|
|
||||||
/* Return values for cryptfs_setfield */
|
/* Return values for cryptfs_setfield */
|
||||||
#define CRYPTO_SETFIELD_OK 0
|
#define CRYPTO_SETFIELD_OK 0
|
||||||
#define CRYPTO_SETFIELD_ERROR_OTHER -1
|
#define CRYPTO_SETFIELD_ERROR_OTHER (-1)
|
||||||
#define CRYPTO_SETFIELD_ERROR_FIELD_TOO_LONG -2
|
#define CRYPTO_SETFIELD_ERROR_FIELD_TOO_LONG (-2)
|
||||||
#define CRYPTO_SETFIELD_ERROR_VALUE_TOO_LONG -3
|
#define CRYPTO_SETFIELD_ERROR_VALUE_TOO_LONG (-3)
|
||||||
|
|
||||||
/* Return values for persist_del_key */
|
/* Return values for persist_del_key */
|
||||||
#define PERSIST_DEL_KEY_OK 0
|
#define PERSIST_DEL_KEY_OK 0
|
||||||
#define PERSIST_DEL_KEY_ERROR_OTHER -1
|
#define PERSIST_DEL_KEY_ERROR_OTHER (-1)
|
||||||
#define PERSIST_DEL_KEY_ERROR_NO_FIELD -2
|
#define PERSIST_DEL_KEY_ERROR_NO_FIELD (-2)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -252,6 +252,7 @@ extern "C" {
|
||||||
unsigned char* master_key);
|
unsigned char* master_key);
|
||||||
int cryptfs_set_password(struct crypt_mnt_ftr* ftr, const char* password,
|
int cryptfs_set_password(struct crypt_mnt_ftr* ftr, const char* password,
|
||||||
const unsigned char* master_key);
|
const unsigned char* master_key);
|
||||||
|
const char* cryptfs_get_file_encryption_mode();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue