Update libgocryptfs

This commit is contained in:
Matéo Duparc 2022-04-21 15:50:36 +02:00
parent 8cebe499f0
commit 7959b20b3f
Signed by untrusted user: hardcoresushi
GPG Key ID: AFE384344A45E13A
3 changed files with 21 additions and 51 deletions

View File

@ -107,16 +107,16 @@ $ cd DroidFS
[libgocryptfs](https://forge.chapril.org/hardcoresushi/libgocryptfs) needs OpenSSL: [libgocryptfs](https://forge.chapril.org/hardcoresushi/libgocryptfs) needs OpenSSL:
``` ```
$ cd app/libgocryptfs $ cd app/libgocryptfs
$ wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz $ wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz
``` ```
Verify OpenSSL signature: Verify OpenSSL signature:
``` ```
$ wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz.asc $ wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz.asc
$ gpg --verify openssl-1.1.1m.tar.gz.asc openssl-1.1.1m.tar.gz $ gpg --verify openssl-1.1.1n.tar.gz.asc openssl-1.1.1n.tar.gz
``` ```
Continue **ONLY** if the signature is **VALID**. Continue **ONLY** if the signature is **VALID**.
``` ```
$ tar -xvzf openssl-1.1.1m.tar.gz $ tar -xvzf openssl-1.1.1n.tar.gz
``` ```
DroidFS also need [FFmpeg](https://ffmpeg.org) to record encrypted video: DroidFS also need [FFmpeg](https://ffmpeg.org) to record encrypted video:
``` ```
@ -134,7 +134,7 @@ $ keytool -genkey -keystore <output file> -alias <key alias> -keyalg EC -validit
Retrieve your Android NDK installation path, usually something like "/home/\<user\>/Android/SDK/ndk/\<NDK version\>". Now you can build libgocryptfs: Retrieve your Android NDK installation path, usually something like "/home/\<user\>/Android/SDK/ndk/\<NDK version\>". Now you can build libgocryptfs:
``` ```
$ cd DroidFS/app/libgocryptfs $ cd DroidFS/app/libgocryptfs
$ env ANDROID_NDK_HOME="<your ndk path>" OPENSSL_PATH="./openssl-1.1.1m" ./build.sh $ env ANDROID_NDK_HOME="<your ndk path>" OPENSSL_PATH="./openssl-1.1.1n" ./build.sh
``` ```
Then FFmpeg: Then FFmpeg:
``` ```

@ -1 +1 @@
Subproject commit 89966b1aaef93ac842f2240451ebfd50dd2bbce9 Subproject commit 985d8523434814cd9cba61b666a1f888bdcbaded

View File

@ -48,94 +48,64 @@ class GocryptfsVolume(val applicationContext: Context, var sessionID: Int) {
} }
fun close() { fun close() {
synchronized(applicationContext) {
native_close(sessionID) native_close(sessionID)
} }
}
fun isClosed(): Boolean { fun isClosed(): Boolean {
synchronized(applicationContext) {
return native_is_closed(sessionID) return native_is_closed(sessionID)
} }
}
fun listDir(dir_path: String): MutableList<ExplorerElement> { fun listDir(dir_path: String): MutableList<ExplorerElement> {
synchronized(applicationContext) {
return native_list_dir(sessionID, dir_path) return native_list_dir(sessionID, dir_path)
} }
}
fun mkdir(dir_path: String): Boolean { fun mkdir(dir_path: String): Boolean {
synchronized(applicationContext) {
return native_mkdir(sessionID, dir_path, ConstValues.DIRECTORY_MODE) return native_mkdir(sessionID, dir_path, ConstValues.DIRECTORY_MODE)
} }
}
fun rmdir(dir_path: String): Boolean { fun rmdir(dir_path: String): Boolean {
synchronized(applicationContext) {
return native_rmdir(sessionID, dir_path) return native_rmdir(sessionID, dir_path)
} }
}
fun removeFile(file_path: String): Boolean { fun removeFile(file_path: String): Boolean {
synchronized(applicationContext) {
return native_remove_file(sessionID, file_path) return native_remove_file(sessionID, file_path)
} }
}
fun pathExists(file_path: String): Boolean { fun pathExists(file_path: String): Boolean {
synchronized(applicationContext) {
return native_path_exists(sessionID, file_path) return native_path_exists(sessionID, file_path)
} }
}
fun getSize(file_path: String): Long { fun getSize(file_path: String): Long {
synchronized(applicationContext) {
return native_get_size(sessionID, file_path) return native_get_size(sessionID, file_path)
} }
}
fun closeFile(handleID: Int) { fun closeFile(handleID: Int) {
synchronized(applicationContext) {
native_close_file(sessionID, handleID) native_close_file(sessionID, handleID)
} }
}
fun openReadMode(file_path: String): Int { fun openReadMode(file_path: String): Int {
synchronized(applicationContext) {
return native_open_read_mode(sessionID, file_path) return native_open_read_mode(sessionID, file_path)
} }
}
fun openWriteMode(file_path: String): Int { fun openWriteMode(file_path: String): Int {
synchronized(applicationContext) {
return native_open_write_mode(sessionID, file_path, ConstValues.FILE_MODE) return native_open_write_mode(sessionID, file_path, ConstValues.FILE_MODE)
} }
}
fun readFile(handleID: Int, offset: Long, buff: ByteArray): Int { fun readFile(handleID: Int, offset: Long, buff: ByteArray): Int {
synchronized(applicationContext) {
return native_read_file(sessionID, handleID, offset, buff) return native_read_file(sessionID, handleID, offset, buff)
} }
}
fun writeFile(handleID: Int, offset: Long, buff: ByteArray, buff_size: Int): Int { fun writeFile(handleID: Int, offset: Long, buff: ByteArray, buff_size: Int): Int {
synchronized(applicationContext) {
return native_write_file(sessionID, handleID, offset, buff, buff_size) return native_write_file(sessionID, handleID, offset, buff, buff_size)
} }
}
fun truncate(handleID: Int, offset: Long): Boolean { fun truncate(handleID: Int, offset: Long): Boolean {
synchronized(this) {
return native_truncate(sessionID, handleID, offset) return native_truncate(sessionID, handleID, offset)
} }
}
fun rename(old_path: String, new_path: String): Boolean { fun rename(old_path: String, new_path: String): Boolean {
synchronized(this) {
return native_rename(sessionID, old_path, new_path) return native_rename(sessionID, old_path, new_path)
} }
}
fun exportFile(handleID: Int, os: OutputStream): Boolean { fun exportFile(handleID: Int, os: OutputStream): Boolean {
var offset: Long = 0 var offset: Long = 0