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.

62 lines
2.3 KiB

  1. --- a/src/osdep/unix/ssl_unix.c
  2. +++ b/src/osdep/unix/ssl_unix.c
  3. @@ -35,6 +35,7 @@
  4. #include <bio.h>
  5. #include <crypto.h>
  6. #include <rand.h>
  7. +#include <rsa.h>
  8. #undef crypt
  9. #define SSLBUFLEN 8192
  10. @@ -90,6 +91,11 @@ static char *start_tls = NIL; /* non-NIL
  11. static int sslonceonly = 0;
  12. +#if OPENSSL_API_COMPAT >= 0x10100000L
  13. +#define SSL_CTX_need_tmp_RSA(ctx) 0
  14. +#define SSL_CTX_set_tmp_rsa_callback(ctx, cb) while(0) (cb)(NULL, 0, 0)
  15. +#endif
  16. +
  17. void ssl_onceonlyinit (void)
  18. {
  19. if (!sslonceonly++) { /* only need to call it once */
  20. @@ -114,7 +120,6 @@ void ssl_onceonlyinit (void)
  21. /* apply runtime linkage */
  22. mail_parameters (NIL,SET_SSLDRIVER,(void *) &ssldriver);
  23. mail_parameters (NIL,SET_SSLSTART,(void *) ssl_start);
  24. - SSL_library_init (); /* add all algorithms */
  25. }
  26. }
  27. @@ -220,9 +225,7 @@ static char *ssl_start_work (SSLSTREAM *
  28. (sslclientkey_t) mail_parameters (NIL,GET_SSLCLIENTKEY,NIL);
  29. if (ssl_last_error) fs_give ((void **) &ssl_last_error);
  30. ssl_last_host = host;
  31. - if (!(stream->context = SSL_CTX_new ((flags & NET_TLSCLIENT) ?
  32. - TLSv1_client_method () :
  33. - SSLv23_client_method ())))
  34. + if (!(stream->context = SSL_CTX_new (TLS_client_method())))
  35. return "SSL context failed";
  36. SSL_CTX_set_options (stream->context,0);
  37. /* disable certificate validation? */
  38. @@ -695,9 +698,6 @@ void ssl_server_init (char *server)
  39. SSLSTREAM *stream = (SSLSTREAM *) memset (fs_get (sizeof (SSLSTREAM)),0,
  40. sizeof (SSLSTREAM));
  41. ssl_onceonlyinit (); /* make sure algorithms added */
  42. - ERR_load_crypto_strings ();
  43. - SSL_load_error_strings ();
  44. - /* build specific certificate/key file names */
  45. sprintf (cert,"%s/%s-%s.pem",SSL_CERT_DIRECTORY,server,tcp_serveraddr ());
  46. sprintf (key,"%s/%s-%s.pem",SSL_KEY_DIRECTORY,server,tcp_serveraddr ());
  47. /* use non-specific name if no specific cert */
  48. @@ -708,9 +708,7 @@ void ssl_server_init (char *server)
  49. if (stat (key,&sbuf)) strcpy (key,cert);
  50. }
  51. /* create context */
  52. - if (!(stream->context = SSL_CTX_new (start_tls ?
  53. - TLSv1_server_method () :
  54. - SSLv23_server_method ())))
  55. + if (!(stream->context = SSL_CTX_new (TLS_server_method())))
  56. syslog (LOG_ALERT,"Unable to create SSL context, host=%.80s",
  57. tcp_clienthost ());
  58. else { /* set context options */