Browse Source

Update libgocryptfs

cryfs
Hardcore Sushi 3 months ago
parent
commit
7959b20b3f
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A
  1. 10
      README.md
  2. 2
      app/libgocryptfs
  3. 60
      app/src/main/java/sushi/hardcore/droidfs/GocryptfsVolume.kt

10
README.md

@ -107,16 +107,16 @@ $ cd DroidFS
[libgocryptfs](https://forge.chapril.org/hardcoresushi/libgocryptfs) needs OpenSSL:
```
$ 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:
```
$ wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz.asc
$ gpg --verify openssl-1.1.1m.tar.gz.asc openssl-1.1.1m.tar.gz
$ wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz.asc
$ gpg --verify openssl-1.1.1n.tar.gz.asc openssl-1.1.1n.tar.gz
```
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:
```
@ -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:
```
$ 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:
```

2
app/libgocryptfs

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

60
app/src/main/java/sushi/hardcore/droidfs/GocryptfsVolume.kt

@ -48,93 +48,63 @@ class GocryptfsVolume(val applicationContext: Context, var sessionID: Int) {
}
fun close() {
synchronized(applicationContext) {
native_close(sessionID)
}
native_close(sessionID)
}
fun isClosed(): Boolean {
synchronized(applicationContext) {
return native_is_closed(sessionID)
}
return native_is_closed(sessionID)
}
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 {
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 {
synchronized(applicationContext) {
return native_rmdir(sessionID, dir_path)
}
return native_rmdir(sessionID, dir_path)
}
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 {
synchronized(applicationContext) {
return native_path_exists(sessionID, file_path)
}
return native_path_exists(sessionID, file_path)
}
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) {
synchronized(applicationContext) {
native_close_file(sessionID, handleID)
}
native_close_file(sessionID, handleID)
}
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 {
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 {
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 {
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 {
synchronized(this) {
return native_truncate(sessionID, handleID, offset)
}
return native_truncate(sessionID, handleID, offset)
}
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 {

Loading…
Cancel
Save