C++ 使用cryptopp库编译时收到警告
我有一个在CBC模式下使用AES算法加密的文件。我有数据库里的钥匙。 我试图使用cryptopp 5.6.2库编译以下代码。它在编译时不带-Wall标志,但当我启用该标志时,下面会出现警告C++ 使用cryptopp库编译时收到警告,c++,c++11,crypto++,C++,C++11,Crypto++,我有一个在CBC模式下使用AES算法加密的文件。我有数据库里的钥匙。 我试图使用cryptopp 5.6.2库编译以下代码。它在编译时不带-Wall标志,但当我启用该标志时,下面会出现警告 #include <iostream> #include <fstream> #include <exception> #include <sstream> #include "cryptopp/modes.h" #include "cryptopp/aes.
#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;
}
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
#包括
#包括
#包括
#包括
#包括“cryptopp/modes.h”
#包括“cryptopp/aes.h”
#包括“cryptopp/filters.h”
#包括“cryptopp/cryptolib.h”
#包括“cryptopp/hex.h”
#包括“cryptopp/filters.h”
#包括“cryptopp/aes.h”
#包括“cryptopp/ccm.h”
#包括“cryptopp/files.h”
使用名称空间std;
使用名称空间CryptoPP;
int main(int argc,char*argv[])
{
尝试
{
字节号[16];
字节noiv[16];
std::字符串输出;
std::字符串文件名(“./encrypted.txt”);
CBC_模式::解密d;
d、 SetKeyWithIV(否,sizeof(否),noiv);
CryptoPP::FileSource(fileName.c_str(),true,new StreamTransformationFilter(d,new CryptoPP::FileLink(“decrypted.txt”),CryptoPP::StreamTransformationFilter::PKCS_PADDING));
}
捕获(CryptoPP::异常&e)
{
标准::cout
下面的代码使用cryptopp 5.6.2库
5.6.2有点过时了。我们正准备发布Crypto++5.6.5
它在编译时不带-Wall标志,但当我启用该标志时,下面会出现警告
#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;
}
./cryptopp_5.6.2/include/cryptopp/algparam.h:322: warning: unused variable ‘p’
该警告大约在18个月前被清除。它首次出现在Crypto++5.6.3的版本中。另请参阅
获取以下关于启用-墙标志的错误
Crypto++现在在GCC和compatibles下的-Wall-Wextra
下是干净的。它在MSC下的/W4
下也是干净的。最后,它在Solaris的SunCC下是干净的
如果感兴趣,以下是发布流程和安全门,我们需要通过这些流程和安全门才能发布(从):
- 编译器警告
- 叮当声和GCC消毒剂
- 瓦尔格林
- 企业分析
- 隐蔽性
目前,Coverity支持5.6.5。我们最近将Coverity的覆盖范围扩大到(以前仅限于Linux).Coverity正在生成发现,我们正在处理这些发现。您的问题是什么?p
没有使用,您无能为力,最重要的是,这是一个您不应该关心的库问题。此外,我非常确定,如果您想抑制库标题的警告,请检查此处:@user3494614-您的c是什么ompile命令?