mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Store DHParams in sqlite.
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/mem_fn.hpp>
|
||||
//#include <boost/log/trivial.hpp>
|
||||
#include <openssl/dh.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Config.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace boost::asio::ip;
|
||||
@@ -16,33 +17,7 @@ using namespace boost::asio::ip;
|
||||
// Generate DH for SSL connection.
|
||||
static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
|
||||
{
|
||||
// We don't care if for export.
|
||||
static DH* sdh512 = 0;
|
||||
static DH* sdh1024 = 0;
|
||||
|
||||
if (!sdh512 && 512 == iKeyLength)
|
||||
{
|
||||
int iCodes;
|
||||
|
||||
do {
|
||||
sdh512 = DH_generate_parameters(512, DH_GENERATOR_5, NULL, NULL);
|
||||
iCodes = 0;
|
||||
DH_check(sdh512, &iCodes);
|
||||
} while (iCodes & (DH_CHECK_P_NOT_PRIME|DH_CHECK_P_NOT_SAFE_PRIME|DH_UNABLE_TO_CHECK_GENERATOR|DH_NOT_SUITABLE_GENERATOR));
|
||||
}
|
||||
|
||||
if (!sdh1024 && 512 != iKeyLength)
|
||||
{
|
||||
int iCodes;
|
||||
|
||||
do {
|
||||
sdh1024 = DH_generate_parameters(1024, DH_GENERATOR_5, NULL, NULL);
|
||||
iCodes = 0;
|
||||
DH_check(sdh1024, &iCodes);
|
||||
} while (iCodes & (DH_CHECK_P_NOT_PRIME|DH_CHECK_P_NOT_SAFE_PRIME|DH_UNABLE_TO_CHECK_GENERATOR|DH_NOT_SUITABLE_GENERATOR));
|
||||
}
|
||||
|
||||
return 512 == iKeyLength ? sdh512 : sdh1024;
|
||||
return 512 == iKeyLength ? theApp->getWallet().getDh512() : theApp->getWallet().getDh1024();
|
||||
}
|
||||
|
||||
PeerDoor::PeerDoor(boost::asio::io_service& io_service) :
|
||||
|
||||
Reference in New Issue
Block a user