From 3b62c1353e5d31bbc4436e7be88ad331df252db1 Mon Sep 17 00:00:00 2001 From: malte_langkabel Date: Thu, 21 Jan 2016 13:54:41 +0100 Subject: [PATCH] build: fixed licensing project * fixed license includes for windows --- README.md | 5 ++++- src/lib_license/License.cpp | 17 ++++++----------- src/lib_license/License.h | 15 ++++++++------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 157b8a9a..77bcbda2 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,12 @@ For Win32: Build release lib in ${BOTAN_DIR}/release Build debug lib in ${BOTAN_DIR}/debug -for Windows: +for Windows release build: $ python configure.py --cc=msvc --cpu=x86_32 --via-amalgamation --disable-shared +for Windows debug build: +python configure.py --cc=msvc --cpu=x86_32 --via-amalgamation --disable-shared --no-optimizations --with-debug-info + for other: $ python configure.py --via-amalgamation --disable-shared diff --git a/src/lib_license/License.cpp b/src/lib_license/License.cpp index 2db6add9..bca326b3 100644 --- a/src/lib_license/License.cpp +++ b/src/lib_license/License.cpp @@ -1,21 +1,15 @@ #include "License.h" #include +#include #include #include #include #include -// #include "botan/pubkey.h" -// #include "botan/base64.h" -// #include "botan/passhash9.h" - +#include "botan_all.h" #include "boost/filesystem.hpp" -// #ifdef BOTAN_HAS_RSA -// #include "botan/rsa.h" -// #endif - namespace { std::string trim(const std::string &str) @@ -27,6 +21,7 @@ namespace } License::License() + : m_rng(std::make_shared()) { } @@ -86,7 +81,7 @@ void License::create(std::string user, std::string version, Botan::RSA_PrivateKe while (size_t got = in.read(buf, sizeof(buf))) { signer.update(buf, got); } - std::string signature = Botan::base64_encode(signer.signature(m_rng)); + std::string signature = Botan::base64_encode(signer.signature(*(m_rng.get()))); addSignature(signature); } @@ -106,7 +101,7 @@ void License::createMessage(std::string user, std::string version, unsigned int lines.push_back(typestring); std::string versionstring = "Coati " + getVersion(); lines.push_back(versionstring); - std::string pass9 = Botan::generate_passhash9(versionstring, m_rng); + std::string pass9 = Botan::generate_passhash9(versionstring, *(m_rng.get())); lines.push_back(pass9); } @@ -293,7 +288,7 @@ std::string License::getLicenseString() const std::string License::hashLocation(const std::string& location) { - return Botan::generate_passhash9(location, m_rng); + return Botan::generate_passhash9(location, *(m_rng.get())); } bool License::checkLocation(const std::string& location, const std::string& hash) diff --git a/src/lib_license/License.h b/src/lib_license/License.h index 21c3caa6..1e200ed9 100644 --- a/src/lib_license/License.h +++ b/src/lib_license/License.h @@ -1,15 +1,16 @@ #ifndef COATI_LICENSE_H #define COATI_LICENSE_H +#include #include #include -//#include "botan/botan.h" -#include "botan_all.h" - -#ifdef BOTAN_HAS_RSA -//#include "botan/rsa.h" -#endif +namespace Botan +{ + class RSA_PublicKey; + class RSA_PrivateKey; + class AutoSeeded_RNG; +} class License { @@ -60,7 +61,7 @@ private: std::string m_publicKeyFilename; std::shared_ptr m_publicKey; std::vector lines; - Botan::AutoSeeded_RNG m_rng; + std::shared_ptr m_rng; const std::string KEY_FILEENDING = ".pem"; const std::string BEGIN_LICENSE = "-----BEGIN LICENSE-----";