summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README18
-rw-r--r--src/Makefile.am4
-rw-r--r--src/initconf.c42
3 files changed, 32 insertions, 32 deletions
diff --git a/README b/README
index f387f69..ee724f8 100644
--- a/README
+++ b/README
@@ -13,24 +13,20 @@ You must have:
13 autoconf 13 autoconf
14 gcc 14 gcc
15 15
16IMPORTANT: You must edit src/ifuse.c and src/main.c and replace your HostID
17from the plist file stored by iTunes. You can find these lines because they are
18currently commented out. In Windows this file is located in:
19
20C:\Documents and Settings\Your Username\Application Data\Apple Computer\Lockdown\<device serial number>.plist
21
22IMPORTANT: You must also have a public certificate for the device located in
23the root directory of the source named hostcert.pem. This can also be extracted
24from the above file.
25
26To compile run: 16To compile run:
27 ./autogen.sh 17 ./autogen.sh
28 ./configure 18 ./configure
29 make 19 make
20 sudo make install (if you want to install it into your system directories)
21 libiphone-initconf (as the user you intend to user the library)
30 22
31USAGE 23USAGE
32================================================================================ 24================================================================================
33 25
26IMPORTANT: Before using the library you must run "libiphone-initconf". It will
27generate keys and a host id for your system. It only needs to be run once but
28it MUST be run.
29
34There are currently 2 executables iphoneclient and ifuse, located in src/. 30There are currently 2 executables iphoneclient and ifuse, located in src/.
35 31
36iphoneclient is a basic commandline interface, it just runs a few various operations. 32iphoneclient is a basic commandline interface, it just runs a few various operations.
@@ -43,5 +39,3 @@ like this:
43To unmount: 39To unmount:
44 umount mountpoint 40 umount mountpoint
45 41
46Currently the ifuse filesystem is read-only, until the development has
47progressed further.
diff --git a/src/Makefile.am b/src/Makefile.am
index 2817394..09d232f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
1AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libfuse_CFLAGS) $(libgnutls_CFLAGS) -g 1AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libfuse_CFLAGS) $(libgnutls_CFLAGS) -g
2AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libfuse_LIBS) $(libgnutls_LIBS) 2AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libfuse_LIBS) $(libgnutls_LIBS)
3 3
4bin_PROGRAMS = iphoneclient ifuse initconf 4bin_PROGRAMS = iphoneclient ifuse libiphone-initconf
5iphoneclient_SOURCES = usbmux.c main.c iphone.c plist.c lockdown.c AFC.c userpref.c 5iphoneclient_SOURCES = usbmux.c main.c iphone.c plist.c lockdown.c AFC.c userpref.c
6ifuse_SOURCES = ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c 6ifuse_SOURCES = ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c
7initconf_SOURCES = initconf.c userpref.c 7libiphone_initconf_SOURCES = initconf.c userpref.c
diff --git a/src/initconf.c b/src/initconf.c
index 795b4ac..b4952e7 100644
--- a/src/initconf.c
+++ b/src/initconf.c
@@ -52,10 +52,13 @@ char *lockdownd_generate_hostid() {
52} 52}
53 53
54int main(int argc, char *argv[]) { 54int main(int argc, char *argv[]) {
55
56 printf("This program generates keys required to connect with the iPhone\n");
57 printf("It only needs to be run ONCE.\n\n");
58 printf("Additionally it may take several minutes to run, please be patient.\n\n");
55 59
56 gnutls_global_init(); 60 gnutls_global_init();
57 61
58 size_t size;
59 char* host_id = NULL; 62 char* host_id = NULL;
60 gnutls_x509_privkey_t root_privkey; 63 gnutls_x509_privkey_t root_privkey;
61 gnutls_x509_privkey_t host_privkey; 64 gnutls_x509_privkey_t host_privkey;
@@ -72,11 +75,17 @@ int main(int argc, char *argv[]) {
72 /* generate HostID */ 75 /* generate HostID */
73 //TODO 76 //TODO
74 host_id = lockdownd_generate_hostid(); 77 host_id = lockdownd_generate_hostid();
75 if (debug) printf("HostID: %s\n", host_id);
76 78
77 /* generate keys */ 79 /* generate keys */
80 printf("Generating root key...");
81 fflush(stdout);
78 gnutls_x509_privkey_generate(root_privkey, GNUTLS_PK_RSA, 2048, 0); 82 gnutls_x509_privkey_generate(root_privkey, GNUTLS_PK_RSA, 2048, 0);
83 printf("done\n");
84
85 printf("Generating private key...");
86 fflush(stdout);
79 gnutls_x509_privkey_generate(host_privkey, GNUTLS_PK_RSA, 2048, 0); 87 gnutls_x509_privkey_generate(host_privkey, GNUTLS_PK_RSA, 2048, 0);
88 printf("done\n");
80 89
81 /* generate certificates */ 90 /* generate certificates */
82 gnutls_x509_crt_set_key(root_cert, root_privkey); 91 gnutls_x509_crt_set_key(root_cert, root_privkey);
@@ -102,34 +111,31 @@ int main(int argc, char *argv[]) {
102 gnutls_datum_t root_key_pem = {NULL, 0}; 111 gnutls_datum_t root_key_pem = {NULL, 0};
103 gnutls_datum_t host_key_pem = {NULL, 0}; 112 gnutls_datum_t host_key_pem = {NULL, 0};
104 113
105 gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &size); 114 gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &root_key_pem.size);
106 root_key_pem.size = size; 115 gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &host_key_pem.size);
107 gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &size);
108 host_key_pem.size = size;
109 116
110 root_key_pem.data = gnutls_malloc(root_key_pem.size); 117 root_key_pem.data = gnutls_malloc(root_key_pem.size);
111 host_key_pem.data = gnutls_malloc(host_key_pem.size); 118 host_key_pem.data = gnutls_malloc(host_key_pem.size);
112 119
113 gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &size); 120 gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &root_key_pem.size);
114 root_key_pem.size = size; 121 gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &host_key_pem.size);
115 gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &size);
116 host_key_pem.size = size;
117 122
118 gnutls_datum_t root_cert_pem = {NULL, 0}; 123 gnutls_datum_t root_cert_pem = {NULL, 0};
119 gnutls_datum_t host_cert_pem = {NULL, 0}; 124 gnutls_datum_t host_cert_pem = {NULL, 0};
120 125
121 gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &size); 126 gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &root_cert_pem.size);
122 root_cert_pem.size = size; 127 gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &host_cert_pem.size);
123 gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &size);
124 host_cert_pem.size = size;
125 128
126 root_cert_pem.data = gnutls_malloc(root_cert_pem.size); 129 root_cert_pem.data = gnutls_malloc(root_cert_pem.size);
127 host_cert_pem.data = gnutls_malloc(host_cert_pem.size); 130 host_cert_pem.data = gnutls_malloc(host_cert_pem.size);
128 131
129 gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &size); 132 printf("Generating root certificate...");
130 root_cert_pem.size = size; 133 gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_pem.size);
131 gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &size); 134 printf("done\n");
132 host_cert_pem.size = size; 135
136 printf("Generating root certificate...");
137 gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_pem.size);
138 printf("done\n");
133 139
134 140
135 /* store values in config file */ 141 /* store values in config file */