Hello,
I write a simple test code for WAKE_CFB Symmetric Encryption Algorithm, and if
the input file length
is not multiple of word size (4 byte), i got a segmentation fault signal.
-----------------------------------------------------------------------------------------------------
#include <cryptopp/files.h>
#include <cryptopp/filters.h>
#include <cryptopp/osrng.h>
#include <cryptopp/wake.h>
using namespace CryptoPP;
using namespace std;
int main()
{
� � try
� � {
� � � � AutoSeededRandomPool rng;
� � � � WAKE_CFB<>::Encryption encoder;
� � � � SecByteBlock sbbKey(encoder.DefaultKeyLength());
� � � � rng.GenerateBlock(sbbKey.begin(), sbbKey.size());
� � � � encoder.SetKey(sbbKey, sbbKey.size());
� � � � FileSource("sample.txt", true, new StreamTransformationFilter(encoder,
new FileSink("sample.dat")));
� � }
� � catch (const CryptoPP::Exception &e)
� � {
� � � � cout << "\nCryptoPP::Exception caught: " << e.what() << endl;
� � � � return 1;
� � }
� � catch (const std::exception &e)
� � {
� � � � cout << "\nstd::exception caught: " << e.what() << endl;
� � � � return 2;
� � }
� � return 0;
}
-----------------------------------------------------------------------------------------------------------
Here is reported all the info that i was collect:
uname -a: Linux artu 2.6.5-7.104-default #1 Wed Jul 28 16:42:13 UTC 2004 i686
i686 i386 GNU/Linux
gcc -v : �Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada
--disable-checking --libdir=/usr/lib --enable-libgcj
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.3 (SuSE Linux)
gdb output:
Program received signal SIGSEGV, Segmentation fault.
0x08124755 in CryptoPP::CFB_CipherConcretePolicy<unsigned int, 1u,
CryptoPP::CFB_CipherAbstractPolicy>::RegisterOutput<CryptoPP::EnumToType<CryptoPP::ByteOrder,
1> >::operator() (this=0xbfffe8e0, [EMAIL PROTECTED]) at
strciphr.h:192
192 � � � � � � � � � � � � � � � � � � WordType ct = *(const WordType
*)m_input ^ registerWord;
stack trace:
#0 �0x08124755 in CryptoPP::CFB_CipherConcretePolicy<unsigned int, 1u,
CryptoPP::CFB_CipherAbstractPolicy>::RegisterOutput<CryptoPP::EnumToType<CryptoPP::ByteOrder,
1> >::operator() (this=0xbfffe8e0, [EMAIL PROTECTED]) at
strciphr.h:192
#1 �0x08123e87 in
CryptoPP::WAKE_Policy<CryptoPP::EnumToType<CryptoPP::ByteOrder, 1> >::Iterate
(this=0xbfffed1c,
� � output=0x0, input=0x0, dir=ENCRYPTION, iterationCount=0) at wake.cpp:82
#2 �0x0804b50c in CryptoPP::CFB_CipherConcretePolicy<unsigned int, 1u,
CryptoPP::CFB_CipherAbstractPolicy>::TransformRegister (this=0xbfffed1c) at
strciphr.h:174
#3 �0x0806b368 in
CryptoPP::CFB_CipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::CFB_CipherAbstractPolicy,
CryptoPP::SimpleKeyedTransformation<CryptoPP::StreamTransformation> >
>::ProcessData (this=0xbfffed10,
� � outString=0x81c7bb0 "\n{��, inString=0x81c7bb0 "\n{��, length=1)
at strciphr.cpp:169
#4 �0x080cc1f4 in CryptoPP::StreamTransformation::ProcessString
(this=0xbfffed10,
� � inoutString=0x81c7808 "�224\213^\0323\\\200\201\025vI
\220\"^\017�\022\021\036\f3L((nV", length=937)
� � at cryptlib.h:490
#5 �0x080c9e96 in CryptoPP::StreamTransformationFilter::NextPutModifiable
(this=0x81c3290,
� � inString=0x81c7808 "�224\213^\0323\\\200\201\025vI
\220\"^\017�\022\021\036\f3L((nV", length=937)
� � at filters.cpp:558
#6 �0x080cc8aa in CryptoPP::FilterWithBufferedInput::NextPutMaybeModifiable
(this=0x81c3290,
� � inString=0x81c7808 "�224\213^\0323\\\200\201\025vI
\220\"^\017�\022\021\036\f3L((nV", length=937,
� � modifiable=true) at filters.h:183
#7 �0x080c8c38 in CryptoPP::FilterWithBufferedInput::PutMaybeModifiable
(this=0x81c3290,
� � inString=0x81c7808 "�224\213^\0323\\\200\201\025vI
\220\"^\017�\022\021\036\f3L((nV", length=937,
� � messageEnd=0, blocking=true, modifiable=true) at filters.cpp:325
#8 �0x080cc805 in CryptoPP::FilterWithBufferedInput::PutModifiable2
(this=0x81c3290,
� � inString=0x81c7808 "�224\213^\0323\\\200\201\025vI
\220\"^\017�\022\021\036\f3L((nV", length=937,
� � messageEnd=0, blocking=true) at filters.h:145
#9 �0x080500d0 in CryptoPP::BufferedTransformation::ChannelPutModifiable2
(this=0x81c3290, [EMAIL PROTECTED],
� � begin=0x81c7808 "�224\213^\0323\\\200\201\025vI
\220\"^\017�\022\021\036\f3L((nV", length=937, messageEnd=0,
� � blocking=true) at cryptlib.cpp:226
#10 0x080c6372 in CryptoPP::FileStore::TransferTo2 (this=0xbfffecc4,
[EMAIL PROTECTED], [EMAIL PROTECTED],
� � [EMAIL PROTECTED], blocking=true) at files.cpp:76
#11 0x0805093c in CryptoPP::BufferedTransformation::TransferMessagesTo2
(this=0xbfffecc4, [EMAIL PROTECTED],
� � [EMAIL PROTECTED], [EMAIL PROTECTED], blocking=true) at
cryptlib.cpp:370
#12 0x08050b66 in CryptoPP::BufferedTransformation::TransferAllTo2
(this=0xbfffecc4, [EMAIL PROTECTED],
� � [EMAIL PROTECTED], blocking=true) at cryptlib.cpp:416
#13 0x0804c37a in CryptoPP::SourceTemplate<CryptoPP::FileStore>::PumpAll2
(this=0xbfffecb0, blocking=true)
� � at filters.h:677
#14 0x0804c8c0 in CryptoPP::Source::PumpAll (this=0xbfffecb0) at filters.h:648
#15 0x0804b9ad in CryptoPP::Source::SourceInitialize (this=0xbfffecb0,
pumpAll=true, [EMAIL PROTECTED])
� �at filters.h:659
#16 0x0804ad52 in FileSource (this=0xbfffecb0, filename=0x812d00b
"sample.txt", pumpAll=true, attachment=0x81c3290,
� � binary=true) at files.h:61
#17 0x0804a53e in main () at TestWake.cpp:19
Best Regards.
-
Gerardo Maiorano