On Mon, Oct 10, 2016 at 11:38:00AM +0000, Mattia Rizzolo wrote: > Hi there. > > Debian received a bug report that podofo fails to build with the newer > openSSL. > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=828407 > > I'd report this as a bug report, but the bug tracker is not open to the > public :)
FTR, I received a patch for this, attached to this message. Credits go to Reiner Herrmann <rei...@reiner-h.de>. -- regards, Mattia Rizzolo GPG Key: 66AE 2B4A FCCF 3F52 DA18 4D18 4B04 3FCD B944 4540 .''`. more about me: https://mapreri.org : :' : Launchpad user: https://launchpad.net/~mapreri `. `'` Debian QA page: https://qa.debian.org/developer.php?login=mattia `-
Description: be compatible with OpenSSL 1.1.0 API Author: Reiner Herrmann <rei...@reiner-h.de> Acked-By: Mattia Rizzolo <mat...@debian.org> Bug-Debian: https://bugs.debian.org/828407 --- a/src/base/PdfEncrypt.cpp +++ b/src/base/PdfEncrypt.cpp @@ -99,19 +99,19 @@ AESCryptoEngine() { - EVP_CIPHER_CTX_init(&aes); + aes = EVP_CIPHER_CTX_new(); } - EVP_CIPHER_CTX* getEngine() {return &aes;} + EVP_CIPHER_CTX* getEngine() {return aes;} ~AESCryptoEngine() { - EVP_CIPHER_CTX_cleanup(&aes); + EVP_CIPHER_CTX_free(aes); } private: - EVP_CIPHER_CTX aes; + EVP_CIPHER_CTX *aes; }; // A class that holds the RC4 Crypto object @@ -121,19 +121,19 @@ RC4CryptoEngine() { - EVP_CIPHER_CTX_init(&rc4); + rc4 = EVP_CIPHER_CTX_new(); } - EVP_CIPHER_CTX* getEngine() {return &rc4;} + EVP_CIPHER_CTX* getEngine() {return rc4;} ~RC4CryptoEngine() { - EVP_CIPHER_CTX_cleanup(&rc4); + EVP_CIPHER_CTX_free(rc4); } private: - EVP_CIPHER_CTX rc4; + EVP_CIPHER_CTX *rc4; }; /** A class that can encrypt/decrpyt streamed data block wise @@ -1459,24 +1459,23 @@ // UE = AES-256 encoded file encryption key with key=hash // CBC mode, no padding, init vector=0 - EVP_CIPHER_CTX aes; - EVP_CIPHER_CTX_init(&aes); + EVP_CIPHER_CTX *aes = EVP_CIPHER_CTX_new(); - int status = EVP_EncryptInit_ex(&aes, EVP_aes_256_cbc(), NULL, hashValue, NULL); + int status = EVP_EncryptInit_ex(aes, EVP_aes_256_cbc(), NULL, hashValue, NULL); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error initializing AES encryption engine" ); - EVP_CIPHER_CTX_set_padding(&aes, 0); // disable padding + EVP_CIPHER_CTX_set_padding(aes, 0); // disable padding int dataOutMoved; - status = EVP_EncryptUpdate(&aes, m_ueValue, &dataOutMoved, m_encryptionKey, m_keyLength); + status = EVP_EncryptUpdate(aes, m_ueValue, &dataOutMoved, m_encryptionKey, m_keyLength); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error AES-encrypting data" ); - status = EVP_EncryptFinal_ex(&aes, &m_ueValue[dataOutMoved], &dataOutMoved); + status = EVP_EncryptFinal_ex(aes, &m_ueValue[dataOutMoved], &dataOutMoved); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error AES-encrypting data" ); - EVP_CIPHER_CTX_cleanup(&aes); + EVP_CIPHER_CTX_free(aes); } void PdfEncryptSHABase::ComputeOwnerKey(const unsigned char * ownerpswd, int len) @@ -1515,24 +1514,23 @@ // OE = AES-256 encoded file encryption key with key=hash // CBC mode, no padding, init vector=0 - EVP_CIPHER_CTX aes; - EVP_CIPHER_CTX_init(&aes); + EVP_CIPHER_CTX *aes = EVP_CIPHER_CTX_new(); - int status = EVP_EncryptInit_ex(&aes, EVP_aes_256_cbc(), NULL, hashValue, NULL); + int status = EVP_EncryptInit_ex(aes, EVP_aes_256_cbc(), NULL, hashValue, NULL); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error initializing AES encryption engine" ); - EVP_CIPHER_CTX_set_padding(&aes, 0); // disable padding + EVP_CIPHER_CTX_set_padding(aes, 0); // disable padding int dataOutMoved; - status = EVP_EncryptUpdate(&aes, m_oeValue, &dataOutMoved, m_encryptionKey, m_keyLength); + status = EVP_EncryptUpdate(aes, m_oeValue, &dataOutMoved, m_encryptionKey, m_keyLength); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error AES-encrypting data" ); - status = EVP_EncryptFinal_ex(&aes, &m_oeValue[dataOutMoved], &dataOutMoved); + status = EVP_EncryptFinal_ex(aes, &m_oeValue[dataOutMoved], &dataOutMoved); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error AES-encrypting data" ); - EVP_CIPHER_CTX_cleanup(&aes); + EVP_CIPHER_CTX_free(aes); } void PdfEncryptSHABase::PreprocessPassword( const std::string &password, unsigned char* outBuf, int &len) @@ -1663,24 +1661,23 @@ // Encrypt Perms value - EVP_CIPHER_CTX aes; - EVP_CIPHER_CTX_init(&aes); + EVP_CIPHER_CTX *aes = EVP_CIPHER_CTX_new(); - int status = EVP_EncryptInit_ex(&aes, EVP_aes_256_ecb(), NULL, m_encryptionKey, NULL); + int status = EVP_EncryptInit_ex(aes, EVP_aes_256_ecb(), NULL, m_encryptionKey, NULL); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error initializing AES encryption engine" ); - EVP_CIPHER_CTX_set_padding(&aes, 0); // disable padding + EVP_CIPHER_CTX_set_padding(aes, 0); // disable padding int dataOutMoved; - status = EVP_EncryptUpdate(&aes, m_permsValue, &dataOutMoved, perms, 16); + status = EVP_EncryptUpdate(aes, m_permsValue, &dataOutMoved, perms, 16); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error AES-encrypting data" ); - status = EVP_EncryptFinal_ex(&aes, &m_permsValue[dataOutMoved], &dataOutMoved); + status = EVP_EncryptFinal_ex(aes, &m_permsValue[dataOutMoved], &dataOutMoved); if(status != 1) PODOFO_RAISE_ERROR_INFO( ePdfError_InternalLogic, "Error AES-encrypting data" ); - EVP_CIPHER_CTX_cleanup(&aes); + EVP_CIPHER_CTX_free(aes); } bool PdfEncryptAESV3::Authenticate( const std::string & password, const PdfString & )
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users