Support encrypted backup files

Also includes features merged from:

Update twrpTar by kokotas

Revised function entryExists().
Added function to get archive's uncompressed size.
Added option to exclude item(s) from the archive.
Revised forks()

http://review.teamw.in/#/c/590/

Change-Id: I01fa2c81643161984eff2625247af75990684bd9
This commit is contained in:
Dees_Troy
2013-05-04 12:39:56 +00:00
committed by Dees_Troy
parent f6b15d1d45
commit 83bd483f3d
46 changed files with 9011 additions and 471 deletions
+7 -1
View File
@@ -232,6 +232,11 @@ endif
ifeq ($(TARGET_BOARD_PLATFORM),rk30xx)
LOCAL_CFLAGS += -DRK3066
endif
ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
LOCAL_SHARED_LIBRARIES += libopenaes
else
LOCAL_CFLAGS += -DTW_EXCLUDE_ENCRYPTED_BACKUPS
endif
include $(BUILD_EXECUTABLE)
@@ -304,7 +309,8 @@ include $(commands_recovery_local_path)/libjpegtwrp/Android.mk \
$(commands_recovery_local_path)/crypto/cryptfs/Android.mk \
$(commands_recovery_local_path)/libcrecovery/Android.mk \
$(commands_recovery_local_path)/libblkid/Android.mk \
$(commands_recovery_local_path)/minuitwrp/Android.mk
$(commands_recovery_local_path)/minuitwrp/Android.mk \
$(commands_recovery_local_path)/openaes/Android.mk
ifeq ($(TW_INCLUDE_CRYPTO_SAMSUNG), true)
include $(commands_recovery_local_path)/crypto/libcrypt_samsung/Android.mk
+7
View File
@@ -908,6 +908,7 @@ void DataManager::SetDefaultValues()
mValues.insert(make_pair("tw_military_time", make_pair("0", 1)));
mValues.insert(make_pair("tw_screen_timeout_secs", make_pair("60", 1)));
mValues.insert(make_pair("tw_gui_done", make_pair("0", 0)));
mValues.insert(make_pair("tw_encrypt_backup", make_pair("0", 0)));
#ifdef TW_BRIGHTNESS_PATH
#ifndef TW_MAX_BRIGHTNESS
#define TW_MAX_BRIGHTNESS 255
@@ -926,6 +927,12 @@ void DataManager::SetDefaultValues()
}
#endif
mValues.insert(make_pair(TW_MILITARY_TIME, make_pair("0", 1)));
#ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS
mValues.insert(make_pair("tw_include_encrypted_backup", make_pair("1", 0)));
#else
LOGINFO("TW_EXCLUDE_ENCRYPTED_BACKUPS := true\n");
mValues.insert(make_pair("tw_include_encrypted_backup", make_pair("0", 0)));
#endif
}
// Magic Values
+33 -4
View File
@@ -31,6 +31,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <dirent.h>
#include <string>
#include <sstream>
@@ -405,6 +406,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
}
}
operation_end(ret_val, simulate);
return 0;
}
if (function == "readBackup")
@@ -494,6 +496,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
PartitionManager.Mount_Current_Storage(true);
}
operation_end(0, simulate);
return 0;
}
if (function == "copylog")
@@ -705,6 +708,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
operation_end(0, simulate);
else
operation_end(1, simulate);
return 0;
}
if (function == "flash")
@@ -863,6 +867,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
} else
PartitionManager.Update_System_Details();
operation_end(0, simulate);
return 0;
}
if (function == "nandroid")
{
@@ -893,12 +898,13 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
return -1;
}
}
DataManager::SetValue("tw_encrypt_backup", 0);
if (ret == false)
ret = 1; // 1 for failure
else
ret = 0; // 0 for success
operation_end(ret, simulate);
return 0;
operation_end(ret, simulate);
return 0;
}
if (function == "fixpermissions")
{
@@ -1226,6 +1232,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
DataManager::SetValue("tw_page_done", 1);
}
}
return 0;
}
if (function == "installsu")
{
@@ -1254,16 +1261,38 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
op_status = 1;
}
operation_end(op_status, simulate);
return 0;
}
if (function == "decrypt_backup")
{
int op_status = 0;
operation_start("Try Restore Decrypt");
if (simulate) {
simulate_progress_bar();
} else {
string Restore_Path, Filename, Password;
DataManager::GetValue("tw_restore", Restore_Path);
Restore_Path += "/";
DataManager::GetValue("tw_restore_password", Password);
if (TWFunc::Try_Decrypting_Backup(Restore_Path, Password))
op_status = 0; // success
else
op_status = 1; // fail
}
operation_end(op_status, simulate);
return 0;
}
}
else
{
pthread_t t;
pthread_create(&t, NULL, thread_start, this);
pthread_t t;
pthread_create(&t, NULL, thread_start, this);
return 0;
}
LOGERR("Unknown action '%s'\n", function.c_str());
return -1;
}
+299 -2
View File
@@ -183,7 +183,7 @@
<variable name="button_fill_full_width" value="512" />
<variable name="button_fill_main_width" value="486" />
<variable name="button_fill_main_height" value="150" />
<variable name="button_fill_half_height" value="75" />
<variable name="button_fill_half_height" value="50" />
<variable name="button_fill_quarter_height" value="30" />
<variable name="button_full_center_x" value="256" />
<variable name="backup_list_x" value="23" />
@@ -191,6 +191,7 @@
<variable name="backup_list_width" value="486" />
<variable name="backup_list_height" value="360" />
<variable name="backup_storage_y" value="250" />
<variable name="backup_encrypt_y" value="310" />
<variable name="restore_list_y" value="140" />
<variable name="restore_list_height" value="320" />
<variable name="mount_list_height" value="400" />
@@ -1667,6 +1668,36 @@
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>No Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="checkbox">
<placement x="%col3_x%" y="%nandcheck_row6%" />
<font resource="font" color="%text_color%" />
@@ -1787,6 +1818,140 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please enter a password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1855,7 +2020,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1872,6 +2037,138 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Backup encrypted. Please enter your password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col3_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+299 -2
View File
@@ -183,7 +183,7 @@
<variable name="button_fill_full_width" value="512" />
<variable name="button_fill_main_width" value="486" />
<variable name="button_fill_main_height" value="150" />
<variable name="button_fill_half_height" value="75" />
<variable name="button_fill_half_height" value="50" />
<variable name="button_fill_quarter_height" value="30" />
<variable name="button_full_center_x" value="256" />
<variable name="backup_list_x" value="23" />
@@ -191,6 +191,7 @@
<variable name="backup_list_width" value="486" />
<variable name="backup_list_height" value="450" />
<variable name="backup_storage_y" value="250" />
<variable name="backup_encrypt_y" value="310" />
<variable name="restore_list_y" value="140" />
<variable name="restore_list_height" value="400" />
<variable name="mount_list_height" value="500" />
@@ -1667,6 +1668,36 @@
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>No Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="checkbox">
<placement x="%col3_x%" y="%nandcheck_row6%" />
<font resource="font" color="%text_color%" />
@@ -1787,6 +1818,140 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please enter a password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1855,7 +2020,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1872,6 +2037,138 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Backup encrypted. Please enter your password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col3_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+317 -8
View File
@@ -1338,15 +1338,21 @@
<page name="backup">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
</actions>
</object>
<object type="partitionlist">
<highlight color="%fileselector_highlight_color%" />
<placement x="%listbox_x%" y="%row1_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<placement x="%listbox_x%" y="%row2_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" />
<fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" />
<text>Select Partitions to Back Up:</text>
@@ -1359,14 +1365,33 @@
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Set Backup Name</text>
<text>No Encryption</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="set">tw_password_not_match=0</action>
<action function="page">backupencryption</action>
</actions>
</object>
@@ -1508,6 +1533,152 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter A Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1574,7 +1745,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1591,6 +1762,144 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Backup Encrypted</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Your Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col1_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+299 -2
View File
@@ -183,7 +183,7 @@
<variable name="button_fill_full_width" value="640" />
<variable name="button_fill_main_width" value="609" />
<variable name="button_fill_main_height" value="160" />
<variable name="button_fill_half_height" value="80" />
<variable name="button_fill_half_height" value="53" />
<variable name="button_fill_quarter_height" value="40" />
<variable name="button_full_center_x" value="320" />
<variable name="backup_list_x" value="28" />
@@ -191,6 +191,7 @@
<variable name="backup_list_width" value="609" />
<variable name="backup_list_height" value="440" />
<variable name="backup_storage_y" value="270" />
<variable name="backup_encrypt_y" value="330" />
<variable name="restore_list_y" value="140" />
<variable name="restore_list_height" value="400" />
<variable name="mount_list_height" value="600" />
@@ -1667,6 +1668,36 @@
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>No Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="checkbox">
<placement x="%col3_x%" y="%nandcheck_row6%" />
<font resource="font" color="%text_color%" />
@@ -1787,6 +1818,140 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please enter a password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1855,7 +2020,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1872,6 +2037,138 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Backup encrypted. Please enter your password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col3_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+299 -2
View File
@@ -183,7 +183,7 @@
<variable name="button_fill_full_width" value="960" />
<variable name="button_fill_main_width" value="900" />
<variable name="button_fill_main_height" value="240" />
<variable name="button_fill_half_height" value="120" />
<variable name="button_fill_half_height" value="80" />
<variable name="button_fill_quarter_height" value="60" />
<variable name="button_full_center_x" value="480" />
<variable name="backup_list_x" value="50" />
@@ -191,6 +191,7 @@
<variable name="backup_list_width" value="900" />
<variable name="backup_list_height" value="660" />
<variable name="backup_storage_y" value="405" />
<variable name="backup_encrypt_y" value="495" />
<variable name="restore_list_y" value="190" />
<variable name="restore_list_height" value="600" />
<variable name="mount_list_height" value="900" />
@@ -1667,6 +1668,36 @@
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>No Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="checkbox">
<placement x="%col3_x%" y="%nandcheck_row6%" />
<font resource="font" color="%text_color%" />
@@ -1787,6 +1818,140 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please enter a password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1855,7 +2020,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1872,6 +2037,138 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Backup encrypted. Please enter your password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col3_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+329 -85
View File
@@ -183,7 +183,7 @@
<variable name="button_fill_full_width" value="1280" />
<variable name="button_fill_main_width" value="1200" />
<variable name="button_fill_main_height" value="320" />
<variable name="button_fill_half_height" value="160" />
<variable name="button_fill_half_height" value="107" />
<variable name="button_fill_quarter_height" value="80" />
<variable name="button_full_center_x" value="640" />
<variable name="backup_list_x" value="50" />
@@ -191,6 +191,7 @@
<variable name="backup_list_width" value="1200" />
<variable name="backup_list_height" value="880" />
<variable name="backup_storage_y" value="540" />
<variable name="backup_encrypt_y" value="650" />
<variable name="restore_list_y" value="280" />
<variable name="restore_list_height" value="800" />
<variable name="mount_list_height" value="1200" />
@@ -1667,6 +1668,36 @@
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>No Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="checkbox">
<placement x="%col3_x%" y="%nandcheck_row6%" />
<font resource="font" color="%text_color%" />
@@ -1787,6 +1818,140 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please enter a password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1855,7 +2020,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1872,6 +2037,138 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Backup encrypted. Please enter your password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col3_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
@@ -2297,100 +2594,47 @@
<text>Screen Settings</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Screen Timeout: %tw_screen_timeout_secs% seconds</text>
</object>
<object type="button">
<placement x="%col1_medium_x%" y="%row2_medium_y%" />
<font resource="font" color="%button_text_color%" />
<text>None</text>
<image resource="medium_button" />
<action function="set">tw_screen_timeout_secs=0</action>
</object>
<object type="button">
<placement x="%col2_medium_x%" y="%row2_medium_y%" />
<font resource="font" color="%button_text_color%" />
<text>60</text>
<image resource="medium_button" />
<placement x="%slidervalue_x%" y="%row3_text_y%" />
<font resource="font" color="%text_color%" />
<condition var1="tw_screen_timeout_secs" op="=" var2="0" />
<text>Enable screen timeout.</text>
<image resource="checkbox_false" />
<action function="set">tw_screen_timeout_secs=60</action>
</object>
<object type="button">
<placement x="%col3_medium_x%" y="%row2_medium_y%" />
<font resource="font" color="%button_text_color%" />
<text>120</text>
<image resource="medium_button" />
<action function="set">tw_screen_timeout_secs=120</action>
<placement x="%slidervalue_x%" y="%row3_text_y%" />
<font resource="font" color="%text_color%" />
<condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
<text>Enable screen timeout.</text>
<image resource="checkbox_true" />
<action function="set">tw_screen_timeout_secs=0</action>
</object>
<object type="button">
<placement x="%col4_medium_x%" y="%row2_medium_y%" />
<font resource="font" color="%button_text_color%" />
<text>180</text>
<image resource="medium_button" />
<action function="set">tw_screen_timeout_secs=180</action>
<object type="slidervalue">
<condition var1="tw_screen_timeout_secs" op="!=" var2="0" />
<placement x="slidervalue_x" y="%row5_text_y%" w="%slidervalue_w%" />
<font resource="font" color="%text_color%" />
<colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
<dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
<text>Screen timeout in seconds:</text>
<data variable="tw_screen_timeout_secs" min="15" max="300" />
</object>
<object type="text" color="%text_color%">
<object type="slidervalue">
<condition var1="tw_has_brightnesss_file" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row12_text_y%" placement="5" />
<text>Brightness: %tw_brightness_display%</text>
</object>
<object type="button">
<condition var1="tw_has_brightnesss_file" var2="1" />
<placement x="%col1_medium_x%" y="%row4_medium_y%" />
<font resource="font" color="%button_text_color%" />
<text>25%</text>
<image resource="medium_button" />
<placement x="slidervalue_x" y="%row12_text_y%" w="%slidervalue_w%" />
<font resource="font" color="%text_color%" />
<colors line="%slidervalue_line_clr%" slider="%slidervalue_slider_clr%" />
<dimensions lineh="%slidervalue_lineh%" linepadding="%slidervalue_padding%" sliderw="%slidervalue_sliderw%" sliderh="%slidervalue_sliderh%" />
<text>Brightness: %tw_brightness_pct%%</text>
<data variable="tw_brightness_pct" min="10" max="100" />
<actions>
<action function="cmd">echo %tw_brightness_25% > &quot;%tw_brightness_file%&quot;</action>
<action function="set">tw_brightness_display=25%</action>
<action function="set">tw_brightness=%tw_brightness_25%</action>
</actions>
</object>
<object type="button">
<condition var1="tw_has_brightnesss_file" var2="1" />
<placement x="%col2_medium_x%" y="%row4_medium_y%" />
<font resource="font" color="%button_text_color%" />
<text>50%</text>
<image resource="medium_button" />
<actions>
<action function="cmd">echo %tw_brightness_50% > &quot;%tw_brightness_file%&quot;</action>
<action function="set">tw_brightness_display=50%</action>
<action function="set">tw_brightness=%tw_brightness_50%</action>
</actions>
</object>
<object type="button">
<condition var1="tw_has_brightnesss_file" var2="1" />
<placement x="%col3_medium_x%" y="%row4_medium_y%" />
<font resource="font" color="%button_text_color%" />
<text>75%</text>
<image resource="medium_button" />
<actions>
<action function="cmd">echo %tw_brightness_75% > &quot;%tw_brightness_file%&quot;</action>
<action function="set">tw_brightness_display=75%</action>
<action function="set">tw_brightness=%tw_brightness_75%</action>
</actions>
</object>
<object type="button">
<condition var1="tw_has_brightnesss_file" var2="1" />
<placement x="%col4_medium_x%" y="%row4_medium_y%" />
<font resource="font" color="%button_text_color%" />
<text>100%</text>
<image resource="medium_button" />
<actions>
<action function="cmd">echo %tw_brightness_100% > &quot;%tw_brightness_file%&quot;</action>
<action function="set">tw_brightness_display=100%</action>
<action function="set">tw_brightness=%tw_brightness_100%</action>
<action function="set">tw_brightness=%tw_brightness_max%</action>
<action function="compute">tw_brightness*%tw_brightness_pct%</action>
<action function="compute">tw_brightness/100</action>
<action function="cmd">echo %tw_brightness% > &quot;%tw_brightness_file%&quot;</action>
</actions>
</object>
+318 -9
View File
@@ -169,7 +169,7 @@
<variable name="button_fill_main_height" value="81" />
<variable name="button_fill_half_height" value="40" />
<variable name="button_fill_quarter_height" value="24" />
<variable name="backup_list_height" value="212" />
<variable name="backup_list_height" value="193" />
<variable name="backup_button_row1" value="300" />
<variable name="backup_button_row2" value="326" />
<variable name="mount_list_height" value="270" />
@@ -1325,15 +1325,21 @@
<page name="backup">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
</actions>
</object>
<object type="partitionlist">
<highlight color="%fileselector_highlight_color%" />
<placement x="%listbox_x%" y="%row1_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<placement x="%listbox_x%" y="%row2_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" />
<fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" />
<text>Select Partitions to Back Up:</text>
@@ -1346,14 +1352,33 @@
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Set Backup Name</text>
<text>No Encryption</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="set">tw_password_not_match=0</action>
<action function="page">backupencryption</action>
</actions>
</object>
@@ -1495,6 +1520,152 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter A Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1561,7 +1732,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1578,6 +1749,144 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Backup Encrypted</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Your Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col1_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+318 -9
View File
@@ -169,7 +169,7 @@
<variable name="button_fill_main_height" value="135" />
<variable name="button_fill_half_height" value="67" />
<variable name="button_fill_quarter_height" value="34" />
<variable name="backup_list_height" value="325" />
<variable name="backup_list_height" value="300" />
<variable name="backup_button_row1" value="480" />
<variable name="backup_button_row2" value="520" />
<variable name="mount_list_height" value="380" />
@@ -1325,15 +1325,21 @@
<page name="backup">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
</actions>
</object>
<object type="partitionlist">
<highlight color="%fileselector_highlight_color%" />
<placement x="%listbox_x%" y="%row1_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<placement x="%listbox_x%" y="%row2_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" />
<fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" />
<text>Select Partitions to Back Up:</text>
@@ -1346,14 +1352,33 @@
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Set Backup Name</text>
<text>No Encryption</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="set">tw_password_not_match=0</action>
<action function="page">backupencryption</action>
</actions>
</object>
@@ -1495,6 +1520,152 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter A Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1561,7 +1732,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1578,6 +1749,144 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Backup Encrypted</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Your Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col1_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+318 -9
View File
@@ -168,7 +168,7 @@
<variable name="button_fill_main_height" value="135" />
<variable name="button_fill_half_height" value="67" />
<variable name="button_fill_quarter_height" value="34" />
<variable name="backup_list_height" value="325" />
<variable name="backup_list_height" value="300" />
<variable name="backup_button_row1" value="480" />
<variable name="backup_button_row2" value="520" />
<variable name="mount_list_height" value="380" />
@@ -1324,15 +1324,21 @@
<page name="backup">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
</actions>
</object>
<object type="partitionlist">
<highlight color="%fileselector_highlight_color%" />
<placement x="%listbox_x%" y="%row1_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<placement x="%listbox_x%" y="%row2_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" />
<fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" />
<text>Select Partitions to Back Up:</text>
@@ -1345,14 +1351,33 @@
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Set Backup Name</text>
<text>No Encryption</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="set">tw_password_not_match=0</action>
<action function="page">backupencryption</action>
</actions>
</object>
@@ -1494,6 +1519,152 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter A Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1560,7 +1731,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1577,6 +1748,144 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Backup Encrypted</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Your Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col1_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+318 -9
View File
@@ -169,7 +169,7 @@
<variable name="button_fill_main_height" value="162" />
<variable name="button_fill_half_height" value="81" />
<variable name="button_fill_quarter_height" value="40" />
<variable name="backup_list_height" value="445" />
<variable name="backup_list_height" value="410" />
<variable name="backup_button_row1" value="600" />
<variable name="backup_button_row2" value="645" />
<variable name="mount_list_height" value="500" />
@@ -1325,15 +1325,21 @@
<page name="backup">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
</actions>
</object>
<object type="partitionlist">
<highlight color="%fileselector_highlight_color%" />
<placement x="%listbox_x%" y="%row1_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<placement x="%listbox_x%" y="%row2_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" />
<fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" />
<text>Select Partitions to Back Up:</text>
@@ -1346,14 +1352,33 @@
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Set Backup Name</text>
<text>No Encryption</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="set">tw_password_not_match=0</action>
<action function="page">backupencryption</action>
</actions>
</object>
@@ -1495,6 +1520,152 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter A Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1561,7 +1732,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1578,6 +1749,144 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Backup Encrypted</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Your Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col1_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+318 -9
View File
@@ -174,7 +174,7 @@
<variable name="button_fill_main_height" value="216" />
<variable name="button_fill_half_height" value="108" />
<variable name="button_fill_quarter_height" value="54" />
<variable name="backup_list_height" value="570" />
<variable name="backup_list_height" value="520" />
<variable name="backup_button_row1" value="745" />
<variable name="backup_button_row2" value="810" />
<variable name="mount_list_height" value="690" />
@@ -1338,15 +1338,21 @@
<page name="backup">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
</actions>
</object>
<object type="partitionlist">
<highlight color="%fileselector_highlight_color%" />
<placement x="%listbox_x%" y="%row1_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<placement x="%listbox_x%" y="%row2_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" />
<fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" />
<text>Select Partitions to Back Up:</text>
@@ -1359,14 +1365,33 @@
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Set Backup Name</text>
<text>No Encryption</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="set">tw_password_not_match=0</action>
<action function="page">backupencryption</action>
</actions>
</object>
@@ -1508,6 +1533,152 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter A Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1574,7 +1745,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1591,6 +1762,144 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Backup Encrypted</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Your Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col1_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+318 -9
View File
@@ -170,7 +170,7 @@
<variable name="button_fill_main_height" value="240" />
<variable name="button_fill_half_height" value="120" />
<variable name="button_fill_quarter_height" value="54" />
<variable name="backup_list_height" value="570" />
<variable name="backup_list_height" value="520" />
<variable name="backup_button_row1" value="745" />
<variable name="backup_button_row2" value="810" />
<variable name="mount_list_height" value="690" />
@@ -1326,15 +1326,21 @@
<page name="backup">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<object type="button">
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%row1_header_y%" w="%button_fill_full_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Backup Name: %tw_backup_name%</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
</actions>
</object>
<object type="partitionlist">
<highlight color="%fileselector_highlight_color%" />
<placement x="%listbox_x%" y="%row1_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<placement x="%listbox_x%" y="%row2_text_y%" w="%listbox_width%" h="%backup_list_height%" />
<header background="%fileselector_header_background%" textcolor="%fileselector_header_textcolor%" separatorcolor="%fileselector_header_separatorcolor%" separatorheight="%fileselector_header_separatorheight%" />
<fastscroll linecolor="%fastscroll_linecolor%" rectcolor="%fastscroll_rectcolor%" w="%fastscroll_w%" linew="%fastscroll_linew%" rectw="%fastscroll_rectw%" recth="%fastscroll_recth%" />
<text>Select Partitions to Back Up:</text>
@@ -1347,14 +1353,33 @@
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Set Backup Name</text>
<text>No Encryption</text>
<actions>
<action function="set">tw_fileexists=0</action>
<action function="page">backupname1</action>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col1_x%" y="%backup_button_row1%" w="%button_fill_main_width%" h="%button_fill_quarter_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="set">tw_password_not_match=0</action>
<action function="page">backupencryption</action>
</actions>
</object>
@@ -1496,6 +1521,152 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter A Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Encrypt your backup?</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1562,7 +1733,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1579,6 +1750,144 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_header_y%" placement="5" />
<text>Backup Encrypted</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row2_text_y%" placement="5" />
<text>Please Enter Your Password:</text>
</object>
<object type="input">
<placement x="%col1_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col1_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%row2_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+299 -2
View File
@@ -183,7 +183,7 @@
<variable name="button_fill_full_width" value="400" />
<variable name="button_fill_main_width" value="367" />
<variable name="button_fill_main_height" value="120" />
<variable name="button_fill_half_height" value="60" />
<variable name="button_fill_half_height" value="40" />
<variable name="button_fill_quarter_height" value="30" />
<variable name="button_full_center_x" value="200" />
<variable name="backup_list_x" value="23" />
@@ -191,6 +191,7 @@
<variable name="backup_list_width" value="367" />
<variable name="backup_list_height" value="290" />
<variable name="backup_storage_y" value="190" />
<variable name="backup_encrypt_y" value="235" />
<variable name="restore_list_y" value="100" />
<variable name="restore_list_height" value="270" />
<variable name="mount_list_height" value="360" />
@@ -1675,6 +1676,36 @@
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="0" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>No Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="button">
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1" />
<condition var1="tw_encrypt_backup" var2="1" />
</conditions>
<highlight color="%highlight_color%" />
<fill color="%button_fill_color%" />
<placement x="%col3_x%" y="%backup_encrypt_y%" w="%button_fill_main_width%" h="%button_fill_half_height%" />
<font resource="font" color="%button_text_color%" />
<text>Using Encryption</text>
<actions>
<action function="page">backupencryption</action>
</actions>
</object>
<object type="checkbox">
<placement x="%col3_x%" y="%nandcheck_row6%" />
<font resource="font" color="%text_color%" />
@@ -1795,6 +1826,140 @@
<object type="template" name="footer" />
</page>
<page name="backupencryption">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please enter a password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display%</text>
<data name="tw_backup_password" mask="*" maskvariable="tw_backup_encrypt_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<action function="page">backupencryption2</action>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_not_match" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Passwords Do Not Match</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="backupencryption2">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Encrypt your backup? Please Enter Password Again:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_backup_encrypt_display2%</text>
<data name="tw_backup_password2" mask="*" maskvariable="tw_backup_encrypt_display2" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">checkbackuppassword</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col_center_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backup</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">backup</action>
</object>
<object type="template" name="footer" />
</page>
<page name="checkbackuppassword">
<object type="action">
<condition var1="tw_backup_password2" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=1</action>
<action function="page">backup</action>
</actions>
</object>
<object type="action">
<condition var1="tw_backup_password2" op="!=" var2="tw_backup_password" />
<actions>
<action function="set">tw_encrypt_backup=0</action>
<action function="set">tw_password_not_match=1</action>
<action function="set">tw_backup_password=</action>
<action function="set">tw_backup_password2=</action>
<action function="set">tw_backup_encrypt_display=</action>
<action function="set">tw_backup_encrypt_display2=</action>
<action function="page">backupencryption</action>
</actions>
</object>
</page>
<page name="backup_run">
<object type="template" name="header" />
@@ -1863,7 +2028,7 @@
<condition var1="tw_restore" op="modified" />
<actions>
<action function="readBackup"></action>
<action function="page">restore_select</action>
<action function="page">restore_read</action>
</actions>
</object>
@@ -1880,6 +2045,138 @@
<object type="template" name="footer" />
</page>
<page name="restore_read">
<object type="action">
<condition var1="tw_restore_encrypted" var2="1" />
<actions>
<action function="set">tw_password_fail=0</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<condition var1="tw_restore_encrypted" var2="0" />
<actions>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Backup encrypted. Please enter your password:</text>
</object>
<object type="input">
<placement x="%input_x%" y="%row3_text_y%" w="%input_width%" h="%input_height%" placement="0" />
<background color="%input_background_color%" />
<cursor color="%input_cursor_color%" hasfocus="1" width="%input_cursor_width%" />
<font resource="font" color="%text_color%" />
<text>%tw_restore_display%</text>
<data name="tw_restore_password" mask="*" maskvariable="tw_restore_display" />
<restrict minlen="1" maxlen="32" allow="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_" />
<actions>
<action function="page">try_restore_decrypt</action>
</actions>
</object>
<object type="text" color="%text_fail_color%">
<condition var1="tw_password_fail" var2="1" />
<font resource="font" />
<placement x="%center_x%" y="%row4_text_y%" placement="5" />
<text>Password Failed, Please Try Again</text>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col2_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Cancel</text>
<image resource="main_button" />
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore</action>
</actions>
</object>
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%col3_x%" y="%cancel_button_y%" />
<font resource="font" color="%button_text_color%" />
<text>Delete</text>
<image resource="main_button" />
<actions>
<action function="set">tw_back=restore</action>
<action function="set">tw_action=cmd</action>
<action function="set">tw_action_param=cd %tw_backups_folder% && rm -rf &quot;%tw_restore_name%&quot;</action>
<action function="set">tw_text1=Delete Backup? %tw_restore_name%</action>
<action function="set">tw_text2=This cannot be undone!</action>
<action function="set">tw_action_text1=Deleting Backup...</action>
<action function="set">tw_complete_text1=Backup Delete Complete</action>
<action function="set">tw_slider_text=Swipe to Delete</action>
<action function="page">confirm_action</action>
</actions>
</object>
<object type="template" name="keyboardtemplate" />
<object type="action">
<touch key="home" />
<action function="page">main</action>
</object>
<object type="action">
<touch key="back" />
<action function="page">restore</action>
</object>
<object type="template" name="footer" />
</page>
<page name="try_restore_decrypt">
<object type="template" name="header" />
<object type="text" color="%text_color%">
<font resource="font" />
<placement x="%center_x%" y="%row1_text_y%" placement="5" />
<text>Trying Decryption with Your Password</text>
</object>
<object type="template" name="action_page_console" />
<object type="template" name="progress_bar" />
<object type="action">
<action function="decrypt_backup"></action>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="!=" var2="0" />
</conditions>
<actions>
<action function="set">tw_password_fail=1</action>
<action function="page">restore_decrypt</action>
</actions>
</object>
<object type="action">
<conditions>
<condition var1="tw_operation_state" var2="1" />
<condition var1="tw_operation_status" op="=" var2="0" />
</conditions>
<actions>
<action function="set">tw_page_done=1</action>
<action function="page">restore_select</action>
</actions>
</object>
</page>
<page name="restore_select">
<object type="template" name="header" />
+1 -1
View File
@@ -289,7 +289,7 @@ int tar_extract_glob(TAR *t, char *globname, char *prefix);
int tar_extract_all(TAR *t, char *prefix);
/* add a whole tree of files */
int tar_append_tree(TAR *t, char *realdir, char *savedir);
int tar_append_tree(TAR *t, char *realdir, char *savedir, char *exclude);
/* find an entry */
int tar_find(TAR *t, char *searchstr);
+66 -34
View File
@@ -17,7 +17,7 @@
#include <sys/param.h>
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#ifdef STDC_HEADERS
# include <string.h>
#endif
@@ -94,62 +94,94 @@ tar_extract_all(TAR *t, char *prefix)
int
tar_append_tree(TAR *t, char *realdir, char *savedir)
tar_append_tree(TAR *t, char *realdir, char *savedir, char *exclude)
{
#ifdef DEBUG
printf("==> tar_append_tree(0x%lx, \"%s\", \"%s\")\n",
(long unsigned int)t, realdir, (savedir ? savedir : "[NULL]"));
#endif
char temp[1024];
int skip = 0, i, n_spaces = 0;
char ** excluded = NULL;
char * p = NULL;
if (exclude) {
strcpy(temp, exclude);
p = strtok(exclude, " ");
if (p == NULL) {
excluded = realloc(excluded, sizeof(char*) * (++n_spaces));
excluded[0] = temp;
} else {
while (p) {
excluded = realloc(excluded, sizeof(char*) * (++n_spaces));
excluded[n_spaces-1] = p;
p = strtok(NULL, " ");
}
}
excluded = realloc(excluded, sizeof(char*) * (n_spaces+1));
excluded[n_spaces] = 0;
for (i = 0; i < (n_spaces+1); i++) {
if (realdir == excluded[i]) {
printf(" excluding '%s'\n", excluded[i]);
skip = 1;
break;
}
}
}
if (skip == 0) {
if (tar_append_file(t, realdir, savedir) != 0)
return -1;
}
char realpath[MAXPATHLEN];
char savepath[MAXPATHLEN];
struct dirent *dent;
DIR *dp;
struct stat s;
#ifdef DEBUG
printf("==> tar_append_tree(0x%lx, \"%s\", \"%s\")\n",
t, realdir, (savedir ? savedir : "[NULL]"));
#endif
if (tar_append_file(t, realdir, savedir) != 0)
return -1;
#ifdef DEBUG
puts(" tar_append_tree(): done with tar_append_file()...");
#endif
dp = opendir(realdir);
if (dp == NULL)
{
if (dp == NULL) {
if (errno == ENOTDIR)
return 0;
return -1;
}
while ((dent = readdir(dp)) != NULL)
{
if (strcmp(dent->d_name, ".") == 0 ||
strcmp(dent->d_name, "..") == 0)
while ((dent = readdir(dp)) != NULL) {
if(strcmp(dent->d_name, ".") == 0
|| strcmp(dent->d_name, "..") == 0)
continue;
snprintf(realpath, MAXPATHLEN, "%s/%s", realdir,
dent->d_name);
if (exclude) {
int omit = 0;
for (i = 0; i < (n_spaces+1); i++) {
if (dent->d_name == excluded[i]) {
printf(" excluding '%s'\n", excluded[i]);
omit = 1;
break;
}
}
if (omit)
continue;
}
snprintf(realpath, MAXPATHLEN, "%s/%s", realdir, dent->d_name);
if (savedir)
snprintf(savepath, MAXPATHLEN, "%s/%s", savedir,
dent->d_name);
snprintf(savepath, MAXPATHLEN, "%s/%s", savedir, dent->d_name);
if (lstat(realpath, &s) != 0)
return -1;
if (S_ISDIR(s.st_mode))
{
if (tar_append_tree(t, realpath,
(savedir ? savepath : NULL)) != 0)
if (S_ISDIR(s.st_mode)) {
if (tar_append_tree(t, realpath, (savedir ? savepath : NULL), (exclude ? exclude : NULL)) != 0)
return -1;
continue;
} else {
if (tar_append_file(t, realpath, (savedir ? savepath : NULL)) != 0)
return -1;
continue;
}
if (tar_append_file(t, realpath,
(savedir ? savepath : NULL)) != 0)
return -1;
}
}
closedir(dp);
free(excluded);
return 0;
}
+26
View File
@@ -0,0 +1,26 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
LOCAL_SRC_FILES:= src/oaes.c \
LOCAL_C_INCLUDES := \
bootable/recovery/openaes/src/isaac \
bootable/recovery/openaes/inc
LOCAL_CFLAGS:= -g -c -W
LOCAL_MODULE:=openaes
LOCAL_MODULE_TAGS:= eng
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/sbin
LOCAL_SHARED_LIBRARIES = libopenaes libc
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE := libopenaes
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
bootable/recovery/openaes/src/isaac \
bootable/recovery/openaes/inc
LOCAL_SRC_FILES = src/oaes_lib.c src/isaac/rand.c
LOCAL_SHARED_LIBRARIES = libc
include $(BUILD_SHARED_LIBRARY)
endif
+43
View File
@@ -0,0 +1,43 @@
---------------------------------------------------------------------------
OpenAES-0.7.0
Nabil S. Al Ramli
www.nalramli.com
---------------------------------------------------------------------------
OpenAES-0.7.0
-------------
* implement oaes command line utility
* defect: oaes_decrypt() does not have a way to tell if pad pattern is accidental
OpenAES-0.6.0
-------------
* add stepping pause to vt_aes
OpenAES-0.5.0
-------------
* defect: algorithm errors with ExpandKey for 192 bit and 256 bit keys
OpenAES-0.4.0
-------------
* add vt_aes test program
* defect: algorithm errors with ShiftRows and MixColumns
* OAES_DEBUG config to step through encryption and decryption
* defect: test_performance crash when printing results
* allow user to specify iv by passing it to oaes_set_option()
* oaes_key_import_data() and oaes_key_export_data() to operate on key data directly
* defect: Access violation in oaes_key_export()
OpenAES-0.3.0
-------------
* Add CMake support
* platform independence fixes
OpenAES-0.2.0
-------------
* Add performance tests
* Implement CBC mode in AES algorithm
* Performance improvements in oaes_shift_rows() and oaes_inv_shift_rows()
OpenAES-0.1.0
-------------
* Implement AES algorithm
+74
View File
@@ -0,0 +1,74 @@
# ---------------------------------------------------------------------------
# OpenAES License
# ---------------------------------------------------------------------------
# Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ---------------------------------------------------------------------------
cmake_minimum_required (VERSION 2.8.0)
project ( "oaes" )
include_directories (
${CMAKE_CURRENT_SOURCE_DIR}/inc
${CMAKE_CURRENT_SOURCE_DIR}/src/isaac
)
set (SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/oaes_lib.c
${CMAKE_CURRENT_SOURCE_DIR}/src/isaac/rand.c
)
set (HDR
${CMAKE_CURRENT_SOURCE_DIR}/inc/oaes_config.h
${CMAKE_CURRENT_SOURCE_DIR}/inc/oaes_lib.h
${CMAKE_CURRENT_SOURCE_DIR}/src/isaac/rand.h
${CMAKE_CURRENT_SOURCE_DIR}/src/isaac/standard.h
)
set (SRC_test_encrypt
${CMAKE_CURRENT_SOURCE_DIR}/test/test_encrypt.c
)
set (SRC_test_keys
${CMAKE_CURRENT_SOURCE_DIR}/test/test_keys.c
)
set (SRC_test_performance
${CMAKE_CURRENT_SOURCE_DIR}/test/test_performance.c
)
set (SRC_vt_aes
${CMAKE_CURRENT_SOURCE_DIR}/test/vt_aes.c
)
set (SRC_oaes
${CMAKE_CURRENT_SOURCE_DIR}/src/oaes.c
)
add_executable (test_encrypt ${SRC_test_encrypt} ${SRC} ${HDR})
add_executable (test_keys ${SRC_test_keys} ${SRC} ${HDR})
add_executable (test_performance ${SRC_test_performance} ${SRC} ${HDR})
add_executable (vt_aes ${SRC_vt_aes} ${SRC} ${HDR})
add_executable (oaes ${SRC_oaes} ${SRC} ${HDR})
+27
View File
@@ -0,0 +1,27 @@
---------------------------------------------------------------------------
OpenAES Licence
---------------------------------------------------------------------------
Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
+78
View File
@@ -0,0 +1,78 @@
---------------------------------------------------------------------------
OpenAES-0.7.0
Nabil S. Al Ramli
www.nalramli.com
---------------------------------------------------------------------------
License Terms
-------------
---------------------------------------------------------------------------
OpenAES Licence
---------------------------------------------------------------------------
Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
Introduction
------------
OpenAES is an open source implementation of the Advanced Encryption
Standard. It is distributed as a portable, lightweight C library that can
be easily integrated into applications.
Compiling
---------
OpenAES has been tested with the GCC as well as VC compilers. It is
necessary to compile the source files located in ./src, and to add ./inc to
the include paths.
If you are building with OAES_HAVE_ISAAC defined (true by default), then
you also need to link in the source files under ./src/isaac and also add
./src/isaac to the include paths.
You may edit ./inc/oaes_config.h to modify build options.
CMake 2.8.0 can be used to build the test programs on different platforms.
In a Linux command line terminal type:
cmake .
make
In Windows, in a Visual Studio command line window type:
cmake . -G "NMake Makefiles"
nmake
Usage
-----
Usage is described in the header file ./inc/oaes_lib.h.
Samples
-------
Samples applications are provided in the /test folder.
+1
View File
@@ -0,0 +1 @@
OpenAES-0.7.0
+50
View File
@@ -0,0 +1,50 @@
/*
* ---------------------------------------------------------------------------
* OpenAES License
* ---------------------------------------------------------------------------
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
#ifndef _OAES_CONFIG_H
#define _OAES_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef OAES_HAVE_ISAAC
#define OAES_HAVE_ISAAC 1
#endif // OAES_HAVE_ISAAC
#ifndef OAES_DEBUG
#define OAES_DEBUG 0
#endif // OAES_DEBUG
#ifdef __cplusplus
}
#endif
#endif // _OAES_CONFIG_H
+172
View File
@@ -0,0 +1,172 @@
/*
* ---------------------------------------------------------------------------
* OpenAES License
* ---------------------------------------------------------------------------
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
#ifndef _OAES_LIB_H
#define _OAES_LIB_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define OAES_VERSION "0.7.0"
#define OAES_BLOCK_SIZE 16
typedef void OAES_CTX;
typedef enum
{
OAES_RET_FIRST = 0,
OAES_RET_SUCCESS = 0,
OAES_RET_UNKNOWN,
OAES_RET_ARG1,
OAES_RET_ARG2,
OAES_RET_ARG3,
OAES_RET_ARG4,
OAES_RET_ARG5,
OAES_RET_NOKEY,
OAES_RET_MEM,
OAES_RET_BUF,
OAES_RET_HEADER,
OAES_RET_COUNT
} OAES_RET;
/*
* oaes_set_option() takes one of these values for its [option] parameter
* some options accept either an optional or a required [value] parameter
*/
// no option
#define OAES_OPTION_NONE 0
// enable ECB mode, disable CBC mode
#define OAES_OPTION_ECB 1
// enable CBC mode, disable ECB mode
// value is optional, may pass uint8_t iv[OAES_BLOCK_SIZE] to specify
// the value of the initialization vector, iv
#define OAES_OPTION_CBC 2
#ifdef OAES_DEBUG
typedef int ( * oaes_step_cb ) (
const uint8_t state[OAES_BLOCK_SIZE],
const char * step_name,
int step_count,
void * user_data );
// enable state stepping mode
// value is required, must pass oaes_step_cb to receive the state at each step
#define OAES_OPTION_STEP_ON 4
// disable state stepping mode
#define OAES_OPTION_STEP_OFF 8
#endif // OAES_DEBUG
typedef uint16_t OAES_OPTION;
/*
* // usage:
*
* OAES_CTX * ctx = oaes_alloc();
* .
* .
* .
* {
* oaes_gen_key_xxx( ctx );
* {
* oaes_key_export( ctx, _buf, &_buf_len );
* // or
* oaes_key_export_data( ctx, _buf, &_buf_len );\
* }
* }
* // or
* {
* oaes_key_import( ctx, _buf, _buf_len );
* // or
* oaes_key_import_data( ctx, _buf, _buf_len );
* }
* .
* .
* .
* oaes_encrypt( ctx, m, m_len, c, &c_len );
* .
* .
* .
* oaes_decrypt( ctx, c, c_len, m, &m_len );
* .
* .
* .
* oaes_free( &ctx );
*/
OAES_CTX * oaes_alloc();
OAES_RET oaes_free( OAES_CTX ** ctx );
OAES_RET oaes_set_option( OAES_CTX * ctx,
OAES_OPTION option, const void * value );
OAES_RET oaes_key_gen_128( OAES_CTX * ctx );
OAES_RET oaes_key_gen_192( OAES_CTX * ctx );
OAES_RET oaes_key_gen_256( OAES_CTX * ctx );
// export key with header information
// set data == NULL to get the required data_len
OAES_RET oaes_key_export( OAES_CTX * ctx,
uint8_t * data, size_t * data_len );
// directly export the data from key
// set data == NULL to get the required data_len
OAES_RET oaes_key_export_data( OAES_CTX * ctx,
uint8_t * data, size_t * data_len );
// import key with header information
OAES_RET oaes_key_import( OAES_CTX * ctx,
const uint8_t * data, size_t data_len );
// directly import data into key
OAES_RET oaes_key_import_data( OAES_CTX * ctx,
const uint8_t * data, size_t data_len );
// set c == NULL to get the required c_len
OAES_RET oaes_encrypt( OAES_CTX * ctx,
const uint8_t * m, size_t m_len, uint8_t * c, size_t * c_len );
// set m == NULL to get the required m_len
OAES_RET oaes_decrypt( OAES_CTX * ctx,
const uint8_t * c, size_t c_len, uint8_t * m, size_t * m_len );
// set buf == NULL to get the required buf_len
OAES_RET oaes_sprintf(
char * buf, size_t * buf_len, const uint8_t * data, size_t data_len );
#ifdef __cplusplus
}
#endif
#endif // _OAES_LIB_H
+137
View File
@@ -0,0 +1,137 @@
/*
------------------------------------------------------------------------------
rand.c: By Bob Jenkins. My random number generator, ISAAC. Public Domain.
MODIFIED:
960327: Creation (addition of randinit, really)
970719: use context, not global variables, for internal state
980324: added main (ifdef'ed out), also rearranged randinit()
010626: Note that this is public domain
------------------------------------------------------------------------------
*/
#ifndef STANDARD
#include "standard.h"
#endif
#ifndef RAND
#include "rand.h"
#endif
#define ind(mm,x) (*(ub4 *)((ub1 *)(mm) + ((x) & ((RANDSIZ-1)<<2))))
#define rngstep(mix,a,b,mm,m,m2,r,x) \
{ \
x = *m; \
a = (a^(mix)) + *(m2++); \
*(m++) = y = ind(mm,x) + a + b; \
*(r++) = b = ind(mm,y>>RANDSIZL) + x; \
}
void isaac(ctx)
randctx *ctx;
{
register ub4 a,b,x,y,*m,*mm,*m2,*r,*mend;
mm=ctx->randmem; r=ctx->randrsl;
a = ctx->randa; b = ctx->randb + (++ctx->randc);
for (m = mm, mend = m2 = m+(RANDSIZ/2); m<mend; )
{
rngstep( a<<13, a, b, mm, m, m2, r, x);
rngstep( a>>6 , a, b, mm, m, m2, r, x);
rngstep( a<<2 , a, b, mm, m, m2, r, x);
rngstep( a>>16, a, b, mm, m, m2, r, x);
}
for (m2 = mm; m2<mend; )
{
rngstep( a<<13, a, b, mm, m, m2, r, x);
rngstep( a>>6 , a, b, mm, m, m2, r, x);
rngstep( a<<2 , a, b, mm, m, m2, r, x);
rngstep( a>>16, a, b, mm, m, m2, r, x);
}
ctx->randb = b; ctx->randa = a;
}
#define mix(a,b,c,d,e,f,g,h) \
{ \
a^=b<<11; d+=a; b+=c; \
b^=c>>2; e+=b; c+=d; \
c^=d<<8; f+=c; d+=e; \
d^=e>>16; g+=d; e+=f; \
e^=f<<10; h+=e; f+=g; \
f^=g>>4; a+=f; g+=h; \
g^=h<<8; b+=g; h+=a; \
h^=a>>9; c+=h; a+=b; \
}
/* if (flag==TRUE), then use the contents of randrsl[] to initialize mm[]. */
void randinit(ctx, flag)
randctx *ctx;
word flag;
{
word i;
ub4 a,b,c,d,e,f,g,h;
ub4 *m,*r;
ctx->randa = ctx->randb = ctx->randc = 0;
m=ctx->randmem;
r=ctx->randrsl;
a=b=c=d=e=f=g=h=0x9e3779b9; /* the golden ratio */
for (i=0; i<4; ++i) /* scramble it */
{
mix(a,b,c,d,e,f,g,h);
}
if (flag)
{
/* initialize using the contents of r[] as the seed */
for (i=0; i<RANDSIZ; i+=8)
{
a+=r[i ]; b+=r[i+1]; c+=r[i+2]; d+=r[i+3];
e+=r[i+4]; f+=r[i+5]; g+=r[i+6]; h+=r[i+7];
mix(a,b,c,d,e,f,g,h);
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
}
/* do a second pass to make all of the seed affect all of m */
for (i=0; i<RANDSIZ; i+=8)
{
a+=m[i ]; b+=m[i+1]; c+=m[i+2]; d+=m[i+3];
e+=m[i+4]; f+=m[i+5]; g+=m[i+6]; h+=m[i+7];
mix(a,b,c,d,e,f,g,h);
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
}
}
else
{
/* fill in m[] with messy stuff */
for (i=0; i<RANDSIZ; i+=8)
{
mix(a,b,c,d,e,f,g,h);
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
}
}
isaac(ctx); /* fill in the first set of results */
ctx->randcnt=RANDSIZ; /* prepare to use the first set of results */
}
#ifdef NEVER
int main()
{
ub4 i,j;
randctx ctx;
ctx.randa=ctx.randb=ctx.randc=(ub4)0;
for (i=0; i<256; ++i) ctx.randrsl[i]=(ub4)0;
randinit(&ctx, TRUE);
for (i=0; i<2; ++i)
{
isaac(&ctx);
for (j=0; j<256; ++j)
{
printf("%.8lx",ctx.randrsl[j]);
if ((j&7)==7) printf("\n");
}
}
}
#endif
+56
View File
@@ -0,0 +1,56 @@
/*
------------------------------------------------------------------------------
rand.h: definitions for a random number generator
By Bob Jenkins, 1996, Public Domain
MODIFIED:
960327: Creation (addition of randinit, really)
970719: use context, not global variables, for internal state
980324: renamed seed to flag
980605: recommend RANDSIZL=4 for noncryptography.
010626: note this is public domain
------------------------------------------------------------------------------
*/
#ifndef STANDARD
#include "standard.h"
#endif
#ifndef RAND
#define RAND
#define RANDSIZL (8)
#define RANDSIZ (1<<RANDSIZL)
/* context of random number generator */
struct randctx
{
ub4 randcnt;
ub4 randrsl[RANDSIZ];
ub4 randmem[RANDSIZ];
ub4 randa;
ub4 randb;
ub4 randc;
};
typedef struct randctx randctx;
/*
------------------------------------------------------------------------------
If (flag==TRUE), then use the contents of randrsl[0..RANDSIZ-1] as the seed.
------------------------------------------------------------------------------
*/
void randinit(/*_ randctx *r, word flag _*/);
void isaac(/*_ randctx *r _*/);
/*
------------------------------------------------------------------------------
Call rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value
------------------------------------------------------------------------------
*/
#define rand(r) \
(!(r)->randcnt-- ? \
(isaac(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->randcnt]) : \
(r)->randrsl[(r)->randcnt])
#endif /* RAND */
+57
View File
@@ -0,0 +1,57 @@
/*
------------------------------------------------------------------------------
Standard definitions and types, Bob Jenkins
------------------------------------------------------------------------------
*/
#ifndef STANDARD
# define STANDARD
# ifndef STDIO
# include <stdio.h>
# define STDIO
# endif
# ifndef STDDEF
# include <stddef.h>
# define STDDEF
# endif
typedef unsigned long long ub8;
#define UB8MAXVAL 0xffffffffffffffffLL
#define UB8BITS 64
typedef signed long long sb8;
#define SB8MAXVAL 0x7fffffffffffffffLL
typedef unsigned long int ub4; /* unsigned 4-byte quantities */
#define UB4MAXVAL 0xffffffff
typedef signed long int sb4;
#define UB4BITS 32
#define SB4MAXVAL 0x7fffffff
typedef unsigned short int ub2;
#define UB2MAXVAL 0xffff
#define UB2BITS 16
typedef signed short int sb2;
#define SB2MAXVAL 0x7fff
typedef unsigned char ub1;
#define UB1MAXVAL 0xff
#define UB1BITS 8
typedef signed char sb1; /* signed 1-byte quantities */
#define SB1MAXVAL 0x7f
typedef int word; /* fastest type available */
#define bis(target,mask) ((target) |= (mask))
#define bic(target,mask) ((target) &= ~(mask))
#define bit(target,mask) ((target) & (mask))
#ifndef min
# define min(a,b) (((a)<(b)) ? (a) : (b))
#endif /* min */
#ifndef max
# define max(a,b) (((a)<(b)) ? (b) : (a))
#endif /* max */
#ifndef align
# define align(a) (((ub4)a+(sizeof(void *)-1))&(~(sizeof(void *)-1)))
#endif /* align */
#ifndef abs
# define abs(a) (((a)>0) ? (a) : -(a))
#endif
#define TRUE 1
#define FALSE 0
#define SUCCESS 0 /* 1 on VAX */
#endif /* STANDARD */
+317
View File
@@ -0,0 +1,317 @@
/*
* ---------------------------------------------------------------------------
* OpenAES License
* ---------------------------------------------------------------------------
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define OAES_DEBUG 1
#include "../inc/oaes_lib.h"
#if defined(_WIN32) && !defined(__SYMBIAN32__)
#include <io.h>
#else
__inline static int setmode(int a, int b)
{
return 0;
}
#endif
#ifndef __max
#define __max(a,b) (((a) > (b)) ? (a) : (b))
#endif // __max
#ifndef __min
#define __min(a,b) (((a) < (b)) ? (a) : (b))
#endif // __min
#define OAES_BUF_LEN_ENC 4096 - 2 * OAES_BLOCK_SIZE
#define OAES_BUF_LEN_DEC 4096
static void usage( const char * exe_name )
{
if( NULL == exe_name )
return;
fprintf( stderr,
"Usage:\n"
" %s <command> --key <key_data> [options]\n"
"\n"
" command:\n"
" enc: encrypt\n"
" dec: decrypt\n"
"\n"
" options:\n"
" --ecb: use ecb mode instead of cbc\n"
" --in <path_in>\n"
" --out <path_out>\n"
"\n",
exe_name
);
}
int main(int argc, char** argv)
{
size_t _i = 0, _j = 0;
OAES_CTX * ctx = NULL;
uint8_t _buf_in[OAES_BUF_LEN_DEC];
uint8_t *_buf_out = NULL, _key_data[32] = "";
size_t _buf_in_len = 0, _buf_out_len = 0, _read_len = 0;
size_t _key_data_len = 0;
short _is_ecb = 0;
char *_file_in = NULL, *_file_out = NULL;
int _op = 0;
FILE *_f_in = stdin, *_f_out = stdout;
fprintf( stderr, "\n"
"*******************************************************************************\n"
"* OpenAES %-10s *\n"
"* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com *\n"
"*******************************************************************************\n\n",
OAES_VERSION );
// pad the key
for( _j = 0; _j < 32; _j++ )
_key_data[_j] = _j + 1;
if( argc < 2 )
{
usage( argv[0] );
return EXIT_FAILURE;
}
if( 0 == strcmp( argv[1], "enc" ) )
{
_op = 0;
_read_len = OAES_BUF_LEN_ENC;
}
else if( 0 == strcmp( argv[1], "dec" ) )
{
_op = 1;
_read_len = OAES_BUF_LEN_DEC;
}
else
{
fprintf(stderr, "Error: Unknown command '%s'.", argv[1]);
usage( argv[0] );
return EXIT_FAILURE;
}
for( _i = 2; _i < argc; _i++ )
{
int _found = 0;
if( 0 == strcmp( argv[_i], "--ecb" ) )
{
_found = 1;
_is_ecb = 1;
}
if( 0 == strcmp( argv[_i], "--key" ) )
{
_found = 1;
_i++; // key_data
if( _i >= argc )
{
fprintf(stderr, "Error: No value specified for '%s'.\n",
"--key");
usage( argv[0] );
return EXIT_FAILURE;
}
_key_data_len = strlen(argv[_i]);
if( 16 >= _key_data_len )
_key_data_len = 16;
else if( 24 >= _key_data_len )
_key_data_len = 24;
else
_key_data_len = 32;
memcpy(_key_data, argv[_i], __min(32, strlen(argv[_i])));
}
if( 0 == strcmp( argv[_i], "--in" ) )
{
_found = 1;
_i++; // path_in
if( _i >= argc )
{
fprintf(stderr, "Error: No value specified for '%s'.\n",
"--in");
usage( argv[0] );
return EXIT_FAILURE;
}
_file_in = argv[_i];
}
if( 0 == strcmp( argv[_i], "--out" ) )
{
_found = 1;
_i++; // path_out
if( _i >= argc )
{
fprintf(stderr, "Error: No value specified for '%s'.\n",
"--out");
usage( argv[0] );
return EXIT_FAILURE;
}
_file_out = argv[_i];
}
if( 0 == _found )
{
fprintf(stderr, "Error: Invalid option '%s'.\n", argv[_i]);
usage( argv[0] );
return EXIT_FAILURE;
}
}
if( 0 == _key_data_len )
{
fprintf(stderr, "Error: --key must be specified.\n");
return EXIT_FAILURE;
}
if( _file_in )
{
_f_in = fopen(_file_in, "rb");
if( NULL == _f_in )
{
fprintf(stderr,
"Error: Failed to open '-%s' for reading.\n", _file_in);
return EXIT_FAILURE;
}
}
else
{
if( setmode(fileno(stdin), 0x8000) < 0 )
fprintf(stderr,"Error: Failed in setmode().\n");
_f_in = stdin;
}
if( _file_out )
{
_f_out = fopen(_file_out, "wb");
if( NULL == _f_out )
{
fprintf(stderr,
"Error: Failed to open '-%s' for writing.\n", _file_out);
if( _file_in )
fclose(_f_in);
return EXIT_FAILURE;
}
}
else
{
if( setmode(fileno(stdout), 0x8000) < 0 )
fprintf(stderr, "Error: Failed in setmode().\n");
_f_out = stdout;
}
ctx = oaes_alloc();
if( NULL == ctx )
{
fprintf(stderr, "Error: Failed to initialize OAES.\n");
if( _file_in )
fclose(_f_in);
if( _file_out )
fclose(_f_out);
return EXIT_FAILURE;
}
if( _is_ecb )
if( OAES_RET_SUCCESS != oaes_set_option( ctx, OAES_OPTION_ECB, NULL ) )
fprintf(stderr, "Error: Failed to set OAES options.\n");
oaes_key_import_data( ctx, _key_data, _key_data_len );
while( _buf_in_len =
fread(_buf_in, sizeof(uint8_t), _read_len, _f_in) )
{
switch(_op)
{
case 0:
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
_buf_in, _buf_in_len, NULL, &_buf_out_len ) )
fprintf( stderr,
"Error: Failed to retrieve required buffer size for "
"encryption.\n" );
_buf_out = (uint8_t *) calloc( _buf_out_len, sizeof( char ) );
if( NULL == _buf_out )
{
fprintf(stderr, "Error: Failed to allocate memory.\n" );
if( _file_in )
fclose(_f_in);
if( _file_out )
fclose(_f_out);
return EXIT_FAILURE;
}
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
_buf_in, _buf_in_len, _buf_out, &_buf_out_len ) )
fprintf(stderr, "Error: Encryption failed.\n");
fwrite(_buf_out, sizeof(uint8_t), _buf_out_len, _f_out);
free(_buf_out);
break;
case 1:
if( OAES_RET_SUCCESS != oaes_decrypt( ctx,
_buf_in, _buf_in_len, NULL, &_buf_out_len ) )
fprintf( stderr,
"Error: Failed to retrieve required buffer size for "
"encryption.\n" );
_buf_out = (uint8_t *) calloc( _buf_out_len, sizeof( char ) );
if( NULL == _buf_out )
{
fprintf(stderr, "Error: Failed to allocate memory.\n" );
free( _buf_out );
if( _file_in )
fclose(_f_in);
if( _file_out )
fclose(_f_out);
return EXIT_FAILURE;
}
if( OAES_RET_SUCCESS != oaes_decrypt( ctx,
_buf_in, _buf_in_len, _buf_out, &_buf_out_len ) )
fprintf(stderr, "Error: Decryption failed.\n");
fwrite(_buf_out, sizeof(uint8_t), _buf_out_len, _f_out);
free(_buf_out);
break;
default:
break;
}
}
if( OAES_RET_SUCCESS != oaes_free( &ctx ) )
fprintf(stderr, "Error: Failed to uninitialize OAES.\n");
if( _file_in )
fclose(_f_in);
if( _file_out )
fclose(_f_out);
return (EXIT_SUCCESS);
}
File diff suppressed because it is too large Load Diff
+229
View File
@@ -0,0 +1,229 @@
/*
* ---------------------------------------------------------------------------
* OpenAES License
* ---------------------------------------------------------------------------
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "oaes_lib.h"
void usage(const char * exe_name)
{
if( NULL == exe_name )
return;
printf(
"Usage:\n"
"\t%s [-ecb] [-key < 128 | 192 | 256 >] <text>\n",
exe_name
);
}
int main(int argc, char** argv)
{
size_t _i;
OAES_CTX * ctx = NULL;
uint8_t *_encbuf, *_decbuf;
size_t _encbuf_len, _decbuf_len, _buf_len;
char *_buf;
short _is_ecb = 0;
char * _text = NULL;
int _key_len = 128;
if( argc < 2 )
{
usage( argv[0] );
return EXIT_FAILURE;
}
for( _i = 1; _i < argc; _i++ )
{
int _found = 0;
if( 0 == strcmp( argv[_i], "-ecb" ) )
{
_found = 1;
_is_ecb = 1;
}
if( 0 == strcmp( argv[_i], "-key" ) )
{
_found = 1;
_i++; // len
if( _i >= argc )
{
printf("Error: No value specified for '-%s'.\n",
"key");
usage( argv[0] );
return EXIT_FAILURE;
}
_key_len = atoi( argv[_i] );
switch( _key_len )
{
case 128:
case 192:
case 256:
break;
default:
printf("Error: Invalid value [%d] specified for '-%s'.\n",
_key_len, "key");
usage( argv[0] );
return EXIT_FAILURE;
}
}
if( 0 == _found )
{
if( _text )
{
printf("Error: Invalid option '%s'.\n", argv[_i]);
usage( argv[0] );
return EXIT_FAILURE;
}
else
{
_text = (char *) calloc(strlen( argv[_i] ) + 1, sizeof(char));
if( NULL == _text )
{
printf("Error: Failed to allocate memory.\n", argv[_i]);
return EXIT_FAILURE;
}
strcpy( _text, argv[_i] );
}
}
}
if( NULL == _text )
{
usage( argv[0] );
return EXIT_FAILURE;
}
oaes_sprintf( NULL, &_buf_len,
(const uint8_t *)_text, strlen( _text ) );
_buf = (char *) calloc(_buf_len, sizeof(char));
printf( "\n***** plaintext *****\n" );
if( _buf )
{
oaes_sprintf( _buf, &_buf_len,
(const uint8_t *)_text, strlen( _text ) );
printf( "%s", _buf );
}
printf( "\n**********************\n" );
free( _buf );
ctx = oaes_alloc();
if( NULL == ctx )
{
printf("Error: Failed to initialize OAES.\n");
free( _text );
return EXIT_FAILURE;
}
if( _is_ecb )
if( OAES_RET_SUCCESS != oaes_set_option( ctx, OAES_OPTION_ECB, NULL ) )
printf("Error: Failed to set OAES options.\n");
switch( _key_len )
{
case 128:
if( OAES_RET_SUCCESS != oaes_key_gen_128(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
case 192:
if( OAES_RET_SUCCESS != oaes_key_gen_192(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
case 256:
if( OAES_RET_SUCCESS != oaes_key_gen_256(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
default:
break;
}
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
(const uint8_t *)_text, strlen( _text ), NULL, &_encbuf_len ) )
printf("Error: Failed to retrieve required buffer size for encryption.\n");
_encbuf = (uint8_t *) calloc( _encbuf_len, sizeof(uint8_t) );
if( NULL == _encbuf )
{
printf( "Error: Failed to allocate memory.\n" );
free( _text );
return EXIT_FAILURE;
}
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
(const uint8_t *)_text, strlen( _text ), _encbuf, &_encbuf_len ) )
printf("Error: Encryption failed.\n");
if( OAES_RET_SUCCESS != oaes_decrypt( ctx,
_encbuf, _encbuf_len, NULL, &_decbuf_len ) )
printf("Error: Failed to retrieve required buffer size for encryption.\n");
_decbuf = (uint8_t *) calloc( _decbuf_len, sizeof(uint8_t) );
if( NULL == _decbuf )
{
printf( "Error: Failed to allocate memory.\n" );
free( _text );
free( _encbuf );
return EXIT_FAILURE;
}
if( OAES_RET_SUCCESS != oaes_decrypt( ctx,
_encbuf, _encbuf_len, _decbuf, &_decbuf_len ) )
printf("Error: Decryption failed.\n");
if( OAES_RET_SUCCESS != oaes_free( &ctx ) )
printf("Error: Failed to uninitialize OAES.\n");
oaes_sprintf( NULL, &_buf_len, _encbuf, _encbuf_len );
_buf = (char *) calloc(_buf_len, sizeof(char));
printf( "\n***** cyphertext *****\n" );
if( _buf )
{
oaes_sprintf( _buf, &_buf_len, _encbuf, _encbuf_len );
printf( "%s", _buf );
}
printf( "\n**********************\n" );
free( _buf );
oaes_sprintf( NULL, &_buf_len, _decbuf, _decbuf_len );
_buf = (char *) calloc(_buf_len, sizeof( char));
printf( "\n***** plaintext *****\n" );
if( _buf )
{
oaes_sprintf( _buf, &_buf_len, _decbuf, _decbuf_len );
printf( "%s", _buf );
}
printf( "\n**********************\n\n" );
free( _buf );
free( _encbuf );
free( _decbuf );
free( _text );
return (EXIT_SUCCESS);
}
+248
View File
@@ -0,0 +1,248 @@
/*
* ---------------------------------------------------------------------------
* OpenAES License
* ---------------------------------------------------------------------------
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include "oaes_lib.h"
/*
*
*/
int main(int argc, char** argv) {
OAES_CTX * ctx = NULL;
uint8_t * _buf;
size_t _data_len;
FILE * f = NULL;
OAES_RET _rc;
if( NULL == ( ctx = oaes_alloc() ) )
{
printf( "Error: Initialization failed.\n" );
return 1;
}
/* ************** Generate 128-bit key and export it **************
* ****************************************************************/
if( OAES_RET_SUCCESS != ( _rc = oaes_key_gen_128(ctx) ) )
{
printf( "Error: Failed to generate 128-bit key [%d].\n", _rc );
oaes_free(&ctx);
return 1;
}
if( OAES_RET_SUCCESS != ( _rc = oaes_key_export(ctx, NULL, &_data_len) ) )
{
printf( "Error: Failed to retrieve key length [%d].\n", _rc );
oaes_free(&ctx);
return 1;
}
_buf = (uint8_t *) calloc(_data_len, sizeof(uint8_t));
if( _buf )
{
if( OAES_RET_SUCCESS != ( _rc = oaes_key_export(ctx, _buf, &_data_len) ) )
{
printf("Error: Failed to export key [%d].\n", _rc);
free(_buf);
oaes_free(&ctx);
return 1;
}
f = fopen( "key_128", "wb" );
if( f )
{
fwrite(_buf, _data_len, sizeof(uint8_t), f);
fclose(f);
}
free(_buf);
}
/* ************** Generate 192-bit key and export it **************
* ****************************************************************/
if( OAES_RET_SUCCESS != ( _rc = oaes_key_gen_192(ctx) ) )
{
printf( "Error: Failed to generate 192-bit key [%d].\n", _rc );
oaes_free(&ctx);
return 1;
}
if( OAES_RET_SUCCESS != ( _rc = oaes_key_export(ctx, NULL, &_data_len) ) )
{
printf( "Error: Failed to retrieve key length [%d].\n", _rc );
oaes_free(&ctx);
return 1;
}
_buf = (uint8_t *) calloc(_data_len, sizeof(uint8_t));
if( _buf )
{
if( OAES_RET_SUCCESS != ( _rc = oaes_key_export(ctx, _buf, &_data_len) ) )
{
printf("Error: Failed to export key [%d].\n", _rc);
free(_buf);
oaes_free(&ctx);
return 1;
}
f = fopen("key_192", "wb");
if( f )
{
fwrite(_buf, _data_len, sizeof(uint8_t), f);
fclose(f);
}
free(_buf);
}
/* ************** Generate 256-bit key and export it **************
* ****************************************************************/
if( OAES_RET_SUCCESS != ( _rc = oaes_key_gen_256(ctx) ) )
{
printf("Error: Failed to generate 256-bit key [%d].\n", _rc);
oaes_free(&ctx);
return 1;
}
if( OAES_RET_SUCCESS != ( _rc = oaes_key_export(ctx, NULL, &_data_len) ) )
{
printf("Error: Failed to retrieve key length [%d].\n", _rc);
oaes_free(&ctx);
return 1;
}
_buf = (uint8_t *) calloc(_data_len, sizeof(uint8_t));
if( _buf )
{
if( OAES_RET_SUCCESS != ( _rc = oaes_key_export(ctx, _buf, &_data_len) ) )
{
printf("Error: Failed to export key [%d].\n", _rc);
free(_buf);
oaes_free(&ctx);
return 1;
}
f = fopen("key_256", "wb");
if( f )
{
fwrite(_buf, _data_len, sizeof(uint8_t), f);
fclose(f);
}
free(_buf);
}
/* ********************** Import 128-bit key **********************
* ****************************************************************/
f = fopen("key_128", "rb");
if( f )
{
fseek(f, 0L, SEEK_END);
_data_len = ftell(f);
fseek(f, 0L, SEEK_SET);
_buf = (uint8_t *) calloc(_data_len, sizeof(uint8_t));
if( _buf )
{
fread(_buf, _data_len, sizeof(uint8_t), f);
if( OAES_RET_SUCCESS !=
( _rc = oaes_key_import(ctx, _buf, _data_len) ) )
{
printf( "Error: Failed to import key [%d].\n", _rc );
free(_buf);
fclose(f);
oaes_free(&ctx);
return 1;
}
free(_buf);
}
fclose(f);
}
/* ********************** Import 192-bit key **********************
* ****************************************************************/
f = fopen("key_192", "rb");
if( f )
{
fseek(f, 0L, SEEK_END);
_data_len = ftell(f);
fseek(f, 0L, SEEK_SET);
_buf = (uint8_t *) calloc(_data_len, sizeof(uint8_t));
if( _buf )
{
fread(_buf, _data_len, sizeof(uint8_t), f);
if( OAES_RET_SUCCESS !=
( _rc = oaes_key_import(ctx, _buf, _data_len) ) )
{
printf("Error: Failed to import key [%d].\n", _rc);
free(_buf);
fclose(f);
oaes_free(&ctx);
return 1;
}
free(_buf);
}
fclose(f);
}
/* ********************** Import 256-bit key **********************
* ****************************************************************/
f = fopen("key_256", "rb");
if( f )
{
fseek(f, 0L, SEEK_END);
_data_len = ftell(f);
fseek(f, 0L, SEEK_SET);
_buf = (uint8_t *) calloc(_data_len, sizeof(uint8_t));
if( _buf )
{
fread(_buf, _data_len, sizeof(uint8_t), f);
if( OAES_RET_SUCCESS !=
( _rc = oaes_key_import(ctx, _buf, _data_len) ) )
{
printf("Error: Failed to import key [%d].\n", _rc);
free(_buf);
fclose(f);
oaes_free(&ctx);
return 1;
}
free(_buf);
}
fclose(f);
}
oaes_free(&ctx);
return (EXIT_SUCCESS);
}
+200
View File
@@ -0,0 +1,200 @@
/*
* ---------------------------------------------------------------------------
* OpenAES License
* ---------------------------------------------------------------------------
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "oaes_lib.h"
void usage(const char * exe_name)
{
if( NULL == exe_name )
return;
printf(
"Usage:\n"
"\t%s [-ecb] [-key < 128 | 192 | 256 >] [-data <data_len>]\n",
exe_name
);
}
/*
*
*/
int main(int argc, char** argv) {
size_t _i, _j;
time_t _time_start, _time_end;
OAES_CTX * ctx = NULL;
uint8_t *_encbuf, *_decbuf;
size_t _encbuf_len, _decbuf_len;
uint8_t _buf[1024 * 1024];
short _is_ecb = 0;
int _key_len = 128;
size_t _data_len = 64;
for( _i = 1; _i < argc; _i++ )
{
int _found = 0;
if( 0 == strcmp( argv[_i], "-ecb" ) )
{
_found = 1;
_is_ecb = 1;
}
if( 0 == strcmp( argv[_i], "-key" ) )
{
_found = 1;
_i++; // key_len
if( _i >= argc )
{
printf("Error: No value specified for '-%s'.\n",
"key");
usage( argv[0] );
return 1;
}
_key_len = atoi( argv[_i] );
switch( _key_len )
{
case 128:
case 192:
case 256:
break;
default:
printf("Error: Invalid value [%d] specified for '-%s'.\n",
_key_len, "key");
usage( argv[0] );
return 1;
}
}
if( 0 == strcmp( argv[_i], "-data" ) )
{
_found = 1;
_i++; // data_len
if( _i >= argc )
{
printf("Error: No value specified for '-%s'.\n",
"data");
usage( argv[0] );
return 1;
}
_data_len = atoi( argv[_i] );
}
if( 0 == _found )
{
printf("Error: Invalid option '%s'.\n", argv[_i]);
usage( argv[0] );
return 1;
}
}
// generate random test data
time( &_time_start );
srand( _time_start );
for( _i = 0; _i < 1024 * 1024; _i++ )
_buf[_i] = rand();
ctx = oaes_alloc();
if( NULL == ctx )
{
printf("Error: Failed to initialize OAES.\n");
return EXIT_FAILURE;
}
if( _is_ecb )
if( OAES_RET_SUCCESS != oaes_set_option( ctx, OAES_OPTION_ECB, NULL ) )
printf("Error: Failed to set OAES options.\n");
switch( _key_len )
{
case 128:
if( OAES_RET_SUCCESS != oaes_key_gen_128(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
case 192:
if( OAES_RET_SUCCESS != oaes_key_gen_192(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
case 256:
if( OAES_RET_SUCCESS != oaes_key_gen_256(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
default:
break;
}
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
(const uint8_t *)_buf, 1024 * 1024, NULL, &_encbuf_len ) )
printf("Error: Failed to retrieve required buffer size for encryption.\n");
_encbuf = (uint8_t *) calloc( _encbuf_len, sizeof( char ) );
if( NULL == _encbuf )
{
printf( "Error: Failed to allocate memory.\n" );
return EXIT_FAILURE;
}
if( OAES_RET_SUCCESS != oaes_decrypt( ctx,
_encbuf, _encbuf_len, NULL, &_decbuf_len ) )
printf("Error: Failed to retrieve required buffer size for encryption.\n");
_decbuf = (uint8_t *) calloc( _decbuf_len, sizeof( char ) );
if( NULL == _decbuf )
{
free( _encbuf );
printf( "Error: Failed to allocate memory.\n" );
return EXIT_FAILURE;
}
time( &_time_start );
for( _i = 0; _i < _data_len; _i++ )
{
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
(const uint8_t *)_buf, 1024 * 1024, _encbuf, &_encbuf_len ) )
printf("Error: Encryption failed.\n");
if( OAES_RET_SUCCESS != oaes_decrypt( ctx,
_encbuf, _encbuf_len, _decbuf, &_decbuf_len ) )
printf("Error: Decryption failed.\n");
}
time( &_time_end );
printf( "Test encrypt and decrypt:\n\ttime: %lld seconds\n\tdata: %ld MB"
"\n\tkey: %d bits\n\tmode: %s\n",
_time_end - _time_start, _data_len,
_key_len, _is_ecb? "EBC" : "CBC" );
free( _encbuf );
free( _decbuf );
if( OAES_RET_SUCCESS != oaes_free( &ctx ) )
printf("Error: Failed to uninitialize OAES.\n");
return (EXIT_SUCCESS);
}
+405
View File
@@ -0,0 +1,405 @@
/*
* ---------------------------------------------------------------------------
* OpenAES License
* ---------------------------------------------------------------------------
* Copyright (c) 2012, Nabil S. Al Ramli, www.nalramli.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* ---------------------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define OAES_DEBUG 1
#include "oaes_lib.h"
static int _is_step = 1;
static int step_cb(
const uint8_t state[OAES_BLOCK_SIZE],
const char * step_name,
int step_count,
void * user_data )
{
size_t _buf_len;
char * _buf;
if( NULL == state )
return 1;
oaes_sprintf( NULL, &_buf_len, state, OAES_BLOCK_SIZE );
_buf = (char *) calloc( _buf_len, sizeof( char ) );
if( _buf )
{
oaes_sprintf( _buf, &_buf_len, state, OAES_BLOCK_SIZE );
printf( "round[%2d].%-7s --> %s", step_count, step_name, _buf );
free( _buf );
}
if( 1 == _is_step && '\n' != getchar( ) )
_is_step = 0;
return 0;
}
static int to_binary(uint8_t * buf, size_t * buf_len, const char * data)
{
size_t _i, _buf_len_in;
if( NULL == buf_len )
return 1;
if( NULL == data )
return 1;
_buf_len_in = *buf_len;
*buf_len = strlen( data ) / 2;
if( NULL == buf )
return 0;
if( *buf_len > _buf_len_in )
return 1;
memset( buf, 0, strlen( data ) / 2 );
// lookup ascii table
for( _i = 0; _i < strlen( data ); _i++ )
{
// 0-9
if( data[_i] >= 0x30 && data[_i] <= 0x39 )
buf[_i / 2] += ( data[_i] - 0x30 ) << ( 4 * ( ( _i + 1 ) % 2 ) ) ;
// a-f
else if( data[_i] >= 0x41 && data[_i] <= 0x46 )
buf[_i / 2] += ( data[_i] - 0x37 ) << ( 4 * ( ( _i + 1 ) % 2 ) );
// A-F
else if( data[_i] >= 0x61 && data[_i] <= 0x66 )
buf[_i / 2] += ( data[_i] - 0x57 ) << ( 4 * ( ( _i + 1 ) % 2 ) );
// invalid character
else
return 1;
}
return 0;
}
static void usage(const char * exe_name)
{
if( NULL == exe_name )
return;
printf(
"Usage:\n"
" %s [-step] [-ecb] [[-key < 128 | 192 | 256 | key_data >] [-bin] <text>\n",
exe_name
);
}
int main(int argc, char** argv)
{
size_t _i;
OAES_CTX * ctx = NULL;
uint8_t *_encbuf, *_decbuf, *_key_data = NULL, *_bin_data = NULL;
size_t _encbuf_len, _decbuf_len, _buf_len;
size_t _key_data_len = 0, _bin_data_len = 0;
char *_buf;
short _is_ecb = 0, _is_bin = 0;
char * _text = NULL, * _key_text = NULL;
int _key_len = 128;
if( argc < 2 )
{
usage( argv[0] );
return EXIT_FAILURE;
}
for( _i = 1; _i < argc; _i++ )
{
int _found = 0;
if( 0 == strcmp( argv[_i], "-nostep" ) )
{
_found = 1;
_is_step = 0;
}
if( 0 == strcmp( argv[_i], "-ecb" ) )
{
_found = 1;
_is_ecb = 1;
}
if( 0 == strcmp( argv[_i], "-bin" ) )
{
_found = 1;
_is_bin = 1;
}
if( 0 == strcmp( argv[_i], "-key" ) )
{
_found = 1;
_i++; // len
if( _i >= argc )
{
printf("Error: No value specified for '-%s'.\n",
"key");
usage( argv[0] );
return EXIT_FAILURE;
}
_key_len = atoi( argv[_i] );
switch( _key_len )
{
case 128:
case 192:
case 256:
break;
default:
_key_text = argv[_i];
if( to_binary( NULL, &_key_data_len, _key_text ) )
{
printf( "Error: Invalid value [%s] specified for '-%s'.\n",
argv[_i], "key" );
return EXIT_FAILURE;
}
switch( _key_data_len )
{
case 16:
case 24:
case 32:
break;
default:
printf("Error: key_data [%s] specified for '-%s' has an invalid "
"size.\n", argv[_i], "key");
usage( argv[0] );
return EXIT_FAILURE;
}
}
}
if( 0 == _found )
{
if( _text )
{
printf("Error: Invalid option '%s'.\n", argv[_i]);
usage( argv[0] );
return EXIT_FAILURE;
}
else
{
_text = argv[_i];
if( _is_bin && to_binary( NULL, &_bin_data_len, _text ) )
{
printf( "Error: Invalid value [%s] specified for '-%s'.\n",
argv[_i], "bin" );
return EXIT_FAILURE;
}
}
}
}
if( NULL == _text )
{
usage( argv[0] );
return EXIT_FAILURE;
}
if( _is_step )
printf( "\nEnabling step mode, press Return to step.\n\n" );
if( _is_bin )
{
_bin_data = (uint8_t *) calloc(_bin_data_len, sizeof(uint8_t));
if( NULL == _bin_data )
{
printf( "Error: Failed to allocate memory.\n" );
return EXIT_FAILURE;
}
if( to_binary( _bin_data, &_bin_data_len, _text ) )
{
printf( "Error: Could not load data [%s].\n", _text);
free( _bin_data );
return EXIT_FAILURE;
}
}
else
{
oaes_sprintf( NULL, &_buf_len, (const uint8_t *)_text, strlen(_text));
_buf = (char *) calloc(_buf_len, sizeof(char));
printf( "\n***** plaintext *****\n" );
if( _buf )
{
oaes_sprintf( _buf, &_buf_len,
(const uint8_t *)_text, strlen( _text ) );
printf( "%s", _buf );
}
printf( "\n**********************\n" );
free( _buf );
}
ctx = oaes_alloc();
if( NULL == ctx )
{
printf("Error: Failed to initialize OAES.\n");
if( _bin_data )
free( _bin_data );
return EXIT_FAILURE;
}
if( OAES_RET_SUCCESS != oaes_set_option( ctx, OAES_OPTION_STEP_ON, step_cb ) )
printf("Error: Failed to set OAES options.\n");
if( _is_ecb )
if( OAES_RET_SUCCESS != oaes_set_option( ctx, OAES_OPTION_ECB, NULL ) )
printf("Error: Failed to set OAES options.\n");
if( _key_text )
{
_key_data = (uint8_t *) calloc(_key_data_len, sizeof(uint8_t));
if( NULL == _key_data )
{
printf( "Error: Failed to allocate memory.\n" );
if( _bin_data )
free( _bin_data );
return EXIT_FAILURE;
}
if( to_binary( _key_data, &_key_data_len, _key_text ) )
{
printf( "Error: Could not load key [%s].\n", _key_text);
free( _key_data );
return EXIT_FAILURE;
}
oaes_key_import_data( ctx, _key_data, _key_data_len );
}
else
switch( _key_len )
{
case 128:
if( OAES_RET_SUCCESS != oaes_key_gen_128(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
case 192:
if( OAES_RET_SUCCESS != oaes_key_gen_192(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
case 256:
if( OAES_RET_SUCCESS != oaes_key_gen_256(ctx) )
printf("Error: Failed to generate OAES %d bit key.\n", _key_len);
break;
default:
break;
}
if( _bin_data )
{
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
_bin_data, _bin_data_len, NULL, &_encbuf_len ) )
printf("Error: Failed to retrieve required buffer size for encryption.\n");
_encbuf = (uint8_t *) calloc(_encbuf_len, sizeof(uint8_t));
if( NULL == _encbuf )
{
printf( "Error: Failed to allocate memory.\n" );
if( _key_data )
free( _key_data );
free( _bin_data );
return EXIT_FAILURE;
}
printf( "\n" );
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
_bin_data, _bin_data_len, _encbuf, &_encbuf_len ) )
printf("Error: Encryption failed.\n");
printf( "\n**********************\n\n" );
}
else
{
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
(const uint8_t *)_text, strlen( _text ), NULL, &_encbuf_len ) )
printf("Error: Failed to retrieve required buffer size for encryption.\n");
_encbuf = (uint8_t *) calloc(_encbuf_len, sizeof(uint8_t));
if( NULL == _encbuf )
{
printf( "Error: Failed to allocate memory.\n" );
if( _key_data )
free( _key_data );
return EXIT_FAILURE;
}
printf( "\n" );
if( OAES_RET_SUCCESS != oaes_encrypt( ctx,
(const uint8_t *)_text, strlen( _text ), _encbuf, &_encbuf_len ) )
printf("Error: Encryption failed.\n");
printf( "\n**********************\n\n" );
}
if( OAES_RET_SUCCESS != oaes_decrypt( ctx,
_encbuf, _encbuf_len, NULL, &_decbuf_len ) )
printf("Error: Failed to retrieve required buffer size for encryption.\n");
_decbuf = (uint8_t *) calloc(_decbuf_len, sizeof(uint8_t));
if( NULL == _decbuf )
{
printf( "Error: Failed to allocate memory.\n" );
if( _key_data )
free( _key_data );
if( _bin_data )
free( _bin_data );
free( _encbuf );
return EXIT_FAILURE;
}
if( OAES_RET_SUCCESS != oaes_decrypt( ctx,
_encbuf, _encbuf_len, _decbuf, &_decbuf_len ) )
printf("Error: Decryption failed.\n");
if( OAES_RET_SUCCESS != oaes_free( &ctx ) )
printf("Error: Failed to uninitialize OAES.\n");
oaes_sprintf( NULL, &_buf_len, _encbuf, _encbuf_len );
_buf = (char *) calloc(_buf_len, sizeof(char));
printf( "\n***** cyphertext *****\n" );
if( _buf )
{
oaes_sprintf( _buf, &_buf_len, _encbuf, _encbuf_len );
printf( "%s", _buf );
}
printf( "\n**********************\n" );
free( _buf );
oaes_sprintf( NULL, &_buf_len, _decbuf, _decbuf_len );
_buf = (char *) calloc(_buf_len, sizeof(char));
printf( "\n***** plaintext *****\n" );
if( _buf )
{
oaes_sprintf( _buf, &_buf_len, _decbuf, _decbuf_len );
printf( "%s", _buf );
}
printf( "\n**********************\n\n" );
free( _buf );
free( _encbuf );
free( _decbuf );
if( _key_data )
free( _key_data );
if( _bin_data )
free( _bin_data );
return (EXIT_SUCCESS);
}
+6 -1
View File
@@ -215,6 +215,8 @@ int OpenRecoveryScript::run_script_file(void) {
PartitionManager.Set_Restore_Files(folder_path);
string Partition_List;
int is_encrypted = 0;
DataManager::GetValue("tw_restore_encrypted", is_encrypted);
DataManager::GetValue("tw_restore_list", Partition_List);
if (strlen(partitions) != 0) {
string Restore_List;
@@ -260,7 +262,10 @@ int OpenRecoveryScript::run_script_file(void) {
} else {
DataManager::SetValue("tw_restore_selected", Partition_List);
}
if (!PartitionManager.Run_Restore(folder_path))
if (is_encrypted) {
LOGERR("Unable to use OpenRecoveryScript to restore an encrypted backup.\n");
ret_val = 1;
} else if (!PartitionManager.Run_Restore(folder_path))
ret_val = 1;
else
gui_print("Restore complete!\n");
+49 -18
View File
@@ -87,6 +87,8 @@ TWPartition::TWPartition(void) {
Backup_FileName = "";
MTD_Name = "";
Backup_Method = NONE;
Can_Encrypt_Backup = false;
Use_Userdata_Encryption = false;
Has_Data_Media = false;
Has_Android_Secure = false;
Is_Storage = false;
@@ -210,6 +212,8 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) {
Wipe_Available_in_GUI = true;
Wipe_During_Factory_Reset = true;
Can_Be_Backed_Up = true;
Can_Encrypt_Backup = true;
Use_Userdata_Encryption = true;
#ifdef RECOVERY_SDCARD_ON_DATA
Storage_Name = "Internal Storage";
Has_Data_Media = true;
@@ -287,6 +291,8 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) {
SubPartition_Of = "/data";
DataManager::SetValue(TW_HAS_DATADATA, 1);
Can_Be_Backed_Up = true;
Can_Encrypt_Backup = true;
Use_Userdata_Encryption = false; // This whole partition should be encrypted
} else if (Mount_Point == "/sd-ext") {
Wipe_During_Factory_Reset = true;
Display_Name = "SD-Ext";
@@ -295,6 +301,8 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) {
Wipe_Available_in_GUI = true;
Removable = true;
Can_Be_Backed_Up = true;
Can_Encrypt_Backup = true;
Use_Userdata_Encryption = true;
} else if (Mount_Point == "/boot") {
Display_Name = "Boot";
Backup_Display_Name = Display_Name;
@@ -445,6 +453,20 @@ bool TWPartition::Process_Flags(string Flags, bool Display_Error) {
} else if (ptr_len > 7 && strncmp(ptr, "length=", 7) == 0) {
ptr += 7;
Length = atoi(ptr);
} else if (ptr_len > 17 && strncmp(ptr, "canencryptbackup=", 17) == 0) {
ptr += 17;
if (*ptr == '1' || *ptr == 'y' || *ptr == 'Y')
Can_Encrypt_Backup = true;
else
Can_Encrypt_Backup = false;
} else if (ptr_len > 21 && strncmp(ptr, "userdataencryptbackup=", 21) == 0) {
ptr += 21;
if (*ptr == '1' || *ptr == 'y' || *ptr == 'Y') {
Can_Encrypt_Backup = true;
Use_Userdata_Encryption = true;
} else {
Use_Userdata_Encryption = false;
}
} else {
if (Display_Error)
LOGERR("Unhandled flag: '%s'\n", ptr);
@@ -1046,8 +1068,8 @@ bool TWPartition::Check_MD5(string restore_folder) {
return false;
}
md5sum.setfn(split_filename);
while (index < 1000 && TWFunc::Path_Exists(split_filename)) {
if (md5sum.verify_md5digest() != 0) {
while (index < 1000) {
if (TWFunc::Path_Exists(split_filename) && md5sum.verify_md5digest() != 0) {
LOGERR("MD5 failed to match on '%s'.\n", split_filename);
return false;
}
@@ -1370,7 +1392,7 @@ bool TWPartition::Wipe_Data_Without_Wiping_Media() {
bool TWPartition::Backup_Tar(string backup_folder) {
char back_name[255], split_index[5];
string Full_FileName, Split_FileName, Tar_Args, Command;
int use_compression, index, backup_count;
int use_compression, use_encryption = 0, index, backup_count;
struct stat st;
unsigned long long total_bsize = 0, file_size;
twrpTar tar;
@@ -1383,11 +1405,23 @@ bool TWPartition::Backup_Tar(string backup_folder) {
gui_print("Backing up %s...\n", Backup_Display_Name.c_str());
DataManager::GetValue(TW_USE_COMPRESSION_VAR, use_compression);
tar.use_compression = use_compression;
#ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS
DataManager::GetValue("tw_encrypt_backup", use_encryption);
if (use_encryption && Can_Encrypt_Backup) {
tar.use_encryption = use_encryption;
if (Use_Userdata_Encryption)
tar.userdata_encryption = use_encryption;
} else {
use_encryption = false;
}
#endif
sprintf(back_name, "%s.%s.win", Backup_Name.c_str(), Current_File_System.c_str());
Backup_FileName = back_name;
Full_FileName = backup_folder + "/" + Backup_FileName;
if (Backup_Size > MAX_ARCHIVE_SIZE) {
tar.has_data_media = Has_Data_Media;
if (!use_encryption && Backup_Size > MAX_ARCHIVE_SIZE) {
// This backup needs to be split into multiple archives
gui_print("Breaking backup file into multiple archives...\n");
sprintf(back_name, "%s", Backup_Path.c_str());
@@ -1401,20 +1435,16 @@ bool TWPartition::Backup_Tar(string backup_folder) {
return true;
} else {
Full_FileName = backup_folder + "/" + Backup_FileName;
if (use_compression) {
tar.setdir(Backup_Path);
tar.setfn(Full_FileName);
if (tar.createTarGZFork() != 0)
return -1;
tar.setdir(Backup_Path);
tar.setfn(Full_FileName);
if (tar.createTarFork() != 0)
return false;
if (use_compression && !use_encryption) {
string gzname = Full_FileName + ".gz";
rename(gzname.c_str(), Full_FileName.c_str());
}
else {
tar.setdir(Backup_Path);
tar.setfn(Full_FileName);
if (tar.createTarFork() != 0)
return -1;
}
if (use_encryption)
Full_FileName += "000";
if (TWFunc::Get_File_Size(Full_FileName) == 0) {
LOGERR("Backup file size for '%s' is 0 bytes.\n", Full_FileName.c_str());
return false;
@@ -1493,7 +1523,7 @@ bool TWPartition::Restore_Tar(string restore_folder, string Restore_File_System)
return false;
Full_FileName = restore_folder + "/" + Backup_FileName;
if (!TWFunc::Path_Exists(Full_FileName)) {
/*if (!TWFunc::Path_Exists(Full_FileName)) {
if (!TWFunc::Path_Exists(Full_FileName)) {
// Backup is multiple archives
LOGINFO("Backup is multiple archives.\n");
@@ -1516,13 +1546,14 @@ bool TWPartition::Restore_Tar(string restore_folder, string Restore_File_System)
return false;
}
}
} else {
} else {*/
twrpTar tar;
tar.setdir(Backup_Path);
tar.setfn(Full_FileName);
tar.backup_name = Backup_Name;
if (tar.extractTarFork() != 0)
return false;
}
//}
return true;
}
+30 -12
View File
@@ -184,6 +184,10 @@ void TWPartitionManager::Output_Partition(TWPartition* Part) {
printf("Is_Decrypted ");
if (Part->Has_Data_Media)
printf("Has_Data_Media ");
if (Part->Can_Encrypt_Backup)
printf("Can_Encrypt_Backup ");
if (Part->Use_Userdata_Encryption)
printf("Use_Userdata_Encryption ");
if (Part->Has_Android_Secure)
printf("Has_Android_Secure ");
if (Part->Is_Storage)
@@ -532,18 +536,20 @@ bool TWPartitionManager::Make_MD5(bool generate_md5, string Backup_Folder, strin
string strfn;
sprintf(filename, "%s%03i", Full_File.c_str(), index);
strfn = filename;
while (TWFunc::Path_Exists(filename) == true) {
while (index < 1000) {
md5sum.setfn(filename);
if (md5sum.computeMD5() == 0) {
if (md5sum.write_md5digest() != 0)
{
gui_print(" * MD5 Error.\n");
if (TWFunc::Path_Exists(filename)) {
if (md5sum.computeMD5() == 0) {
if (md5sum.write_md5digest() != 0)
{
gui_print(" * MD5 Error.\n");
return false;
}
} else {
gui_print(" * Error computing MD5.\n");
return false;
}
}
else {
return -1;
}
index++;
sprintf(filename, "%s%03i", Full_File.c_str(), index);
strfn = filename;
@@ -902,7 +908,9 @@ int TWPartitionManager::Run_Restore(string Restore_Name) {
void TWPartitionManager::Set_Restore_Files(string Restore_Name) {
// Start with the default values
string Restore_List;
bool get_date = true;
bool get_date = true, check_encryption = true;
DataManager::SetValue("tw_restore_encrypted", 0);
DIR* d;
d = opendir(Restore_Name.c_str());
@@ -956,10 +964,20 @@ void TWPartitionManager::Set_Restore_Files(string Restore_Name) {
extn = ptr;
}
if (strcmp(fstype, "log") == 0) continue;
if (fstype == NULL || extn == NULL || strcmp(fstype, "log") == 0) continue;
int extnlength = strlen(extn);
if (extn == NULL || (extnlength != 3 && extnlength != 6)) continue;
if (extnlength == 3 && strncmp(extn, "win", 3) != 0) continue;
if (extnlength != 3 && extnlength != 6) continue;
if (extnlength >= 3 && strncmp(extn, "win", 3) != 0) continue;
//if (extnlength == 6 && strncmp(extn, "win000", 6) != 0) continue;
if (check_encryption) {
string filename = Restore_Name + "/";
filename += de->d_name;
if (TWFunc::Get_File_Type(filename) == 2) {
LOGINFO("'%s' is encrypted\n", filename.c_str());
DataManager::SetValue("tw_restore_encrypted", 1);
}
}
if (extnlength == 6 && strncmp(extn, "win000", 6) != 0) continue;
TWPartition* Part = Find_Partition_By_Path(label);
+2
View File
@@ -110,6 +110,8 @@ protected:
string Storage_Name; // Name displayed in the partition list for storage selection
string Backup_FileName; // Actual backup filename
Backup_Method_enum Backup_Method; // Method used for backup
bool Can_Encrypt_Backup; // Indicates if this item can be encrypted during backup
bool Use_Userdata_Encryption; // Indicates if we will use userdata encryption splitting on an encrypted backup
bool Has_Data_Media; // Indicates presence of /data/media, may affect wiping and backup methods
bool Has_Android_Secure; // Indicates the presence of .android_secure on this partition
bool Is_Storage; // Indicates if this partition is used for storage for backup, restore, and installing zips
+15
View File
@@ -79,6 +79,10 @@ endif
ifneq ($(wildcard system/core/libsparse/Android.mk),)
RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libsparse.so
endif
ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
RELINK_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/openaes
RELINK_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libopenaes.so
endif
TWRP_AUTOGEN := $(intermediates)/teamwin
@@ -121,6 +125,17 @@ ifeq ($(BOARD_HAS_NO_REAL_SDCARD),)
include $(BUILD_PREBUILT)
endif
# copy license file for OpenAES
ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
include $(CLEAR_VARS)
LOCAL_MODULE := ../openaes/LICENSE
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/license/openaes
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
endif
ifeq ($(TW_INCLUDE_DUMLOCK), true)
#htcdumlock for /system for dumlock
include $(CLEAR_VARS)
+6 -1
View File
@@ -29,11 +29,13 @@ int flush = 0, eot_count = -1;
unsigned char *write_buffer;
unsigned buffer_size = 4096;
unsigned buffer_loc = 0;
int buffer_status = 0;
void reinit_libtar_buffer(void) {
flush = 0;
eot_count = -1;
buffer_loc = 0;
buffer_status = 1;
}
void init_libtar_buffer(unsigned new_buff_size) {
@@ -45,7 +47,9 @@ void init_libtar_buffer(unsigned new_buff_size) {
}
void free_libtar_buffer(void) {
free(write_buffer);
if (buffer_status > 0)
free(write_buffer);
buffer_status = 0;
}
ssize_t write_libtar_buffer(int fd, const void *buffer, size_t size) {
@@ -89,4 +93,5 @@ ssize_t write_libtar_buffer(int fd, const void *buffer, size_t size) {
void flush_libtar_buffer(int fd) {
eot_count = 0;
buffer_status = 2;
}
+199
View File
@@ -12,17 +12,23 @@
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <sys/vfs.h>
#include <sys/types.h>
#include <sys/wait.h>
#ifdef ANDROID_RB_POWEROFF
#include "cutils/android_reboot.h"
#endif
#include <iostream>
#include <fstream>
#include <sstream>
#include "twrp-functions.hpp"
#include "partitions.hpp"
#include "twcommon.h"
#include "data.hpp"
#include "variables.h"
#include "bootloader.h"
#ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS
#include "openaes/inc/oaes_lib.h"
#endif
extern "C" {
#include "libcrecovery/common.h"
@@ -455,6 +461,30 @@ int TWFunc::write_file(string fn, string& line) {
return -1;
}
vector<string> TWFunc::split_string(const string &in, char del, bool skip_empty) {
vector<string> res;
if (in.empty() || del == '\0')
return res;
string field;
istringstream f(in);
if (del == '\n') {
while(getline(f, field)) {
if (field.empty() && skip_empty)
continue;
res.push_back(field);
}
} else {
while(getline(f, field, del)) {
if (field.empty() && skip_empty)
continue;
res.push_back(field);
}
}
return res;
}
timespec TWFunc::timespec_diff(timespec& start, timespec& end)
{
timespec temp;
@@ -678,3 +708,172 @@ bool TWFunc::Install_SuperSU(void) {
return false;
return true;
}
int TWFunc::Get_File_Type(string fn) {
string::size_type i = 0;
int firstbyte = 0, secondbyte = 0;
char header[3];
ifstream f;
f.open(fn.c_str(), ios::in | ios::binary);
f.get(header, 3);
f.close();
firstbyte = header[i] & 0xff;
secondbyte = header[++i] & 0xff;
if (firstbyte == 0x1f && secondbyte == 0x8b) {
return 1; // Compressed
} else if (firstbyte == 0x4f && secondbyte == 0x41) {
return 2; // Encrypted
} else {
return 0; // Unknown
}
return 0;
}
int TWFunc::Try_Decrypting_File(string fn, string password) {
#ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS
OAES_CTX * ctx = NULL;
uint8_t _key_data[32] = "";
FILE *f;
uint8_t buffer[4096];
uint8_t *buffer_out = NULL;
uint8_t *ptr = NULL;
size_t read_len = 0, out_len = 0;
int firstbyte = 0, secondbyte = 0, key_len;
size_t _j = 0;
size_t _key_data_len = 0;
// mostly kanged from OpenAES oaes.c
for( _j = 0; _j < 32; _j++ )
_key_data[_j] = _j + 1;
_key_data_len = password.size();
if( 16 >= _key_data_len )
_key_data_len = 16;
else if( 24 >= _key_data_len )
_key_data_len = 24;
else
_key_data_len = 32;
memcpy(_key_data, password.c_str(), password.size());
ctx = oaes_alloc();
if (ctx == NULL) {
LOGERR("Failed to allocate OAES\n");
return -1;
}
oaes_key_import_data(ctx, _key_data, _key_data_len);
f = fopen(fn.c_str(), "rb");
if (f == NULL) {
LOGERR("Failed to open '%s' to try decrypt\n", fn.c_str());
return -1;
}
read_len = fread(buffer, sizeof(uint8_t), 4096, f);
if (read_len <= 0) {
LOGERR("Read size during try decrypt failed\n");
fclose(f);
return -1;
}
if (oaes_decrypt(ctx, buffer, read_len, NULL, &out_len) != OAES_RET_SUCCESS) {
LOGERR("Error: Failed to retrieve required buffer size for trying decryption.\n");
fclose(f);
return -1;
}
buffer_out = (uint8_t *) calloc(out_len, sizeof(char));
if (buffer_out == NULL) {
LOGERR("Failed to allocate output buffer for try decrypt.\n");
fclose(f);
return -1;
}
if (oaes_decrypt(ctx, buffer, read_len, buffer_out, &out_len) != OAES_RET_SUCCESS) {
LOGERR("Failed to decrypt file '%s'\n", fn.c_str());
fclose(f);
free(buffer_out);
return 0;
}
fclose(f);
if (out_len < 2) {
LOGINFO("Successfully decrypted '%s' but read length %i too small.\n", fn.c_str(), out_len);
free(buffer_out);
return 1; // Decrypted successfully
}
ptr = buffer_out;
firstbyte = *ptr & 0xff;
ptr++;
secondbyte = *ptr & 0xff;
if (firstbyte == 0x1f && secondbyte == 0x8b) {
LOGINFO("Successfully decrypted '%s' and file is compressed.\n", fn.c_str());
free(buffer_out);
return 3; // Compressed
}
if (out_len >= 262) {
ptr = buffer_out + 257;
if (strncmp((char*)ptr, "ustar", 5) == 0) {
LOGINFO("Successfully decrypted '%s' and file is tar format.\n", fn.c_str());
free(buffer_out);
return 2; // Tar
}
}
free(buffer_out);
LOGINFO("No errors decrypting '%s' but no known file format.\n", fn.c_str());
return 1; // Decrypted successfully
#else
LOGERR("Encrypted backup support not included.\n");
return -1;
#endif
}
bool TWFunc::Try_Decrypting_Backup(string Restore_Path, string Password) {
DIR* d;
string Filename;
Restore_Path += "/";
d = opendir(Restore_Path.c_str());
if (d == NULL) {
LOGERR("Error opening '%s'\n", Restore_Path.c_str());
return false;
}
struct dirent* de;
while ((de = readdir(d)) != NULL) {
Filename = Restore_Path;
Filename += de->d_name;
if (TWFunc::Get_File_Type(Filename) == 2) {
if (TWFunc::Try_Decrypting_File(Filename, Password) < 2) {
DataManager::SetValue("tw_restore_password", ""); // Clear the bad password
DataManager::SetValue("tw_restore_display", ""); // Also clear the display mask
closedir(d);
return false;
}
}
}
closedir(d);
return true;
}
int TWFunc::Wait_For_Child(pid_t pid, int *status, string Child_Name) {
pid_t rc_pid;
rc_pid = waitpid(pid, status, 0);
if (rc_pid > 0) {
if (WEXITSTATUS(*status) == 0)
LOGINFO("%s process ended with RC=%d\n", Child_Name.c_str(), WEXITSTATUS(*status)); // Success
else if (WIFSIGNALED(*status)) {
LOGINFO("%s process ended with signal: %d\n", Child_Name.c_str(), WTERMSIG(*status)); // Seg fault or some other non-graceful termination
return -1;
} else if (WEXITSTATUS(*status) != 0) {
LOGINFO("%s process ended with ERROR=%d\n", Child_Name.c_str(), WEXITSTATUS(*status)); // Graceful exit, but there was an error
return -1;
}
} else { // no PID returned
if (errno == ECHILD)
LOGINFO("%s no child process exist\n", Child_Name.c_str());
else {
LOGINFO("%s Unexpected error\n", Child_Name.c_str());
return -1;
}
}
return 0;
}
+5
View File
@@ -50,6 +50,11 @@ public:
static bool Fix_su_Perms(void); // sets proper permissions for su binaries and superuser apk
static int tw_chmod(string fn, string mode); // chmod function that converts a 4 char string into st_mode automatically
static bool Install_SuperSU(void); // Installs su binary and apk and sets proper permissions
static vector<string> split_string(const string &in, char del, bool skip_empty);
static int Get_File_Type(string fn); // Determines file type, 0 for unknown, 1 for gzip, 2 for OAES encrypted
static int Try_Decrypting_File(string fn, string password); // -1 for some error, 0 for failed to decrypt, 1 for decrypted, 3 for decrypted and found gzip format
static bool Try_Decrypting_Backup(string Restore_Path, string Password); // true for success, false for failed to decrypt
static int Wait_For_Child(pid_t pid, int *status, string Child_Name); // Waits for pid to exit and checks exit status
private:
static void Copy_Log(string Source, string Destination);
+940 -225
View File
File diff suppressed because it is too large Load Diff
+46 -17
View File
@@ -30,24 +30,43 @@ extern "C" {
using namespace std;
struct TarListStruct {
std::string fn;
unsigned thread_id;
};
struct thread_data_struct {
std::vector<TarListStruct> *TarList;
unsigned thread_id;
};
class twrpTar {
public:
int extract();
int compress(string fn);
int uncompress(string fn);
int addFilesToExistingTar(vector <string> files, string tarFile);
int createTar();
int addFile(string fn, bool include_root);
int entryExists(string entry);
int closeTar(bool gzip);
int createTarGZFork();
twrpTar();
virtual ~twrpTar();
int createTarFork();
int extractTarFork();
int splitArchiveFork();
void setfn(string fn);
void setdir(string dir);
void setexcl(string exclude);
void setfn(string fn);
void setdir(string dir);
unsigned long long uncompressedSize();
public:
int use_encryption;
int userdata_encryption;
int use_compression;
int split_archives;
int has_data_media;
string backup_name;
private:
int createTGZ();
int extract();
int addFilesToExistingTar(vector <string> files, string tarFile);
int createTar();
int addFile(string fn, bool include_root);
int entryExists(string entry);
int closeTar();
int create();
int Split_Archive();
int removeEOT(string tarFile);
@@ -55,16 +74,26 @@ class twrpTar {
int tarDirs(bool include_root);
int Generate_Multiple_Archives(string Path);
string Strip_Root_Dir(string Path);
int extractTGZ();
int openTar(bool gzip);
int has_data_media;
int openTar();
int Archive_File_Count;
int Archive_Current_Type;
unsigned long long Archive_Current_Size;
int getArchiveType(); // 1 for compressed - 0 for uncompressed
TAR *t;
FILE* p;
int fd;
pid_t pigz_pid;
pid_t oaes_pid;
string tardir;
string tarfn;
string basefn;
string tarexclude;
vector<string> split;
int Generate_TarList(string Path, std::vector<TarListStruct> *TarList, unsigned long long *Target_Size, unsigned *thread_id);
static void* createList(void *cookie);
static void* extractMulti(void *cookie);
int tarList(bool include_root, std::vector<TarListStruct> *TarList, unsigned thread_id);
std::vector<TarListStruct> *ItemList;
int thread_id;
};
+1
View File
@@ -166,6 +166,7 @@
// Max archive size for tar backups before we split (1.5GB)
#define MAX_ARCHIVE_SIZE 1610612736LLU
//#define MAX_ARCHIVE_SIZE 52428800LLU // 50MB split for testing
#ifndef CUSTOM_LUN_FILE
#define CUSTOM_LUN_FILE "/sys/devices/platform/usb_mass_storage/lun%d/file"