diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/initconf.c | 42 |
2 files changed, 26 insertions, 20 deletions
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 @@ AM_CFLAGS = $(libxml2_CFLAGS) $(libusb_CFLAGS) $(libglib2_CFLAGS) $(libfuse_CFLAGS) $(libgnutls_CFLAGS) -g AM_LDFLAGS = $(libxml2_LIBS) $(libusb_LIBS) $(libglib2_LIBS) $(libfuse_LIBS) $(libgnutls_LIBS) -bin_PROGRAMS = iphoneclient ifuse initconf +bin_PROGRAMS = iphoneclient ifuse libiphone-initconf iphoneclient_SOURCES = usbmux.c main.c iphone.c plist.c lockdown.c AFC.c userpref.c ifuse_SOURCES = ifuse.c usbmux.c iphone.c plist.c lockdown.c AFC.c userpref.c -initconf_SOURCES = initconf.c userpref.c +libiphone_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() { } int main(int argc, char *argv[]) { + + printf("This program generates keys required to connect with the iPhone\n"); + printf("It only needs to be run ONCE.\n\n"); + printf("Additionally it may take several minutes to run, please be patient.\n\n"); gnutls_global_init(); - size_t size; char* host_id = NULL; gnutls_x509_privkey_t root_privkey; gnutls_x509_privkey_t host_privkey; @@ -72,11 +75,17 @@ int main(int argc, char *argv[]) { /* generate HostID */ //TODO host_id = lockdownd_generate_hostid(); - if (debug) printf("HostID: %s\n", host_id); /* generate keys */ + printf("Generating root key..."); + fflush(stdout); gnutls_x509_privkey_generate(root_privkey, GNUTLS_PK_RSA, 2048, 0); + printf("done\n"); + + printf("Generating private key..."); + fflush(stdout); gnutls_x509_privkey_generate(host_privkey, GNUTLS_PK_RSA, 2048, 0); + printf("done\n"); /* generate certificates */ gnutls_x509_crt_set_key(root_cert, root_privkey); @@ -102,34 +111,31 @@ int main(int argc, char *argv[]) { gnutls_datum_t root_key_pem = {NULL, 0}; gnutls_datum_t host_key_pem = {NULL, 0}; - gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &size); - root_key_pem.size = size; - gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &size); - host_key_pem.size = size; + gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &root_key_pem.size); + gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &host_key_pem.size); root_key_pem.data = gnutls_malloc(root_key_pem.size); host_key_pem.data = gnutls_malloc(host_key_pem.size); - gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &size); - root_key_pem.size = size; - gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &size); - host_key_pem.size = size; + gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &root_key_pem.size); + gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &host_key_pem.size); gnutls_datum_t root_cert_pem = {NULL, 0}; gnutls_datum_t host_cert_pem = {NULL, 0}; - gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &size); - root_cert_pem.size = size; - gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &size); - host_cert_pem.size = size; + gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &root_cert_pem.size); + gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &host_cert_pem.size); root_cert_pem.data = gnutls_malloc(root_cert_pem.size); host_cert_pem.data = gnutls_malloc(host_cert_pem.size); - gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &size); - root_cert_pem.size = size; - gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &size); - host_cert_pem.size = size; + printf("Generating root certificate..."); + gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_pem.size); + printf("done\n"); + + printf("Generating root certificate..."); + gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_pem.size); + printf("done\n"); /* store values in config file */ |