jeudi 29 septembre 2016

Getting warning while compiling using cryptopp library

I have a encrypted file using AES algorithm in CBC mode. I have key from database. I am trying to compile below code using cryptopp 5.6.2 library. It gets compiled without -Wall flag but when I enable that flag below warnings appears.

#include <iostream>
#include <fstream>
#include <exception>
#include <sstream>

#include "cryptopp/modes.h"
#include "cryptopp/aes.h"
#include "cryptopp/filters.h"
#include "cryptopp/cryptlib.h"
#include "cryptopp/hex.h"
#include "cryptopp/filters.h"
#include "cryptopp/aes.h"
#include "cryptopp/ccm.h"
#include "cryptopp/files.h"

using namespace std;
using namespace CryptoPP;

int main(int argc, char* argv[])
{
    try
    {
        byte no[16]  ;
        byte noiv[16];
        std::string out;
        std::string fileName("./encrypted.txt");
        CBC_Mode< AES >::Decryption d;
        d.SetKeyWithIV(no, sizeof(no), noiv);
        CryptoPP::FileSource (fileName.c_str(), true, new StreamTransformationFilter(d, new CryptoPP::FileSink("decrypted.txt"),CryptoPP::StreamTransformationFilter::PKCS_PADDING));
    }
    catch ( CryptoPP::Exception& e)
    {
        std::cout << std::endl << e.what() << std::endl;
    }
    return 0;
}

Gets below errors on enabling -Wall flag

In file included from ./cryptopp_5.6.2/include/cryptopp/modes.h:12,
                 from poc.cpp:6:
./cryptopp_5.6.2/include/cryptopp/algparam.h: In constructor ‘CryptoPP::ConstByteArrayParameter::ConstByteArrayParameter(const T&, bool) [with T = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]’:
./cryptopp_5.6.2/include/cryptopp/filters.h:793:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:26: warning: unused variable ‘cryptopp_assert_26’
In file included from ./cryptopp_5.6.2/include/cryptopp/modes.h:12,
                 from poc.cpp:6:
./cryptopp_5.6.2/include/cryptopp/algparam.h: In member function ‘void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void*) const [with T = std::ostream*]’:
poc.cpp:36:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
./cryptopp_5.6.2/include/cryptopp/algparam.h: In member function ‘void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void*) const [with T = const wchar_t*]’:
poc.cpp:36:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
./cryptopp_5.6.2/include/cryptopp/algparam.h: In member function ‘void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void*) const [with T = const char*]’:
poc.cpp:36:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
./cryptopp_5.6.2/include/cryptopp/algparam.h: In member function ‘void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void*) const [with T = std::istream*]’:
poc.cpp:36:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
./cryptopp_5.6.2/include/cryptopp/algparam.h: In member function ‘void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void*) const [with T = const int*]’:
poc.cpp:36:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
./cryptopp_5.6.2/include/cryptopp/algparam.h: In member function ‘void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void*) const [with T = unsigned char]’:
poc.cpp:36:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
./cryptopp_5.6.2/include/cryptopp/algparam.h: In member function ‘void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void*) const [with T = const byte*]’:
poc.cpp:36:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
./cryptopp_5.6.2/include/cryptopp/algparam.h: In member function ‘void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void*) const [with T = CryptoPP::RandomNumberGenerator*]’:
poc.cpp:36:   instantiated from here
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
./cryptopp_5.6.2/include/cryptopp/misc.h: At global scope:
./cryptopp_5.6.2/include/cryptopp/misc.h:548: warning: ‘std::string CryptoPP::StringNarrow(const wchar_t*, bool)’ defined but not used

Thanks

Aucun commentaire:

Enregistrer un commentaire