author: A.TNG <jiyucn@163.com>
一直在琢磨怎么把OpenIPMP的东西成功的放到嵌入式开发板上。
OpenIPMP中使用了很多外部库,都是开源的项目,其中的Crypto++是一个与密码学相关的库,支持许多算法,应该负责对多媒体文件的加密和解密功能。
通 过比较OpenIPMP中/ext/Crypt++/include/*.h与Crypto++各个较新版本的头文件,发现OpenIPMP使用的版本是 5.2.x。下载了对应版本(Version 5.2.1)的源代码后,曾尝试在Fedora5下编译libcryptopp.a,出现很多编译错误,如下:
make: Warning: File `GNUmakefile' has modification time 8.7e+05 s in the future
g++ -g -msse2 -I../../include -pipe -c 3way.cpp
../../include/seckey.h: In function avoid CryptoPP::CheckedSetKey(T*, CryptoPP::CipherDir, const byte*, unsigned int, const CryptoPP::NameValuePairs&) [with T = CryptoPP::BlockCipherFinal<DECRYPTION, CryptoPP::ThreeWay::Dec>]a:
../../include/seckey.h:179: instantiated from avoid CryptoPP::BlockCipherFinal<DIR, BASE>::SetKey(const byte*, unsigned int, const CryptoPP::NameValuePairs&) [with CryptoPP::CipherDir DIR = DECRYPTION, BASE = CryptoPP::ThreeWay::Dec]a
3way.cpp:139: instantiated from here
../../include/seckey.h:137: error: no matching function for call to aCryptoPP::BlockCipherFinal<DECRYPTION, CryptoPP::ThreeWay::Dec>::UncheckedSetKey(CryptoPP::CipherDir&, const byte*&, unsigned int&)a
3way.cpp:64: note: candidates are: void CryptoPP::ThreeWay::Base::UncheckedSetKey(CryptoPP::CipherDir, const byte*, unsigned int, unsigned int)
../../include/seckey.h: In function avoid CryptoPP::CheckedSetKey(T*, CryptoPP::CipherDir, const byte*, unsigned int, const CryptoPP::NameValuePairs&) [with T = CryptoPP::BlockCipherFinal<ENCRYPTION, CryptoPP::ThreeWay::Enc>]a:
../../include/seckey.h:179: instantiated from avoid CryptoPP::BlockCipherFinal<DIR, BASE>::SetKey(const byte*, unsigned int, const CryptoPP::NameValuePairs&) [with CryptoPP::CipherDir DIR = ENCRYPTION, BASE = CryptoPP::ThreeWay::Enc]a
3way.cpp:139: instantiated from here
../../include/seckey.h:137: error: no matching function for call to aCryptoPP::BlockCipherFinal<ENCRYPTION, CryptoPP::ThreeWay::Enc>::UncheckedSetKey(CryptoPP::CipherDir&, const byte*&, unsigned int&)a
3way.cpp:64: note: candidates are: void CryptoPP::ThreeWay::Base::UncheckedSetKey(CryptoPP::CipherDir, const byte*, unsigned int, unsigned int)
make: *** [3way.o] Error 1
错误的地方大概是在seckey.h中
template <class T>
static inline void CheckedSetKey(T *obj, CipherDir dir, const byte *key, unsigned int length, const NameValuePairs ¶m)
{
obj->ThrowIfInvalidKeyLength(length);
obj->UncheckedSetKey(dir, key, length); // UncheckedSetKey 未定义
}
查看当前使用的gcc版本为4.1.1。尔后尝试在Redhat9下编译,查看gcc版本为3.2.2,并且编译成功。猜测与编译对模板的支持不同有关,对于5.2.1版本,没有找到合适的解决方法,建议使用5.3或者更高版本。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1624048