You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.8 KiB

  1. --- a/common/userpref.c
  2. +++ b/common/userpref.c
  3. @@ -37,6 +37,7 @@
  4. #include <unistd.h>
  5. #include <usbmuxd.h>
  6. #ifdef HAVE_OPENSSL
  7. +#include <openssl/bn.h>
  8. #include <openssl/pem.h>
  9. #include <openssl/rsa.h>
  10. #include <openssl/x509.h>
  11. @@ -73,6 +74,11 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
  12. };
  13. #endif
  14. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  15. +#define X509_set1_notBefore X509_set_notBefore
  16. +#define X509_set1_notAfter X509_set_notAfter
  17. +#endif
  18. +
  19. #ifdef WIN32
  20. #define DIR_SEP '\\'
  21. #define DIR_SEP_S "\\"
  22. @@ -420,9 +426,9 @@ userpref_error_t pair_record_generate_keys_and_certs(plist_t pair_record, key_da
  23. /* set key validity */
  24. ASN1_TIME* asn1time = ASN1_TIME_new();
  25. ASN1_TIME_set(asn1time, time(NULL));
  26. - X509_set_notBefore(root_cert, asn1time);
  27. + X509_set1_notBefore(root_cert, asn1time);
  28. ASN1_TIME_set(asn1time, time(NULL) + (60 * 60 * 24 * 365 * 10));
  29. - X509_set_notAfter(root_cert, asn1time);
  30. + X509_set1_notAfter(root_cert, asn1time);
  31. ASN1_TIME_free(asn1time);
  32. /* use root public key for root cert */
  33. @@ -453,9 +459,9 @@ userpref_error_t pair_record_generate_keys_and_certs(plist_t pair_record, key_da
  34. /* set key validity */
  35. ASN1_TIME* asn1time = ASN1_TIME_new();
  36. ASN1_TIME_set(asn1time, time(NULL));
  37. - X509_set_notBefore(host_cert, asn1time);
  38. + X509_set1_notBefore(host_cert, asn1time);
  39. ASN1_TIME_set(asn1time, time(NULL) + (60 * 60 * 24 * 365 * 10));
  40. - X509_set_notAfter(host_cert, asn1time);
  41. + X509_set1_notAfter(host_cert, asn1time);
  42. ASN1_TIME_free(asn1time);
  43. /* use host public key for host cert */
  44. @@ -533,9 +539,9 @@ userpref_error_t pair_record_generate_keys_and_certs(plist_t pair_record, key_da
  45. ASN1_TIME* asn1time = ASN1_TIME_new();
  46. ASN1_TIME_set(asn1time, time(NULL));
  47. - X509_set_notBefore(dev_cert, asn1time);
  48. + X509_set1_notBefore(dev_cert, asn1time);
  49. ASN1_TIME_set(asn1time, time(NULL) + (60 * 60 * 24 * 365 * 10));
  50. - X509_set_notAfter(dev_cert, asn1time);
  51. + X509_set1_notAfter(dev_cert, asn1time);
  52. ASN1_TIME_free(asn1time);
  53. EVP_PKEY* pkey = EVP_PKEY_new();
  54. --- a/src/idevice.c
  55. +++ b/src/idevice.c
  56. @@ -36,6 +36,7 @@
  57. #include <usbmuxd.h>
  58. #ifdef HAVE_OPENSSL
  59. #include <openssl/err.h>
  60. +#include <openssl/rsa.h>
  61. #include <openssl/ssl.h>
  62. #else
  63. @@ -49,6 +50,10 @@
  64. #ifdef HAVE_OPENSSL
  65. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  66. +#define TLS_method TLSv1_method
  67. +#endif
  68. +
  69. #if OPENSSL_VERSION_NUMBER < 0x10002000L
  70. static void SSL_COMP_free_compression_methods(void)
  71. {
  72. @@ -721,7 +726,7 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne
  73. }
  74. BIO_set_fd(ssl_bio, (int)(long)connection->data, BIO_NOCLOSE);
  75. - SSL_CTX *ssl_ctx = SSL_CTX_new(TLSv1_method());
  76. + SSL_CTX *ssl_ctx = SSL_CTX_new(TLS_method());
  77. if (ssl_ctx == NULL) {
  78. debug_info("ERROR: Could not create SSL context.");
  79. BIO_free(ssl_bio);