Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tests"]
path = tests
url = https://github.com/Cryptolens/cryptolens-cpp-tests
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ if(NOT WIN32)
set (SRC ${SRC} "src/RequestHandler_curl_cacerts.cpp")
endif ()
endif ()

set (CRYPTOLENS_BUILD_MACHINE_CODE_SYSTEMDDBUSINODES OFF CACHE BOOL "build with MachineCodeComputer_SystemdDBusInodes_SHA256?")
if (CRYPTOLENS_BUILD_MACHINE_CODE_SYSTEMDDBUSINODES)
list (APPEND SRC "src/MachineCodeComputer_SystemdDBusInodes_SHA256.cpp")
endif()
else()
add_definitions (-DUNICODE -D_UNICODE)

Expand All @@ -46,7 +51,7 @@ add_library (cryptolens ${CRYPTOLENS_LIBRARY_TYPE} ${SRC})
target_link_libraries (cryptolens ${LIBS})
target_include_directories (cryptolens PRIVATE "${cryptolens_SOURCE_DIR}/include/cryptolens")
target_include_directories (cryptolens PUBLIC "${cryptolens_SOURCE_DIR}/include")
set_property (TARGET cryptolens PROPERTY CXX_STANDARD 17)
set_property (TARGET cryptolens PROPERTY CXX_STANDARD 11)
set_property (TARGET cryptolens PROPERTY CXX_STANDARD_REQUIRED ON)

if (${CRYPTOLENS_BUILD_TESTS})
Expand Down
10 changes: 5 additions & 5 deletions examples/unix/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,30 @@ add_subdirectory ("../../.." "cryptolens-cpp")

add_executable(example_activate ../example_activate.cpp)
target_link_libraries(example_activate cryptolens)
set_property(TARGET example_activate PROPERTY CXX_STANDARD 17)
set_property(TARGET example_activate PROPERTY CXX_STANDARD 11)
set_property(TARGET example_activate PROPERTY CXX_STANDARD_REQUIRED ON)
install(TARGETS example_activate DESTINATION bin)

add_executable(example_create_trial_key ../example_create_trial_key.cpp)
target_link_libraries(example_create_trial_key cryptolens)
set_property(TARGET example_create_trial_key PROPERTY CXX_STANDARD 17)
set_property(TARGET example_create_trial_key PROPERTY CXX_STANDARD 11)
set_property(TARGET example_create_trial_key PROPERTY CXX_STANDARD_REQUIRED ON)
install(TARGETS example_create_trial_key DESTINATION bin)

add_executable(example_external ../example_external.cpp)
target_link_libraries(example_external cryptolens)
set_property(TARGET example_external PROPERTY CXX_STANDARD 17)
set_property(TARGET example_external PROPERTY CXX_STANDARD 11)
set_property(TARGET example_external PROPERTY CXX_STANDARD_REQUIRED ON)
install(TARGETS example_external DESTINATION bin)

add_executable(example_floating ../example_floating.cpp)
target_link_libraries(example_floating cryptolens)
set_property(TARGET example_floating PROPERTY CXX_STANDARD 17)
set_property(TARGET example_floating PROPERTY CXX_STANDARD 11)
set_property(TARGET example_floating PROPERTY CXX_STANDARD_REQUIRED ON)
install(TARGETS example_floating DESTINATION bin)

add_executable(example_offline ../example_offline.cpp)
target_link_libraries(example_offline cryptolens)
set_property(TARGET example_offline PROPERTY CXX_STANDARD 17)
set_property(TARGET example_offline PROPERTY CXX_STANDARD 11)
set_property(TARGET example_offline PROPERTY CXX_STANDARD_REQUIRED ON)
install(TARGETS example_offline DESTINATION bin)
2 changes: 1 addition & 1 deletion include/cryptolens/imports/ArduinoJson5/ArduinoJson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

#else

#include <ArduinoJson.hpp>
#include "../../../../third_party/ArduinoJson5/ArduinoJson.hpp"

#endif
10 changes: 5 additions & 5 deletions include/cryptolens/imports/std/optional
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#ifdef CRYPTOLENS_SHORT_INCLUDE_PATHS

#include <optional>
#include <optional.hpp>

#else

#include <optional>
#include "../../../../third_party/optional-lite/optional.hpp"

#endif

