blob: cd3a1780443191b824a4e737b540546306e92610 [file] [log] [blame]
a39552696ff55ce2013-01-08 16:14:56 +00001/*
2 * Copyright (c) 2013 a3955269 all rights reversed, no rights reserved.
3 */
4
5//////////////////////////////////////////////////////////////////////////////
6
7#include <string.h>
8#include <stdio.h>
9#include <dlfcn.h>
10
11#include "include/libcrypt_samsung.h"
12
13//////////////////////////////////////////////////////////////////////////////
a39552696ff55ce2013-01-08 16:14:56 +000014
15int decrypt_EDK(
16 dek_t *dek, const edk_payload_t *edk, /*const*/ char *passwd)
17{
18 void *lib = dlopen("libsec_km.so", RTLD_LAZY);
19
20 if(!lib)
21 return -100;
22
23 int r = -101;
24 decrypt_EDK_t sym = (decrypt_EDK_t)dlsym(lib, "decrypt_EDK");
25 if(sym)
26 r = sym(dek, edk, passwd);
27
28 dlclose(lib);
29
30 return r;
31}
32
33int mount_ecryptfs_drive(
34 const char *passwd, const char *source, const char *target, int filter)
35{
36 void *lib = dlopen("libsec_ecryptfs.so", RTLD_LAZY);
37 if(!lib)
38 return -100;
39
40 int r = -101;
41 mount_ecryptfs_drive_t sym = (mount_ecryptfs_drive_t)dlsym(lib, "mount_ecryptfs_drive");
42 if(sym)
43 r = sym(passwd, source, target, filter);
44
45 dlclose(lib);
46
47 return r;
48}
49
Dees_Troyc8bafa12013-01-10 15:43:00 +000050int unmount_ecryptfs_drive(
51 const char *source)
52{
53 void *lib = dlopen("libsec_ecryptfs.so", RTLD_LAZY);
54 if(!lib)
55 return -100;
56
57 int r = -101;
58 unmount_ecryptfs_drive_t sym = (unmount_ecryptfs_drive_t)dlsym(lib, "unmount_ecryptfs_drive");
59 if(sym)
60 r = sym(source);
61
62 dlclose(lib);
63
64 return r;
65}