summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-03-21 01:27:43 +0100
committerGravatar Martin Szulecki2014-03-21 01:27:43 +0100
commit2ab4474d06db38a5bb87262ff6dea26ebfc618c3 (patch)
treea35df25cce63d86d25a91cb1a7c9a85a62424586
parenta0b376fe892459bf6988c134aa67405cf3b0e748 (diff)
downloadlibimobiledevice-2ab4474d06db38a5bb87262ff6dea26ebfc618c3.tar.gz
libimobiledevice-2ab4474d06db38a5bb87262ff6dea26ebfc618c3.tar.bz2
userpref: Use correct import helper for keys and certs
-rw-r--r--common/userpref.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/common/userpref.c b/common/userpref.c
index d9641cb..65f1988 100644
--- a/common/userpref.c
+++ b/common/userpref.c
@@ -674,8 +674,8 @@ userpref_error_t pair_record_generate_from_device_public_key(plist_t pair_record
host_privkey.data = NULL;
host_privkey.size = 0;
- uret = pair_record_import_key_with_name(pair_record, USERPREF_ROOT_CERTIFICATE_KEY, &root_cert);
- uret = pair_record_import_key_with_name(pair_record, USERPREF_HOST_CERTIFICATE_KEY, &host_cert);
+ uret = pair_record_import_crt_with_name(pair_record, USERPREF_ROOT_CERTIFICATE_KEY, &root_cert);
+ uret = pair_record_import_crt_with_name(pair_record, USERPREF_HOST_CERTIFICATE_KEY, &host_cert);
uret = pair_record_import_key_with_name(pair_record, USERPREF_ROOT_PRIVATE_KEY_KEY, &root_privkey);
uret = pair_record_import_key_with_name(pair_record, USERPREF_HOST_PRIVATE_KEY_KEY, &host_privkey);
@@ -738,8 +738,8 @@ userpref_error_t pair_record_generate_from_device_public_key(plist_t pair_record
key_data_t pem_root_cert = { NULL, 0 };
key_data_t pem_host_cert = { NULL, 0 };
- uret = pair_record_import_key_with_name(pair_record, USERPREF_ROOT_CERTIFICATE_KEY, &pem_root_cert);
- uret = pair_record_import_key_with_name(pair_record, USERPREF_HOST_CERTIFICATE_KEY, &pem_host_cert);
+ uret = pair_record_import_crt_with_name(pair_record, USERPREF_ROOT_CERTIFICATE_KEY, &pem_root_cert);
+ uret = pair_record_import_crt_with_name(pair_record, USERPREF_HOST_CERTIFICATE_KEY, &pem_host_cert);
if (USERPREF_E_SUCCESS == uret) {
/* set new keys and certs in pair record */
@@ -830,8 +830,8 @@ userpref_error_t pair_record_generate_from_device_public_key(plist_t pair_record
gnutls_x509_privkey_import_rsa_raw(fake_privkey, &modulus, &exponent, &essentially_null, &essentially_null,
&essentially_null, &essentially_null)) {
- uret = pair_record_import_key_with_name(pair_record, USERPREF_ROOT_CERTIFICATE_KEY, root_cert);
- uret = pair_record_import_key_with_name(pair_record, USERPREF_HOST_CERTIFICATE_KEY, host_cert);
+ uret = pair_record_import_crt_with_name(pair_record, USERPREF_ROOT_CERTIFICATE_KEY, root_cert);
+ uret = pair_record_import_crt_with_name(pair_record, USERPREF_HOST_CERTIFICATE_KEY, host_cert);
uret = pair_record_import_key_with_name(pair_record, USERPREF_ROOT_PRIVATE_KEY_KEY, root_privkey);
uret = pair_record_import_key_with_name(pair_record, USERPREF_HOST_PRIVATE_KEY_KEY, host_privkey);
@@ -869,8 +869,8 @@ userpref_error_t pair_record_generate_from_device_public_key(plist_t pair_record
gnutls_datum_t pem_root_cert = { NULL, 0 };
gnutls_datum_t pem_host_cert = { NULL, 0 };
- uret = pair_record_import_key_with_name(pair_record, USERPREF_ROOT_CERTIFICATE_KEY, &pem_root_cert);
- uret = pair_record_import_key_with_name(pair_record, USERPREF_HOST_CERTIFICATE_KEY, &pem_host_cert);
+ uret = pair_record_import_crt_with_name(pair_record, USERPREF_ROOT_CERTIFICATE_KEY, &pem_root_cert);
+ uret = pair_record_import_crt_with_name(pair_record, USERPREF_HOST_CERTIFICATE_KEY, &pem_host_cert);
if (USERPREF_E_SUCCESS == uret) {
/* set new keys and certs in pair record */
@@ -934,7 +934,7 @@ userpref_error_t pair_record_import_key_with_name(plist_t pair_record, const cha
#else
key_data_t pem = { NULL, 0 };
ret = pair_record_get_item_as_key_data(pair_record, name, pem);
- if (ret == USERPREF_E_SUCCESS && GNUTLS_E_SUCCESS == gnutls_x509_privkey_import(cert, &pem, GNUTLS_X509_FMT_PEM))
+ if (ret == USERPREF_E_SUCCESS && GNUTLS_E_SUCCESS == gnutls_x509_privkey_import(key, &pem, GNUTLS_X509_FMT_PEM))
ret = USERPREF_E_SUCCESS;
else
ret = USERPREF_E_SSL_ERROR;