Skip to content

Commit 05fa472

Browse files
committed
Make cryptopp work
* include cryptopp headers with quotes otherwise compiler on Linux can't see them * use different cryptopp types for windows and linux because MXE-built cryptopp version doesn't support CryptoPP:byte and make refuses to build old cryptopp version on without errors
1 parent 0a1525a commit 05fa472

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ endif()
5757

5858
add_definitions(-DUID_PUBKEY_BYTES=${UID_PUBKEY_BYTES})
5959

60+
if (WIN32)
61+
add_definitions(-DWIN32FAFUID)
62+
endif()
63+
6064
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
6165

6266
add_executable(faf-uid

uid.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#include <cassert>
44
#include <stdint.h>
55

6-
#include <cryptopp/aes.h>
7-
#include <cryptopp/modes.h>
8-
#include <cryptopp/osrng.h>
9-
#include <cryptopp/rsa.h>
10-
#include <cryptopp/base64.h>
11-
#include <cryptopp/integer.h>
12-
#include <cryptopp/files.h>
6+
#include "cryptopp/aes.h"
7+
#include "cryptopp/modes.h"
8+
#include "cryptopp/osrng.h"
9+
#include "cryptopp/rsa.h"
10+
#include "cryptopp/base64.h"
11+
#include "cryptopp/integer.h"
12+
#include "cryptopp/files.h"
1313

1414
#include <json/json.h>
1515

@@ -134,9 +134,15 @@ int main(int argc, char *argv[])
134134
new CryptoPP::FileSink(std::cout), false /*insertLineBreaks*/
135135
);
136136
b.Put(paddingSize);
137+
#ifdef WIN32FAFUID
137138
b.Put(reinterpret_cast<const byte*>(iv_b64.c_str()), iv_b64.size());
138139
b.Put(reinterpret_cast<const byte*>(json_string_encrypted_b64.c_str()), json_string_encrypted_b64.size());
139140
b.Put(reinterpret_cast<const byte*>(aes_key_encrypted_base64.c_str()), aes_key_encrypted_base64.size());
141+
#else
142+
b.Put(reinterpret_cast<const CryptoPP::byte*>(iv_b64.c_str()), iv_b64.size());
143+
b.Put(reinterpret_cast<const CryptoPP::byte*>(json_string_encrypted_b64.c_str()), json_string_encrypted_b64.size());
144+
b.Put(reinterpret_cast<const CryptoPP::byte*>(aes_key_encrypted_base64.c_str()), aes_key_encrypted_base64.size());
145+
#endif
140146
b.MessageEnd();
141147
}
142148
}

0 commit comments

Comments
 (0)