Git Product home page Git Product logo

Comments (2)

Hawk777 avatar Hawk777 commented on June 12, 2024

Apparently there's no way to attach a file to a Github issue. I'll paste the patch inline here. If you'd prefer it provided by some other mechanism, tell me and I'll be happy to do that.

diff --git a/Csocket.cpp b/Csocket.cpp
index b2bcf44..3748018 100644
--- a/Csocket.cpp
+++ b/Csocket.cpp
@@ -36,6 +36,7 @@
 #endif /* __NetBSD__ */

 #ifdef HAVE_LIBSSL
+#include <stdio.h>
 #include <openssl/conf.h>
 #include <openssl/engine.h>
 #endif /* HAVE_LIBSSL */
@@ -1273,6 +1274,35 @@ bool Csock::SSLServerSetup()
        return( false );
    }

+   FILE *dhParamsFile = 0;
+   if ( ! ( dhParamsFile = fopen( m_sPemFile.c_str(), "r" ) ) )
+   {
+       CS_DEBUG( "There is a problem with [" << m_sPemFile << "]" );
+       return( false );
+   }
+
+   DH *dhParams = PEM_read_DHparams( dhParamsFile, 0, 0, 0 );
+   fclose( dhParamsFile );
+   dhParamsFile = 0;
+   if ( dhParams )
+   {
+       SSL_CTX_set_options( m_ssl_ctx, SSL_OP_SINGLE_DH_USE );
+       if ( ! SSL_CTX_set_tmp_dh( m_ssl_ctx, dhParams ) )
+       {
+           CS_DEBUG( "Error setting ephemeral DH parameters from [" << m_sPemFile << "]" );
+           SSLErrors( __FILE__, __LINE__ );
+           DH_free( dhParams );
+           dhParams = 0;
+           return( false );
+       }
+       DH_free( dhParams );
+       dhParams = 0;
+   }
+   else
+   {
+       ERR_clear_error();
+   }
+
    if ( SSL_CTX_set_cipher_list( m_ssl_ctx, m_sCipherType.c_str() ) <= 0 )
    {
        CS_DEBUG( "Could not assign cipher [" << m_sCipherType << "]" );

from znc.

Hawk777 avatar Hawk777 commented on June 12, 2024

Replaced by pull request #46.

from znc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.