diff --git a/README.md b/README.md index 52238be..9ae1868 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ Generování licence pro SD kartu +## version 1.1 +- oprava #define direktiv pro celý kod (zapínání debugu, detailního výpisu a kompletního zakomentování kodu) + ## version 1.0 - startovací publikační verze. Implementováno generování a čtení ELC1, ELC2 i ELC3 diff --git a/docker/Dockerfile b/docker/Dockerfile index 272475f..505b34e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,6 +11,9 @@ RUN chmod 755 /app/start.sh COPY ./startok.sh /app/ RUN chmod 755 /app/startok.sh +COPY ./startuid.sh /app/ +RUN chmod 755 /app/startuid.sh + COPY ./lread.sh /app/ RUN chmod 755 /app/lread.sh diff --git a/include/common/SDCard.h b/include/common/SDCard.h index 834d9d0..8c53f50 100644 --- a/include/common/SDCard.h +++ b/include/common/SDCard.h @@ -1,8 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #ifndef SDCARD_H_ #define SDCARD_H_ +#include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #define CID_LENGTH 32 #define CSD_LENGTH 32 diff --git a/include/common/licConnector.h b/include/common/licConnector.h new file mode 100644 index 0000000..9ee7045 --- /dev/null +++ b/include/common/licConnector.h @@ -0,0 +1,10 @@ +#ifndef LICCONNECTOR_H_INCLUDED +#define LICCONNECTOR_H_INCLUDED + +#include "lic_config.h" + +//#include "../../_src/_main/Ez_automaincfg.h" + +//#define EZ_APPLICATION_LICENCE_DISABLE + +#endif // LICCONNECTOR_H_INCLUDED \ No newline at end of file diff --git a/include/common/lic_config.h b/include/common/lic_config.h new file mode 100644 index 0000000..dd37190 --- /dev/null +++ b/include/common/lic_config.h @@ -0,0 +1,7 @@ +#ifndef LIC_CONFIG_H_INCLUDED +#define LIC_CONFIG_H_INCLUDED + +//#define EZ_LIC_DEBUG //zapíná debug pro windows. Pro produkci je potřeba nechat zakomentované +//#define EZ_LIC_DEBUG_SHOW_DETAILS //zapíná detailní výpis při čtení licene. Pro produkci je potřeba nechat zakomentované + +#endif \ No newline at end of file diff --git a/include/common/licenceCommon.h b/include/common/licenceCommon.h index c68bf77..2972e07 100644 --- a/include/common/licenceCommon.h +++ b/include/common/licenceCommon.h @@ -1,10 +1,11 @@ +#ifndef LICENCE_COMMON_H_ +#define LICENCE_COMMON_H_ + +#include "licConnector.h" #ifndef EZ_APPLICATION_LICENCE_DISABLE #define CRC = 1 -#ifndef LICENCE_COMMON_H_ -#define LICENCE_COMMON_H_ - //---------------- společná hlavička pro všechny licence ---------------- #include diff --git a/include/common/licenceELC1.h b/include/common/licenceELC1.h index 4a498f7..9bb4548 100644 --- a/include/common/licenceELC1.h +++ b/include/common/licenceELC1.h @@ -1,8 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #ifndef PLC_LICENCE1_COMMON_H #define PLC_LICENCE1_COMMON_H +#include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #include #include "licenceCommon.h" #include "SDCard.h" diff --git a/include/common/licenceELC2.h b/include/common/licenceELC2.h index 7801a2d..369e50d 100644 --- a/include/common/licenceELC2.h +++ b/include/common/licenceELC2.h @@ -1,8 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #ifndef PLC_LICENCE2_COMMON_H #define PLC_LICENCE2_COMMON_H +#include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #include #include "licenceCommon.h" #include "SDCard.h" diff --git a/include/common/licenceELC3.h b/include/common/licenceELC3.h index 4e6f90a..136da79 100644 --- a/include/common/licenceELC3.h +++ b/include/common/licenceELC3.h @@ -1,8 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #ifndef PLC_LICENCE3_COMMON_H #define PLC_LICENCE3_COMMON_H +#include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #define UID_LENGTH 32 #include diff --git a/include/common/utils.h b/include/common/utils.h index 259f0f8..fd619cd 100644 --- a/include/common/utils.h +++ b/include/common/utils.h @@ -1,8 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #ifndef UTILS_H_ #define UTILS_H_ +#include "licConnector.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #include #include #include diff --git a/include/generator/licenceGenerator.h b/include/generator/licenceGenerator.h index 479e156..8d558ba 100644 --- a/include/generator/licenceGenerator.h +++ b/include/generator/licenceGenerator.h @@ -1,3 +1,5 @@ +#include "licenceCommon.h" + #ifndef LICENCE_GENERATOR_H_ #define LICENCE_GENERATOR_H_ @@ -8,7 +10,6 @@ #include #include #include "pugixml.hpp" -#include "licenceCommon.h" #include "licGenELC1.h" #include "licGenELC2.h" diff --git a/include/reader/licReaderELC1.h b/include/reader/licReaderELC1.h index b747bd6..b09d016 100644 --- a/include/reader/licReaderELC1.h +++ b/include/reader/licReaderELC1.h @@ -1,9 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #ifndef ELC1_READER__H #define ELC1_READER__H #include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #include "licenceCommon.h" #include "licenceELC1.h" #include "SDCard.h" diff --git a/include/reader/licReaderELC2.h b/include/reader/licReaderELC2.h index fd0cfcc..2c0e7cf 100644 --- a/include/reader/licReaderELC2.h +++ b/include/reader/licReaderELC2.h @@ -1,8 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE #ifndef ELC2_READER_H #define ELC2_READER_H #include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #include "licenceCommon.h" #include "licenceELC2.h" #include "SDCard.h" diff --git a/include/reader/licReaderELC3.h b/include/reader/licReaderELC3.h index 48fd71d..8de9ae7 100644 --- a/include/reader/licReaderELC3.h +++ b/include/reader/licReaderELC3.h @@ -1,9 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #ifndef ELC3_READER__H #define ELC3_READER__H #include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #include "licenceCommon.h" #include "licenceELC3.h" diff --git a/include/reader/licenceReader.h b/include/reader/licenceReader.h index 1e03fb8..37b09fc 100644 --- a/include/reader/licenceReader.h +++ b/include/reader/licenceReader.h @@ -1,9 +1,9 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #ifndef LICENCE_READER_H_ #define LICENCE_READER_H_ #include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #include "SDCard.h" #include "licReaderELC1.h" #include "licReaderELC2.h" diff --git a/output/ezlic_drt0_aaaaaaaaaaa.lic b/output/ezlic_drt0_jjacdgpdxpb.lic similarity index 60% rename from output/ezlic_drt0_aaaaaaaaaaa.lic rename to output/ezlic_drt0_jjacdgpdxpb.lic index c319d94..7cfcaa6 100644 Binary files a/output/ezlic_drt0_aaaaaaaaaaa.lic and b/output/ezlic_drt0_jjacdgpdxpb.lic differ diff --git a/output/ezlic_drt0_xxbxdjhxyhc.lic b/output/ezlic_drt0_xxbxdjhxyhc.lic index b0464cf..2b3c5a4 100644 Binary files a/output/ezlic_drt0_xxbxdjhxyhc.lic and b/output/ezlic_drt0_xxbxdjhxyhc.lic differ diff --git a/output/ezlic_eovosv0_wqxcyjpdxji.lic b/output/ezlic_eovosv0_wqxcyjpdxji.lic index 3574cb3..d473352 100644 Binary files a/output/ezlic_eovosv0_wqxcyjpdxji.lic and b/output/ezlic_eovosv0_wqxcyjpdxji.lic differ diff --git a/output/ezlic_eovosv0_wqxcyjpdxji.lica b/output/ezlic_eovosv0_wqxcyjpdxji.lica new file mode 100644 index 0000000..364aaa3 Binary files /dev/null and b/output/ezlic_eovosv0_wqxcyjpdxji.lica differ diff --git a/output/licData.xml b/output/licData.xml index 128ea8e..ff346fa 100644 --- a/output/licData.xml +++ b/output/licData.xml @@ -1,8 +1,39 @@ - - -EOV_OSV + + +DRT wago Licence pro EOV_OSV -zst.ceskatrebova.ddts.cz -ROV21 +Licence ELC3 + + +pt_Ez_interHW +0 +3 + + +pt_Ez_buffer +1 +4294967295 + + +pt_Ez_webs +2 +4294967295 + + +pt_Ez_iec104c +5 +55 + + +pt_Ez_iec104s +6 +66 + + +pt_Ez_iec61850c +7 +77 + + \ No newline at end of file diff --git a/output/licDataTest.xml b/output/licDataTest.xml deleted file mode 100644 index 128ea8e..0000000 --- a/output/licDataTest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - -EOV_OSV -wago -Licence pro EOV_OSV -zst.ceskatrebova.ddts.cz -ROV21 - \ No newline at end of file diff --git a/output/licenceGenerator b/output/licenceGenerator index cff66bd..e5ada3c 100644 Binary files a/output/licenceGenerator and b/output/licenceGenerator differ diff --git a/src/CreateLicence.cpp b/src/CreateLicence.cpp index cc52d9c..553cb00 100644 --- a/src/CreateLicence.cpp +++ b/src/CreateLicence.cpp @@ -1,17 +1,15 @@ +#include "reader/licenceReader.h" + #ifndef EZ_APPLICATION_LICENCE_DISABLE -#define LINUX 1 -//#define WINDOWS 1 -//#define READ 1 #include #include "licenceGenerator.h" -#include "reader/licenceReader.h" /// @brief hlavní funkce /// @param argc /// @param argv parametry pro generování licence /// @return -int main(int argc, char *argv[]) +int main8(int argc, char *argv[]) { unordered_map arguments = getArguments(argc, argv); try diff --git a/src/ReadLicence.cpp b/src/ReadLicence.cpp index 559ba4e..ec2bf7c 100644 --- a/src/ReadLicence.cpp +++ b/src/ReadLicence.cpp @@ -1,15 +1,13 @@ +#include "licenceReader.h" + #ifndef EZ_APPLICATION_LICENCE_DISABLE -#define LINUX 1 -//#define WINDOWS 1 - -#include "licenceReader.h" /// @brief hlavní funkce /// @param argc /// @param argv parametry pro generování licence /// @return -int main9() +int main() { // buffer,850client,104client, 104server, web // kouknout na unikatní klíc pro linux (native uid, i openssl neco má) @@ -26,31 +24,25 @@ int main9() initStructure.cid_csd_filePath = ""; // cesta k cidu/csd pro načtení a kontrolu licence initStructure.uid_filePath = ""; // cesta k souboru machine-id. (/etc/machine-id), takze by mělo být /etc/. - - //---------------------------------------- ELC3 ---------------------------------------------------------- - //verze ELC 3 pro jeden protokol. Oproti ELC2 je potřeba přidat cestu k uid/machine-id v initStructure - LicenceReader licenceReaderELC3{}; - if (licenceReaderELC3.initread(3, initStructure)) // iniciacni nacteni + //verze původní ELC 1, zatím zůstává staré řešení + LicenceReader licenceReaderELC1{}; + if (licenceReaderELC1.initread(1, initStructure)) // iniciacni nacteni { - LicenceELC3Item info; // podle ELC a kompatibility určit strukuru (LicenceInfo1, LicenceInfo2, LicenceInfo3) - // if () - int protocolId = 7; - - if (licenceReaderELC3.getLicenceItemInfo(protocolId, &info)) + LicenceELC1Info info; // struktura pro ELC1. Nemá tam asi nic jiného smysl nez true/false + if (licenceReaderELC1.getLicenceInfo(&info)) { - cout << "Pocet licencních bodu pro " << info.protocolId << ": " << info.dataPointsCount << std::endl; + if (info.isValid) + cout << "Platna licence ELC1 \n"; + else + cout << "Neplatna licence ELC1\n"; } else - cout << "Tento protokol nemá body"; + cout << "CHYBA: " << licenceReaderELC1.error.message; } else { - cout << "CHYBA: " << licenceReaderELC3.error.message; + cout << "CHYBA: " << licenceReaderELC1.error.message; } - //---------------------------------------- ELC3 ---------------------------------------------------------- - system("pause"); - return SUCCES; - // verze ELC 2 pro jeden protokol LicenceReader licenceReaderELC2{}; @@ -96,6 +88,32 @@ int main9() cout << "CHYBA: " << licenceReaderELC2.error.message; } + //---------------------------------------- ELC3 ---------------------------------------------------------- + //verze ELC 3 pro jeden protokol. Oproti ELC2 je potřeba přidat cestu k uid/machine-id v initStructure + LicenceReader licenceReaderELC3{}; + if (licenceReaderELC3.initread(3, initStructure)) // iniciacni nacteni + { + LicenceELC3Item info; // podle ELC a kompatibility určit strukuru (LicenceInfo1, LicenceInfo2, LicenceInfo3) + // if () + int protocolId = 7; + + if (licenceReaderELC3.getLicenceItemInfo(protocolId, &info)) + { + cout << "Pocet licencních bodu pro " << info.protocolId << ": " << info.dataPointsCount << std::endl; + } + else + cout << "Tento protokol nemá body"; + } + else + { + cout << "CHYBA: " << licenceReaderELC3.error.message; + } + //---------------------------------------- ELC3 ---------------------------------------------------------- + + + + + // verze ELC 2 kompletní načtení /* LicenceReader licenceReaderCompleteELC2{}; diff --git a/src/common/SDCard.cpp b/src/common/SDCard.cpp index 56f7923..47682d6 100644 --- a/src/common/SDCard.cpp +++ b/src/common/SDCard.cpp @@ -1,7 +1,5 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - -#include "utils.h" #include "SDCard.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE SDCard::SDCard() { diff --git a/src/common/SDCard.d b/src/common/SDCard.d new file mode 100644 index 0000000..1886823 --- /dev/null +++ b/src/common/SDCard.d @@ -0,0 +1,3 @@ +src/common/SDCard.o: src/common/SDCard.cpp include/common/SDCard.h \ + include/common/utils.h include/common/licConnector.h \ + include/common/lic_config.h diff --git a/src/common/SDCard.o b/src/common/SDCard.o new file mode 100644 index 0000000..68911e2 Binary files /dev/null and b/src/common/SDCard.o differ diff --git a/src/common/licenceELC1.cpp b/src/common/licenceELC1.cpp index 64d519b..445386c 100644 --- a/src/common/licenceELC1.cpp +++ b/src/common/licenceELC1.cpp @@ -1,8 +1,5 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - - #include "licenceELC1.h" -#include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE #define CID_LENGTH 32 #define CSD_LENGTH 32 diff --git a/src/common/licenceELC1.d b/src/common/licenceELC1.d new file mode 100644 index 0000000..adf69bc --- /dev/null +++ b/src/common/licenceELC1.d @@ -0,0 +1,4 @@ +src/common/licenceELC1.o: src/common/licenceELC1.cpp \ + include/common/licenceELC1.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h include/common/SDCard.h diff --git a/src/common/licenceELC1.o b/src/common/licenceELC1.o new file mode 100644 index 0000000..0a83fd6 Binary files /dev/null and b/src/common/licenceELC1.o differ diff --git a/src/common/licenceELC2.cpp b/src/common/licenceELC2.cpp index f420c94..79c1e22 100644 --- a/src/common/licenceELC2.cpp +++ b/src/common/licenceELC2.cpp @@ -1,8 +1,5 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - - #include "licenceELC2.h" -#include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE LicenceELC2::LicenceELC2() {} diff --git a/src/common/licenceELC2.d b/src/common/licenceELC2.d new file mode 100644 index 0000000..ede644f --- /dev/null +++ b/src/common/licenceELC2.d @@ -0,0 +1,4 @@ +src/common/licenceELC2.o: src/common/licenceELC2.cpp \ + include/common/licenceELC2.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h include/common/SDCard.h diff --git a/src/common/licenceELC2.o b/src/common/licenceELC2.o new file mode 100644 index 0000000..d061d0e Binary files /dev/null and b/src/common/licenceELC2.o differ diff --git a/src/common/licenceELC3.cpp b/src/common/licenceELC3.cpp index 3870a8b..c908ba4 100644 --- a/src/common/licenceELC3.cpp +++ b/src/common/licenceELC3.cpp @@ -1,7 +1,5 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #include "licenceELC3.h" -#include "utils.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE LicenceELC3::LicenceELC3() {} diff --git a/src/common/licenceELC3.d b/src/common/licenceELC3.d new file mode 100644 index 0000000..019497a --- /dev/null +++ b/src/common/licenceELC3.d @@ -0,0 +1,4 @@ +src/common/licenceELC3.o: src/common/licenceELC3.cpp \ + include/common/licenceELC3.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h diff --git a/src/common/licenceELC3.o b/src/common/licenceELC3.o new file mode 100644 index 0000000..aab37ee Binary files /dev/null and b/src/common/licenceELC3.o differ diff --git a/src/common/utils.cpp b/src/common/utils.cpp index 1edc1a0..aa9797d 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -1,11 +1,10 @@ - +#include "utils.h" #ifndef EZ_APPLICATION_LICENCE_DISABLE -//#define WINDOWS 1 -#define LINUX 1 #include #include /* core library */ -#include "utils.h" + +using namespace std; using namespace std; @@ -93,8 +92,8 @@ DATE getLicDate() int seconds = 1 * local_time->tm_sec; int totalSeconds = hoursSeconds + minutesSeconds + seconds; -#ifdef WINDOWS - DATE dateOnly = ttime - totalSeconds + 7200; // (pro windows); // 7200 + vteřina za dvě hodiny pro srování +#ifdef EZ_LIC_DEBUG + DATE dateOnly = ttime - totalSeconds + 7200; // (pro win); // 7200 + vteřina za dvě hodiny pro srování #else DATE dateOnly = ttime - totalSeconds; #endif @@ -337,7 +336,7 @@ unordered_map getArguments(int argc, char *argv[]) string getCompletePath(string fileName) { -#ifdef WINDOWS +#ifdef EZ_LIC_DEBUG return fileName; #else char path[PATH_MAX + 1] = {}; diff --git a/src/common/utils.d b/src/common/utils.d new file mode 100644 index 0000000..d606683 --- /dev/null +++ b/src/common/utils.d @@ -0,0 +1,29 @@ +src/common/utils.o: src/common/utils.cpp include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/openssl/conf.h include/openssl/macros.h \ + include/openssl/opensslconf.h include/openssl/configuration.h \ + include/openssl/opensslv.h include/openssl/bio.h include/openssl/e_os2.h \ + include/openssl/crypto.h include/openssl/safestack.h \ + include/openssl/stack.h include/openssl/types.h \ + include/openssl/cryptoerr.h include/openssl/symhacks.h \ + include/openssl/cryptoerr_legacy.h include/openssl/core.h \ + include/openssl/bioerr.h include/openssl/lhash.h \ + include/openssl/conferr.h include/openssl/conftypes.h \ + include/openssl/ssl.h include/openssl/comp.h include/openssl/comperr.h \ + include/openssl/x509.h include/openssl/buffer.h \ + include/openssl/buffererr.h include/openssl/evp.h \ + include/openssl/core_dispatch.h include/openssl/evperr.h \ + include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \ + include/openssl/objects.h include/openssl/obj_mac.h \ + include/openssl/asn1.h include/openssl/asn1err.h \ + include/openssl/objectserr.h include/openssl/ec.h \ + include/openssl/ecerr.h include/openssl/rsa.h include/openssl/rsaerr.h \ + include/openssl/dsa.h include/openssl/dh.h include/openssl/dherr.h \ + include/openssl/dsaerr.h include/openssl/sha.h include/openssl/x509err.h \ + include/openssl/x509_vfy.h include/openssl/pkcs7.h \ + include/openssl/pkcs7err.h include/openssl/http.h include/openssl/pem.h \ + include/openssl/pemerr.h include/openssl/hmac.h include/openssl/async.h \ + include/openssl/asyncerr.h include/openssl/ct.h include/openssl/cterr.h \ + include/openssl/sslerr.h include/openssl/sslerr_legacy.h \ + include/openssl/prov_ssl.h include/openssl/ssl2.h include/openssl/ssl3.h \ + include/openssl/tls1.h include/openssl/dtls1.h include/openssl/srtp.h diff --git a/src/common/utils.o b/src/common/utils.o new file mode 100644 index 0000000..8186d14 Binary files /dev/null and b/src/common/utils.o differ diff --git a/src/generator/LicenceGenerator.cpp b/src/generator/LicenceGenerator.cpp index 8fa7f93..0a3913d 100644 --- a/src/generator/LicenceGenerator.cpp +++ b/src/generator/LicenceGenerator.cpp @@ -6,8 +6,6 @@ #include "pugixml.hpp" #include -#define LINUX 1 - LicenceGenerator::LicenceGenerator() { } @@ -48,7 +46,7 @@ bool LicenceGenerator::processInputConfiguration() char fileName[fileNameLength] = {}; getCharsFromString(fullFile, fileName, fileNameLength); -#ifdef WINDOWS +#ifdef EZ_LIC_DEBUG pugi::xml_parse_result result = doc.load_file("licData.xml"); #else pugi::xml_parse_result result = doc.load_file(fileName); diff --git a/src/generator/LicenceGenerator.d b/src/generator/LicenceGenerator.d new file mode 100644 index 0000000..c892774 --- /dev/null +++ b/src/generator/LicenceGenerator.d @@ -0,0 +1,10 @@ +src/generator/LicenceGenerator.o: src/generator/LicenceGenerator.cpp \ + include/generator/licenceGenerator.h include/common/licenceCommon.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/generator/pugixml.hpp include/generator/pugiconfig.hpp \ + include/generator/licGenELC1.h include/common/utils.h \ + include/common/licenceELC1.h include/common/utils.h \ + include/common/licenceCommon.h include/common/SDCard.h \ + include/common/SDCard.h include/generator/licGenELC2.h \ + include/common/licenceELC2.h include/generator/licGenELC3.h \ + include/common/licenceELC3.h include/generator/pugixml.hpp diff --git a/src/generator/LicenceGenerator.o b/src/generator/LicenceGenerator.o new file mode 100644 index 0000000..140381c Binary files /dev/null and b/src/generator/LicenceGenerator.o differ diff --git a/src/generator/licGenELC1.cpp b/src/generator/licGenELC1.cpp index 73e25a3..4ea2bb3 100644 --- a/src/generator/licGenELC1.cpp +++ b/src/generator/licGenELC1.cpp @@ -34,7 +34,7 @@ namespace Generator getCharsFromString(fullFile, fileName, fileNameLength); pugi::xml_document doc; -#ifdef WINDOWS +#ifdef EZ_LIC_DEBUG pugi::xml_parse_result result = doc.load_file("licData.xml"); #else pugi::xml_parse_result result = doc.load_file(fileName); @@ -186,7 +186,7 @@ namespace Generator if (binaryGeneration == BinaryGenerationType::File) { -#ifdef WINDOWS +#ifdef EZ_LIC_DEBUG char licFileNameToSave[licenseFileName.length()] = {}; getCharsFromString(licenseFileName, licFileNameToSave, licenseFileName.length()); diff --git a/src/generator/licGenELC1.d b/src/generator/licGenELC1.d new file mode 100644 index 0000000..2ce403f --- /dev/null +++ b/src/generator/licGenELC1.d @@ -0,0 +1,7 @@ +src/generator/licGenELC1.o: src/generator/licGenELC1.cpp \ + include/generator/licGenELC1.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h include/common/licenceELC1.h \ + include/common/utils.h include/common/licenceCommon.h \ + include/common/SDCard.h include/common/SDCard.h \ + include/generator/pugixml.hpp include/generator/pugiconfig.hpp diff --git a/src/generator/licGenELC1.o b/src/generator/licGenELC1.o new file mode 100644 index 0000000..7592520 Binary files /dev/null and b/src/generator/licGenELC1.o differ diff --git a/src/generator/licGenELC2.d b/src/generator/licGenELC2.d new file mode 100644 index 0000000..c2b7cab --- /dev/null +++ b/src/generator/licGenELC2.d @@ -0,0 +1,7 @@ +src/generator/licGenELC2.o: src/generator/licGenELC2.cpp \ + include/generator/licGenELC2.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h include/common/licenceELC2.h \ + include/common/utils.h include/common/licenceCommon.h \ + include/common/SDCard.h include/common/SDCard.h \ + include/generator/pugixml.hpp include/generator/pugiconfig.hpp diff --git a/src/generator/licGenELC2.o b/src/generator/licGenELC2.o new file mode 100644 index 0000000..5ec086f Binary files /dev/null and b/src/generator/licGenELC2.o differ diff --git a/src/generator/licGenELC3.cpp b/src/generator/licGenELC3.cpp index 2c06b19..6625015 100644 --- a/src/generator/licGenELC3.cpp +++ b/src/generator/licGenELC3.cpp @@ -211,7 +211,7 @@ namespace Generator appendStringToVector(this->licBody.publicHeader, publicContent); -#ifdef CRCCHECK +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "CRC public size: " << publicContent.size() << "\n"; cout << "CRC gen public: " << calculateCRC16(publicContent) << "\n"; #endif @@ -240,7 +240,7 @@ namespace Generator privateContent.push_back((dataItem.licCount >> 24) & 0xFF); } -#ifdef CRCCHECK +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "CRC private size: " << privateContent.size() << "\n"; cout << "CRC gen private: " << calculateCRC16(privateContent) << "\n"; #endif @@ -248,7 +248,7 @@ namespace Generator vector completeVector = joinVectors(publicContent, privateContent); uint16_t crcComplete = calculateCRC16(completeVector); -#ifdef CRCCHECK +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "CRC complete size: " << completeVector.size() << "\n"; cout << "CRC gen complete: " << crcComplete << "\n"; #endif diff --git a/src/generator/licGenELC3.d b/src/generator/licGenELC3.d new file mode 100644 index 0000000..b780a51 --- /dev/null +++ b/src/generator/licGenELC3.d @@ -0,0 +1,6 @@ +src/generator/licGenELC3.o: src/generator/licGenELC3.cpp \ + include/generator/licGenELC3.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h include/common/licenceELC3.h \ + include/common/utils.h include/common/licenceCommon.h \ + include/generator/pugixml.hpp include/generator/pugiconfig.hpp diff --git a/src/generator/licGenELC3.o b/src/generator/licGenELC3.o new file mode 100644 index 0000000..330fe55 Binary files /dev/null and b/src/generator/licGenELC3.o differ diff --git a/src/generator/pugixml.d b/src/generator/pugixml.d new file mode 100644 index 0000000..fbb73ae --- /dev/null +++ b/src/generator/pugixml.d @@ -0,0 +1,2 @@ +src/generator/pugixml.o: src/generator/pugixml.cpp \ + include/generator/pugixml.hpp include/generator/pugiconfig.hpp diff --git a/src/generator/pugixml.o b/src/generator/pugixml.o new file mode 100644 index 0000000..9f0044a Binary files /dev/null and b/src/generator/pugixml.o differ diff --git a/src/reader/LicenceReader.cpp b/src/reader/LicenceReader.cpp index ceb414c..dd23227 100644 --- a/src/reader/LicenceReader.cpp +++ b/src/reader/LicenceReader.cpp @@ -1,7 +1,5 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - - #include +#ifndef EZ_APPLICATION_LICENCE_DISABLE ELCType licElcType = ELCType::ELC2; LicenceType licLicenceType; diff --git a/src/reader/LicenceReader.d b/src/reader/LicenceReader.d new file mode 100644 index 0000000..84733cf --- /dev/null +++ b/src/reader/LicenceReader.d @@ -0,0 +1,9 @@ +src/reader/LicenceReader.o: src/reader/LicenceReader.cpp \ + include/reader/licenceReader.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/SDCard.h include/common/utils.h \ + include/reader/licReaderELC1.h include/common/licenceCommon.h \ + include/common/licenceELC1.h include/common/licenceCommon.h \ + include/common/SDCard.h include/reader/licReaderELC2.h \ + include/common/licenceELC2.h include/reader/licReaderELC3.h \ + include/common/licenceELC3.h diff --git a/src/reader/LicenceReader.o b/src/reader/LicenceReader.o new file mode 100644 index 0000000..23ba92c Binary files /dev/null and b/src/reader/LicenceReader.o differ diff --git a/src/reader/licReaderELC1.cpp b/src/reader/licReaderELC1.cpp index 62c923d..9169fa1 100644 --- a/src/reader/licReaderELC1.cpp +++ b/src/reader/licReaderELC1.cpp @@ -1,6 +1,5 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #include "licReaderELC1.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE namespace Reader { diff --git a/src/reader/licReaderELC1.d b/src/reader/licReaderELC1.d new file mode 100644 index 0000000..e33a46c --- /dev/null +++ b/src/reader/licReaderELC1.d @@ -0,0 +1,6 @@ +src/reader/licReaderELC1.o: src/reader/licReaderELC1.cpp \ + include/reader/licReaderELC1.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h include/common/licenceELC1.h \ + include/common/utils.h include/common/licenceCommon.h \ + include/common/SDCard.h include/common/SDCard.h diff --git a/src/reader/licReaderELC1.o b/src/reader/licReaderELC1.o new file mode 100644 index 0000000..9b9d3a1 Binary files /dev/null and b/src/reader/licReaderELC1.o differ diff --git a/src/reader/licReaderELC2.cpp b/src/reader/licReaderELC2.cpp index a66fd4b..dc84d0f 100644 --- a/src/reader/licReaderELC2.cpp +++ b/src/reader/licReaderELC2.cpp @@ -1,7 +1,7 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #include "licReaderELC2.h" +#ifndef EZ_APPLICATION_LICENCE_DISABLE + #define SHOW6 1 namespace Reader @@ -36,7 +36,7 @@ namespace Reader throw LicenceException((int)GeneralError::FileOpenError, "Chyba otevření souboru licence: " + licFilePath); } - #ifdef SHOW + #ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "Celý vstup zašifrovaný: \n"; for (const auto &x : content) cout << (int)x << "-"; cout << "\n"; @@ -66,12 +66,12 @@ namespace Reader vector publicPart(content.begin(), content.begin() + 18 + this->licBody.licenceIdentHeader.publicHeaderLength); -#ifdef CRCCHECK +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "CRC read public size: " << publicPart.size() << "\n"; cout << "CRC read public: " << calculateCRC16(publicPart) << "\n"; #endif - #ifdef SHOW + #ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "\n public header length: " << licBody.licenceIdentHeader.publicHeaderLength << "\n" ; #endif @@ -87,7 +87,7 @@ namespace Reader privateContentDecrypted = decryptPrivateContent(encryptedPart); - #ifdef SHOW + #ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "private encryptedsize: " << encryptedPart.size() << "\n"; cout << "private decryptedsize: " << privateContentDecrypted.size() << "\n"; cout << "private decrypted: \n"; @@ -95,7 +95,7 @@ namespace Reader cout << "\n"; #endif -#ifdef CRCCHECK +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "CRC read private size: " << privateContentDecrypted.size() << "\n"; cout << "CRC read private: " << calculateCRC16(privateContentDecrypted) << "\n"; #endif @@ -114,7 +114,7 @@ namespace Reader throw LicenceException((int)GeneralError::ItemsCountMismatch, "Nesouhlasí počet položek licence."); } - #ifdef SHOW + #ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "velikost: " << sizeof(licBodyDecrypted.licenceIdentHeader) << "\n"; #endif @@ -135,7 +135,7 @@ namespace Reader uint16_t crcCalculated = calculateCRC16(completeVector, 2); - #ifdef SHOW + #ifdef EZ_LIC_DEBUG_SHOW_DETAILS // cout << "content: \n"; // for (const auto x : content) cout << (int)x << "-"; diff --git a/src/reader/licReaderELC2.d b/src/reader/licReaderELC2.d new file mode 100644 index 0000000..e323352 --- /dev/null +++ b/src/reader/licReaderELC2.d @@ -0,0 +1,6 @@ +src/reader/licReaderELC2.o: src/reader/licReaderELC2.cpp \ + include/reader/licReaderELC2.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h include/common/licenceELC2.h \ + include/common/utils.h include/common/licenceCommon.h \ + include/common/SDCard.h include/common/SDCard.h diff --git a/src/reader/licReaderELC2.o b/src/reader/licReaderELC2.o new file mode 100644 index 0000000..bf7f671 Binary files /dev/null and b/src/reader/licReaderELC2.o differ diff --git a/src/reader/licReaderELC3.cpp b/src/reader/licReaderELC3.cpp index 001dba5..c16eb8b 100644 --- a/src/reader/licReaderELC3.cpp +++ b/src/reader/licReaderELC3.cpp @@ -1,7 +1,5 @@ -#ifndef EZ_APPLICATION_LICENCE_DISABLE - #include "licReaderELC3.h" -// #define SHOW 1 +#ifndef EZ_APPLICATION_LICENCE_DISABLE namespace Reader { @@ -35,7 +33,7 @@ namespace Reader throw LicenceException((int)GeneralError::FileOpenError, "Chyba otevření souboru licence: " + licFilePath); } -#ifdef SHOW +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "Celý vstup zašifrovaný: \n"; for (const auto &x : content) cout << (int)x << "-"; @@ -65,12 +63,12 @@ namespace Reader vector publicPart(content.begin(), content.begin() + 12 + this->licBody.licenceIdentHeader.publicHeaderLength); -#ifdef CRCCHECK +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "CRC read public size: " << publicPart.size() << "\n"; cout << "CRC read public: " << calculateCRC16(publicPart) << "\n"; #endif -#ifdef SHOW +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "\n public header length: " << licBody.licenceIdentHeader.publicHeaderLength << "\n"; #endif @@ -88,7 +86,7 @@ namespace Reader -#ifdef SHOW +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "private encryptedsize: " << encryptedPart.size() << "\n"; cout << "private decryptedsize: " << privateContentDecrypted.size() << "\n"; cout << "private decrypted: \n"; @@ -97,7 +95,7 @@ namespace Reader cout << "\n"; #endif -#ifdef CRCCHECK +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "CRC read private size: " << privateContentDecrypted.size() << "\n"; cout << "CRC read private: " << calculateCRC16(privateContentDecrypted) << "\n"; #endif @@ -115,7 +113,7 @@ namespace Reader throw LicenceException((int)GeneralError::ItemsCountMismatch, "Nesouhlasí počet položek licence."); } -#ifdef SHOW +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS cout << "velikost: " << sizeof(licBodyDecrypted.licenceIdentHeader) << "\n"; #endif @@ -136,7 +134,7 @@ namespace Reader uint16_t crcCalculated = calculateCRC16(completeVector, 2); -#ifdef SHOW +#ifdef EZ_LIC_DEBUG_SHOW_DETAILS // cout << "content: \n"; // for (const auto x : content) cout << (int)x << "-"; diff --git a/src/reader/licReaderELC3.d b/src/reader/licReaderELC3.d new file mode 100644 index 0000000..e9ed875 --- /dev/null +++ b/src/reader/licReaderELC3.d @@ -0,0 +1,5 @@ +src/reader/licReaderELC3.o: src/reader/licReaderELC3.cpp \ + include/reader/licReaderELC3.h include/common/utils.h \ + include/common/licConnector.h include/common/lic_config.h \ + include/common/licenceCommon.h include/common/licenceELC3.h \ + include/common/utils.h include/common/licenceCommon.h diff --git a/src/reader/licReaderELC3.o b/src/reader/licReaderELC3.o new file mode 100644 index 0000000..4fea26e Binary files /dev/null and b/src/reader/licReaderELC3.o differ