modification crypt.hpp pour fonctionné avec le nouvelle openSSL 'plus de malloc pour les structs EVP'
This commit is contained in:
parent
34e67caa15
commit
9d71174ffc
14
crypt.hpp
14
crypt.hpp
@ -16,7 +16,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
crypt::crypt(std::string filename) : aes(filename) {
|
crypt::crypt(std::string filename) : aes(filename) {
|
||||||
aesEncryptCtx = (EVP_CIPHER_CTX*)malloc(sizeof(EVP_CIPHER_CTX));
|
aesEncryptCtx = EVP_CIPHER_CTX_new();
|
||||||
|
//aesEncryptCtx = (EVP_CIPHER_CTX*)malloc(sizeof(EVP_CIPHER_CTX));
|
||||||
if(aesEncryptCtx == NULL) {
|
if(aesEncryptCtx == NULL) {
|
||||||
exit(FAILURE);
|
exit(FAILURE);
|
||||||
}
|
}
|
||||||
@ -24,9 +25,9 @@ crypt::crypt(std::string filename) : aes(filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
crypt::crypt(const crypt& _a) : aes::aes() {
|
crypt::crypt(const crypt& _a) : aes::aes() {
|
||||||
this->clone(_a);
|
this->clone(_a);
|
||||||
|
aesEncryptCtx = EVP_CIPHER_CTX_new();
|
||||||
aesEncryptCtx = (EVP_CIPHER_CTX*)malloc(sizeof(EVP_CIPHER_CTX));
|
//aesEncryptCtx = (EVP_CIPHER_CTX*)malloc(sizeof(EVP_CIPHER_CTX));
|
||||||
if(aesEncryptCtx == NULL) {
|
if(aesEncryptCtx == NULL) {
|
||||||
exit(FAILURE);
|
exit(FAILURE);
|
||||||
}
|
}
|
||||||
@ -69,7 +70,8 @@ int crypt::aesEncrypt(const unsigned char *msg, size_t msgLen, unsigned char **e
|
|||||||
crypt::~crypt() {
|
crypt::~crypt() {
|
||||||
aes::clear_all();
|
aes::clear_all();
|
||||||
EVP_CIPHER_CTX_cleanup(aesEncryptCtx);
|
EVP_CIPHER_CTX_cleanup(aesEncryptCtx);
|
||||||
free(aesEncryptCtx);
|
EVP_CIPHER_CTX_free(aesEncryptCtx);
|
||||||
|
//free(aesEncryptCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1 +1 @@
|
|||||||
?aîÈ×Y|°–AöòÑï³
|
eЫЦ—Џ0?О“вЬmaО
|
4
data/file.key
Normal file
4
data/file.key
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"IV" : "ж9╞╞И╜■\u0016FCгчА6\u0001и\"СQX4Q╞Б╨йъkАUР╨",
|
||||||
|
"key" : "│\u0002\u0014\u0005╩\u0019=н\u0006ТRкСоУ├⌠┌╦xCIe\u0018┐нLcЛzsz"
|
||||||
|
}
|
@ -31,9 +31,8 @@ decrypt::decrypt(std::string filename, unsigned char* aesKey, unsigned char* aes
|
|||||||
}
|
}
|
||||||
|
|
||||||
decrypt::decrypt(const decrypt& _a) : aes::aes() {
|
decrypt::decrypt(const decrypt& _a) : aes::aes() {
|
||||||
this->clone(_a);
|
this->clone(_a);
|
||||||
aesDecryptCtx = EVP_CIPHER_CTX_new();
|
aesDecryptCtx = EVP_CIPHER_CTX_new();
|
||||||
//aesDecryptCtx = (EVP_CIPHER_CTX*)malloc(sizeof(EVP_CIPHER_CTX));
|
|
||||||
if(aesDecryptCtx == NULL) {
|
if(aesDecryptCtx == NULL) {
|
||||||
exit(FAILURE);
|
exit(FAILURE);
|
||||||
}
|
}
|
||||||
@ -80,7 +79,6 @@ decrypt::~decrypt() {
|
|||||||
aes::clear_all();
|
aes::clear_all();
|
||||||
EVP_CIPHER_CTX_cleanup(aesDecryptCtx);
|
EVP_CIPHER_CTX_cleanup(aesDecryptCtx);
|
||||||
EVP_CIPHER_CTX_free(aesDecryptCtx);
|
EVP_CIPHER_CTX_free(aesDecryptCtx);
|
||||||
//free(aesDecryptCtx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,7 +15,6 @@ int main(int argc, char* argv[]) {
|
|||||||
//******************************************************************* while a rajouté pour les gros fichier
|
//******************************************************************* while a rajouté pour les gros fichier
|
||||||
// readFile fait l'aloccation mémoire !!! pensé au free
|
// readFile fait l'aloccation mémoire !!! pensé au free
|
||||||
size_t fileLength = O->readFile(&file);
|
size_t fileLength = O->readFile(&file);
|
||||||
O->aesEncrypt();
|
|
||||||
|
|
||||||
printf("%d bytes to be encrypted\n", (int)fileLength);
|
printf("%d bytes to be encrypted\n", (int)fileLength);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user