Expand All @@ -15,10 +15,10 @@ namespace cryptolens_io {
namespace v20190401 {

template<typename T>
using optional = std::optional<T>;
using optional = ::nonstd::optional<T>;

using std::make_optional;
using std::nullopt;
using ::nonstd::make_optional;
using ::nonstd::nullopt;

} // namespace v20190401

Expand Down
3,445 changes: 3,445 additions & 0 deletions src/RequestHandler_curl_cacerts.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests
Submodule tests added at c8971d
17 changes: 17 additions & 0 deletions third_party/ArduinoJson5/ArduinoJson.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License

#pragma once

#ifdef __cplusplus

#include "ArduinoJson.hpp"

using namespace ArduinoJson;

#else

#error ArduinoJson requires a C++ compiler, please change file extension to .cc or .cpp

#endif
21 changes: 21 additions & 0 deletions third_party/ArduinoJson5/ArduinoJson.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License

#pragma once

#include "ArduinoJson/version.hpp"

#include "ArduinoJson/DynamicJsonBuffer.hpp"
#include "ArduinoJson/JsonArray.hpp"
#include "ArduinoJson/JsonObject.hpp"
#include "ArduinoJson/StaticJsonBuffer.hpp"

#include "ArduinoJson/Deserialization/JsonParserImpl.hpp"
#include "ArduinoJson/JsonArrayImpl.hpp"
#include "ArduinoJson/JsonBufferImpl.hpp"
#include "ArduinoJson/JsonObjectImpl.hpp"
#include "ArduinoJson/JsonVariantImpl.hpp"
#include "ArduinoJson/Serialization/JsonSerializerImpl.hpp"

#include "ArduinoJson/compatibility.hpp"
151 changes: 151 additions & 0 deletions third_party/ArduinoJson5/ArduinoJson/Configuration.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License

#pragma once

// Small or big machine?
#ifndef ARDUINOJSON_EMBEDDED_MODE
#if defined(ARDUINO) || defined(__IAR_SYSTEMS_ICC__) || defined(__XC) || \
defined(__ARMCC_VERSION)
#define ARDUINOJSON_EMBEDDED_MODE 1
#else
#define ARDUINOJSON_EMBEDDED_MODE 0
#endif
#endif

#if ARDUINOJSON_EMBEDDED_MODE

// Store floats by default to reduce the memory usage (issue #134)
#ifndef ARDUINOJSON_USE_DOUBLE
#define ARDUINOJSON_USE_DOUBLE 0
#endif

// Store longs by default, because they usually match the size of a float.
#ifndef ARDUINOJSON_USE_LONG_LONG
#define ARDUINOJSON_USE_LONG_LONG 0
#endif
#ifndef ARDUINOJSON_USE_INT64
#define ARDUINOJSON_USE_INT64 0
#endif

// Embedded systems usually don't have std::string
#ifndef ARDUINOJSON_ENABLE_STD_STRING
#define ARDUINOJSON_ENABLE_STD_STRING 0
#endif

// Embedded systems usually don't have std::stream
#ifndef ARDUINOJSON_ENABLE_STD_STREAM
#define ARDUINOJSON_ENABLE_STD_STREAM 0
#endif

// Limit nesting as the stack is likely to be small
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
#define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10
#endif

#else // ARDUINOJSON_EMBEDDED_MODE

// On a computer we have plenty of memory so we can use doubles
#ifndef ARDUINOJSON_USE_DOUBLE
#define ARDUINOJSON_USE_DOUBLE 1
#endif

// Use long long when available
#ifndef ARDUINOJSON_USE_LONG_LONG
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
#define ARDUINOJSON_USE_LONG_LONG 1
#else
#define ARDUINOJSON_USE_LONG_LONG 0
#endif
#endif

// Use _int64 on old versions of Visual Studio
#ifndef ARDUINOJSON_USE_INT64
#if defined(_MSC_VER) && _MSC_VER <= 1700
#define ARDUINOJSON_USE_INT64 1
#else
#define ARDUINOJSON_USE_INT64 0
#endif
#endif

// On a computer, we can use std::string
#ifndef ARDUINOJSON_ENABLE_STD_STRING
#define ARDUINOJSON_ENABLE_STD_STRING 1
#endif

// On a computer, we can assume std::stream
#ifndef ARDUINOJSON_ENABLE_STD_STREAM
#define ARDUINOJSON_ENABLE_STD_STREAM 1
#endif

// On a computer, the stack is large so we can increase nesting limit
#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT
#define ARDUINOJSON_DEFAULT_NESTING_LIMIT 50
#endif

#endif // ARDUINOJSON_EMBEDDED_MODE

#ifdef ARDUINO

// Enable support for Arduino String
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
#endif

// Enable support for Arduino Stream
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1
#endif

#else // ARDUINO

// Disable support for Arduino String
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0
#endif

// Disable support for Arduino Stream
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0
#endif

#endif // ARDUINO

#ifndef ARDUINOJSON_ENABLE_PROGMEM
#ifdef PROGMEM
#define ARDUINOJSON_ENABLE_PROGMEM 1
#else
#define ARDUINOJSON_ENABLE_PROGMEM 0
#endif
#endif

#ifndef ARDUINOJSON_ENABLE_ALIGNMENT
#ifdef ARDUINO_ARCH_AVR
// alignment isn't needed for 8-bit AVR
#define ARDUINOJSON_ENABLE_ALIGNMENT 0
#else
// but most processors need pointers to be align on word size
#define ARDUINOJSON_ENABLE_ALIGNMENT 1
#endif
#endif

// Enable deprecated functions by default
#ifndef ARDUINOJSON_ENABLE_DEPRECATED
#define ARDUINOJSON_ENABLE_DEPRECATED 1
#endif

// Control the exponentiation threshold for big numbers
// CAUTION: cannot be more that 1e9 !!!!
#ifndef ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD
#define ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD 1e7
#endif

// Control the exponentiation threshold for small numbers
#ifndef ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD
#define ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD 1e-5
#endif

#if ARDUINOJSON_USE_LONG_LONG && ARDUINOJSON_USE_INT64
#error ARDUINOJSON_USE_LONG_LONG and ARDUINOJSON_USE_INT64 cannot be set together
#endif
37 changes: 37 additions & 0 deletions third_party/ArduinoJson5/ArduinoJson/Data/Encoding.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License

#pragma once

namespace ArduinoJson {
namespace Internals {

class Encoding {
public:
// Optimized for code size on a 8-bit AVR
static char escapeChar(char c) {
const char *p = escapeTable(false);
while (p[0] && p[1] != c) {
p += 2;
}
return p[0];
}

// Optimized for code size on a 8-bit AVR
static char unescapeChar(char c) {
const char *p = escapeTable(true);
for (;;) {
if (p[0] == '\0') return c;
if (p[0] == c) return p[1];
p += 2;
}
}

private:
static const char *escapeTable(bool excludeIdenticals) {
return &"\"\"\\\\b\bf\fn\nr\rt\t"[excludeIdenticals ? 4 : 0];
}
};
} // namespace Internals
} // namespace ArduinoJson
22 changes: 22 additions & 0 deletions third_party/ArduinoJson5/ArduinoJson/Data/JsonBufferAllocated.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License

#pragma once

#include "../JsonBuffer.hpp"

namespace ArduinoJson {
namespace Internals {

class JsonBufferAllocated {
public:
void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() {
if (!jsonBuffer) return NULL;
return jsonBuffer->alloc(n);
}

void operator delete(void *, JsonBuffer *)throw();
};
} // namespace Internals
} // namespace ArduinoJson
18 changes: 18 additions & 0 deletions third_party/ArduinoJson5/ArduinoJson/Data/JsonFloat.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License

#pragma once

#include "../Configuration.hpp"

namespace ArduinoJson {
namespace Internals {

#if ARDUINOJSON_USE_DOUBLE
typedef double JsonFloat;
#else
typedef float JsonFloat;
#endif
} // namespace Internals
} // namespace ArduinoJson
23 changes: 23 additions & 0 deletions third_party/ArduinoJson5/ArduinoJson/Data/JsonInteger.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License

#pragma once

#include "../Configuration.hpp"

namespace ArduinoJson {
namespace Internals {

#if ARDUINOJSON_USE_LONG_LONG
typedef long long JsonInteger;
typedef unsigned long long JsonUInt;
#elif ARDUINOJSON_USE_INT64
typedef __int64 JsonInteger;
typedef unsigned _int64 JsonUInt;
#else
typedef long JsonInteger;
typedef unsigned long JsonUInt;
#endif
} // namespace Internals
} // namespace ArduinoJson
Loading