licence final
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
#include "plcLicence.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define CID_LENGTH 32
|
||||
#define CSD_LENGTH 32
|
||||
|
||||
const std::string cEzLic_p78ou3_sdinfofilepath = "/sys/block/mmcblk0/device/";
|
||||
const std::string cEzLic_p78ou3_licencfilepath_f21 = "/mnt/mmc/ez_sys/licence/";
|
||||
const std::string cEzLic_p78ou3_licencfilepath_f17 = "/home/admin/ez/licence/";
|
||||
@@ -167,9 +170,8 @@ PlcLicence::PlcLicence(string cid, string csd, char *stationName, char *switchNa
|
||||
|
||||
void PlcLicence::getSDData()
|
||||
{
|
||||
int length = strlen(cid); // Get the length of the char array
|
||||
for (int i = 0; i < length; i++)
|
||||
this->sdData.CID_nibble[i] = (BYTE)cid[i];
|
||||
//int length = strlen(cid); // Get the length of the char array
|
||||
for (int i = 0; i < CID_LENGTH; i++) this->sdData.CID_nibble[i] = (BYTE)cid[i];
|
||||
|
||||
for (int i = 0; i < cnibblescount / 2; i++)
|
||||
{
|
||||
@@ -201,9 +203,7 @@ void PlcLicence::getSDData()
|
||||
this->sdData.manufacturerDate[i] = date[i];
|
||||
|
||||
// CSD
|
||||
length = strlen(csd); // Get the length of the char array
|
||||
for (int i = 0; i < length; i++)
|
||||
this->sdData.CSD_nibble[i] = (BYTE)csd[i];
|
||||
for (int i = 0; i < CSD_LENGTH; i++) this->sdData.CSD_nibble[i] = (BYTE)csd[i];
|
||||
|
||||
for (int i = 0; i < cnibblescount / 2; i++)
|
||||
{
|
||||
@@ -738,6 +738,7 @@ bool PlcLicence::CreateLicence()
|
||||
size_t r1 = fwrite(&totalEncryptedArray, sizeof(totalEncryptedArray), 1, fileLicence);
|
||||
//printf("License binary saved.\n");
|
||||
fclose(fileLicence);
|
||||
cout << licFileNameToSave << endl;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user