summaryrefslogtreecommitdiff
path: root/src/rsa-pss.cpp
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-04-19 22:14:42 +0200
committerStephen Warren <swarren@nvidia.com>2017-10-03 10:46:58 -0600
commitf4c6cf83dfbf041d2ea8ab6ade961137b44d0928 (patch)
tree58d157d7c252bf5f3618f250d90dfa17965b432c /src/rsa-pss.cpp
parent3e0eb012c4518e91e6480b712aacf16c6405f1a2 (diff)
downloadtegrarcm-f4c6cf83dfbf041d2ea8ab6ade961137b44d0928.tar.gz
Don't assume cryptopp is system-wide installed
The current build system adds "-isystem /usr/include/$(CRYPTOLIB)" to AM_CPPFLAGS, but this is wrong because cryptopp might not be installed in this location. Instead, the build system should simply include <cryptopp/...> or <crypto++/...> and rely on the compiler include path. The tricky part is that it can be <cryptopp/...> or <crypto++/...>. To solve this, we use a solution similar to the one used in https://github.com/bingmann/crypto-speedtest/blob/master/m4/cryptopp.m4 and https://github.com/bingmann/crypto-speedtest/blob/master/src/speedtest_cryptopp.cpp: the configure script fills in a variable called CRYPTOLIB_HEADER_PREFIX, and we use that in the C++ code to include the right header file. It is worth mentioning that doing #include <CRYPTOLIB_HEADER_PREFIX/foobar.h> doesn't work, and we have to use an intermediate #define'd constant to overcome this C preprocessor limitation. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> (swarren, apply the same change to rsa-pss.cpp) Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'src/rsa-pss.cpp')
-rw-r--r--src/rsa-pss.cpp44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/rsa-pss.cpp b/src/rsa-pss.cpp
index ab0a680..7e6f066 100644
--- a/src/rsa-pss.cpp
+++ b/src/rsa-pss.cpp
@@ -26,6 +26,9 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include "config.h"
+
#include <iostream>
using std::cout;
using std::cerr;
@@ -40,36 +43,39 @@ using std::string;
#include <cstdlib>
using std::exit;
-#include "cryptlib.h"
-using CryptoPP::Exception;
+#define CRYPTOPP_INCLUDE_CRYPTLIB <CRYPTOLIB_HEADER_PREFIX/cryptlib.h>
+#define CRYPTOPP_INCLUDE_FILES <CRYPTOLIB_HEADER_PREFIX/files.h>
+#define CRYPTOPP_INCLUDE_FILTERS <CRYPTOLIB_HEADER_PREFIX/filters.h>
+#define CRYPTOPP_INCLUDE_INTEGER <CRYPTOLIB_HEADER_PREFIX/integer.h>
+#define CRYPTOPP_INCLUDE_OSRNG <CRYPTOLIB_HEADER_PREFIX/osrng.h>
+#define CRYPTOPP_INCLUDE_QUEUE <CRYPTOLIB_HEADER_PREFIX/queue.h>
+#define CRYPTOPP_INCLUDE_RSA <CRYPTOLIB_HEADER_PREFIX/rsa.h>
+#define CRYPTOPP_INCLUDE_PSSR <CRYPTOLIB_HEADER_PREFIX/pssr.h>
+#define CRYPTOPP_INCLUDE_SHA <CRYPTOLIB_HEADER_PREFIX/sha.h>
+#define CRYPTOPP_INCLUDE_SECBLOCK <CRYPTOLIB_HEADER_PREFIX/secblock.h>
+
+#include CRYPTOPP_INCLUDE_CRYPTLIB
+#include CRYPTOPP_INCLUDE_FILES
+#include CRYPTOPP_INCLUDE_FILTERS
+#include CRYPTOPP_INCLUDE_INTEGER
+#include CRYPTOPP_INCLUDE_OSRNG
+#include CRYPTOPP_INCLUDE_QUEUE
+#include CRYPTOPP_INCLUDE_RSA
+#include CRYPTOPP_INCLUDE_PSSR
+#include CRYPTOPP_INCLUDE_SHA
+#include CRYPTOPP_INCLUDE_SECBLOCK
-#include "integer.h"
+using CryptoPP::Exception;
using CryptoPP::Integer;
-
-#include "files.h"
using CryptoPP::FileSource;
-
-#include "filters.h"
using CryptoPP::StringSink;
using CryptoPP::SignerFilter;
-
-#include "queue.h"
using CryptoPP::ByteQueue;
-
-#include "rsa.h"
using CryptoPP::RSA;
using CryptoPP::RSASS;
-
-#include "pssr.h"
using CryptoPP::PSS;
-
-#include "sha.h"
using CryptoPP::SHA256;
-
-#include "secblock.h"
using CryptoPP::SecByteBlock;
-
-#include "osrng.h"
using CryptoPP::AutoSeededRandomPool;
#include "rsa-pss.h"