Split DH from utils, remove utils from project

This commit is contained in:
Vinnie Falco
2013-05-27 10:41:50 -07:00
parent e842548a29
commit 92bdcba096
33 changed files with 44 additions and 95 deletions

View File

@@ -3,7 +3,6 @@
#include <string>
#include <vector>
#include "../ripple/utils.h"
#define SQL_FOREACH(_db, _strQuery) \
if ((_db)->executeSQL(_strQuery)) \

View File

@@ -11,7 +11,6 @@
#include "Config.h"
#include "SerializedTypes.h"
#include "utils.h"
SETUP_LOG (STAmount)

View File

@@ -12,7 +12,6 @@
#include "RPCDoor.h"
#include "BitcoinUtil.h"
#include "key.h"
#include "utils.h"
#include "../database/SqliteDatabase.h"

View File

@@ -10,7 +10,6 @@
#include "Config.h"
#include "utils.h"
#include "HashPrefixes.h"
#define SECTION_ACCOUNT_PROBE_MAX "account_probe_max"

View File

@@ -12,7 +12,9 @@
#include "Peer.h"
#include "PeerDoor.h"
#include "Application.h"
#include "utils.h"
// VFALCO: TODO, make this an inline function
#define ADDRESS_SHARED(p) strHex(uint64( ((char*) (p).get()) - ((char*) 0)))
// How often to enforce policies.
#define POLICY_INTERVAL_SECONDS 5

View File

@@ -1,4 +1,3 @@
#include "utils.h"
#include <string>

View File

@@ -7,7 +7,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include "utils.h"
// These must stay at the top of this file
std::map<int, SField::ptr> SField::codeToField;

View File

@@ -3,7 +3,6 @@
//
#include "HttpsClient.h"
#include "utils.h"
#include <iostream>
#include <boost/date_time/posix_time/posix_time.hpp>

View File

@@ -11,7 +11,6 @@
#include <boost/shared_ptr.hpp>
#include "AutoSocket.h"
#include "utils.h"
//
// Async https client.

View File

@@ -6,7 +6,6 @@
#include <boost/thread/mutex.hpp>
#include <boost/shared_ptr.hpp>
#include "utils.h"
// Monitors load levels and response times

View File

@@ -3,7 +3,6 @@
#include <boost/foreach.hpp>
#include "utils.h"
#include "Application.h"
#include "Transaction.h"
#include "HashPrefixes.h"

View File

@@ -3,8 +3,6 @@
#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
#include "utils.h"
bool ParameterNode::setValue(const std::string& name, const Json::Value& value, Json::Value& error)
{
if (name.empty()) // this node

View File

@@ -1,5 +1,4 @@
#include "ParseSection.h"
#include "utils.h"
#include <iostream>
#include <boost/algorithm/string.hpp>

View File

@@ -10,7 +10,9 @@
#include "Config.h"
#include "Application.h"
#include "SerializedTransaction.h"
#include "utils.h"
// VFALCO: TODO, make this an inline function
#define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0)))
SETUP_LOG (Peer)

View File

@@ -8,7 +8,6 @@
#include "Application.h"
#include "Config.h"
#include "utils.h"
SETUP_LOG (PeerDoor)

View File

@@ -1,6 +1,5 @@
#include "RPCErr.h"
#include "utils.h"
// For logging
struct RPCErr { };

View File

@@ -2,7 +2,6 @@
#include "HttpsClient.h"
#include "RPC.h"
#include "utils.h"
#include <iostream>

View File

@@ -16,7 +16,6 @@
#include "key.h"
#include "BitcoinUtil.h"
#include "rfc1751.h"
#include "utils.h"
#include "Serializer.h"
#include "Application.h"

View File

@@ -6,7 +6,6 @@
#include <openssl/rand.h>
#include "utils.h"
#include "Config.h"
SETUP_LOG (SNTPClient)

View File

@@ -19,7 +19,6 @@
#include "HttpsClient.h"
#include "ParseSection.h"
#include "Serializer.h"
#include "utils.h"
#define VALIDATORS_FETCH_SECONDS 30
#define VALIDATORS_FILE_BYTES_MAX (50 << 10)

View File

@@ -7,7 +7,6 @@
#include "Application.h"
#include "Config.h"
#include "NetworkOPs.h"
#include "utils.h"
#include "WSConnection.h"
#include "WSHandler.h"
#include "Config.h"

View File

@@ -10,7 +10,6 @@
#include "CallRPC.h"
#include "Config.h"
#include "RPCHandler.h"
#include "utils.h"
namespace po = boost::program_options;

View File

@@ -15,8 +15,6 @@
#include <boost/functional/hash.hpp>
#include "utils.h"
#if defined(_MSC_VER) && _MSC_VER < 1300
#define for if (false) ; else for
#endif

View File

@@ -1,63 +0,0 @@
#ifdef __linux__
#include <sys/types.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#endif
#ifdef __FreeBSD__
#include <sys/types.h>
#include <sys/wait.h>
#endif
#ifdef WIN32
#define _WINSOCK_
#include <winsock2.h>
#endif
#include <fstream>
//#include <boost/algorithm/string.hpp>
//#include <boost/asio.hpp>
#include <boost/foreach.hpp>
//#include <boost/regex.hpp>
//#include <boost/test/unit_test.hpp>
//#include <openssl/rand.h>
#include "utils.h"
#include "uint256.h"
//
// DH support
//
std::string DH_der_gen(int iKeyLength)
{
DH* dh = 0;
int iCodes;
std::string strDer;
do {
dh = DH_generate_parameters(iKeyLength, DH_GENERATOR_5, NULL, NULL);
iCodes = 0;
DH_check(dh, &iCodes);
} while (iCodes & (DH_CHECK_P_NOT_PRIME|DH_CHECK_P_NOT_SAFE_PRIME|DH_UNABLE_TO_CHECK_GENERATOR|DH_NOT_SUITABLE_GENERATOR));
strDer.resize(i2d_DHparams(dh, NULL));
unsigned char* next = reinterpret_cast<unsigned char *>(&strDer[0]);
(void) i2d_DHparams(dh, &next);
return strDer;
}
DH* DH_der_load(const std::string& strDer)
{
const unsigned char *pbuf = reinterpret_cast<const unsigned char *>(&strDer[0]);
return d2i_DHparams(NULL, &pbuf, strDer.size());
}
// vim:ts=4

View File

@@ -1,19 +0,0 @@
#ifndef __UTILS__
#define __UTILS__
#include <openssl/dh.h>
#define nothing() do {} while (0)
#define fallthru() do {} while (0)
#define NUMBER(x) (sizeof(x)/sizeof((x)[0]))
#define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0)))
#define ADDRESS_SHARED(p) strHex(uint64( ((char*) (p).get()) - ((char*) 0)))
#define isSetBit(x,y) (!!((x) & (y)))
DH* DH_der_load(const std::string& strDer);
std::string DH_der_gen(int iKeyLength);
#endif
// vim:ts=4