summaryrefslogtreecommitdiffstats
path: root/crypto/libcrypt_samsung
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-01-10 16:43:00 +0100
committerDees_Troy <dees_troy@teamw.in>2013-01-10 16:43:00 +0100
commitc8bafa1cc16f32014a819c3614d222066f7e7555 (patch)
tree4aba1faa6e6acce3ac8763c9c753129367c95e42 /crypto/libcrypt_samsung
parentIncrease char array sizes to allow for null char for strcpy (diff)
downloadandroid_bootable_recovery-c8bafa1cc16f32014a819c3614d222066f7e7555.tar
android_bootable_recovery-c8bafa1cc16f32014a819c3614d222066f7e7555.tar.gz
android_bootable_recovery-c8bafa1cc16f32014a819c3614d222066f7e7555.tar.bz2
android_bootable_recovery-c8bafa1cc16f32014a819c3614d222066f7e7555.tar.lz
android_bootable_recovery-c8bafa1cc16f32014a819c3614d222066f7e7555.tar.xz
android_bootable_recovery-c8bafa1cc16f32014a819c3614d222066f7e7555.tar.zst
android_bootable_recovery-c8bafa1cc16f32014a819c3614d222066f7e7555.zip
Diffstat (limited to 'crypto/libcrypt_samsung')
-rw-r--r--crypto/libcrypt_samsung/include/libcrypt_samsung.h3
-rw-r--r--crypto/libcrypt_samsung/libcrypt_samsung.c35
2 files changed, 19 insertions, 19 deletions
diff --git a/crypto/libcrypt_samsung/include/libcrypt_samsung.h b/crypto/libcrypt_samsung/include/libcrypt_samsung.h
index 48c7b3e6d..2fb6f2c4f 100644
--- a/crypto/libcrypt_samsung/include/libcrypt_samsung.h
+++ b/crypto/libcrypt_samsung/include/libcrypt_samsung.h
@@ -133,6 +133,9 @@ typedef int (*mount_ecryptfs_drive_t)(
int unmount_ecryptfs_drive(
const char *source);
+typedef int (*unmount_ecryptfs_drive_t)(
+ const char *source);
+
//////////////////////////////////////////////////////////////////////////////
#endif // #ifndef __LIBCRYPT_SAMSUNG_H__
diff --git a/crypto/libcrypt_samsung/libcrypt_samsung.c b/crypto/libcrypt_samsung/libcrypt_samsung.c
index 4b9b9c5d5..cd3a17804 100644
--- a/crypto/libcrypt_samsung/libcrypt_samsung.c
+++ b/crypto/libcrypt_samsung/libcrypt_samsung.c
@@ -11,25 +11,6 @@
#include "include/libcrypt_samsung.h"
//////////////////////////////////////////////////////////////////////////////
-void xconvert_key_to_hex_ascii(unsigned char *master_key, unsigned int keysize,
- char *master_key_ascii)
-{
- unsigned int i, a;
- unsigned char nibble;
-
- for (i=0, a=0; i<keysize; i++, a+=2) {
- /* For each byte, write out two ascii hex digits */
- nibble = (master_key[i] >> 4) & 0xf;
- master_key_ascii[a] = nibble + (nibble > 9 ? 0x37 : 0x30);
-
- nibble = master_key[i] & 0xf;
- master_key_ascii[a+1] = nibble + (nibble > 9 ? 0x37 : 0x30);
- }
-
- /* Add the null termination */
- master_key_ascii[a] = '\0';
-
-}
int decrypt_EDK(
dek_t *dek, const edk_payload_t *edk, /*const*/ char *passwd)
@@ -66,3 +47,19 @@ int mount_ecryptfs_drive(
return r;
}
+int unmount_ecryptfs_drive(
+ const char *source)
+{
+ void *lib = dlopen("libsec_ecryptfs.so", RTLD_LAZY);
+ if(!lib)
+ return -100;
+
+ int r = -101;
+ unmount_ecryptfs_drive_t sym = (unmount_ecryptfs_drive_t)dlsym(lib, "unmount_ecryptfs_drive");
+ if(sym)
+ r = sym(source);
+
+ dlclose(lib);
+
+ return r;
+} \ No newline at end of file