Hi,

I have a program with 2 threads.
Each thread does at its beginning:
enc = new CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption(key,
CryptoPP::AES::DEFAULT_KEYLENGTH, ivec);

Then, both threads do lots of encrypting using these local instances
of CFB_Mode<AES>.
After a while, sometimes emmediately, this crashes so I'm starting to
wonder: is this supposed to work?

I get a stacktrace like this:

Thread 4 (Thread 0x7ffff5d95700 (LWP 8420)):
#0  0x0000000000000081 in ?? ()
#1  0x0000000000448d06 in encrypt_stream_aes::init (this=0x66d288,
key_in=0x7ffff5d94a80 "data", key_len=32, ivec_in=0x7ffff5d94b10
"data",
    force=<optimized out>) at encrypt_stream_aes.cpp:45
#2  0x0000000000441d54 in stirrer_aes::do_stir (this=0x66d280,
ivec=0x7ffff5d94b10 "data",
    target=0x672420 "data"..., target_size=2048,
    data_in=0x66c8e0 "data"..., direction=false) at stirrer_aes.cpp:43
#3  0x000000000043e2dd in pool::get_entropy_data (this=0x66ce20,
entropy_data=0x6740d0 "data", n_bytes_requested=<optimized out>,
prng_ok=<optimized out>) at pool.cpp:288
#4  0x0000000000434172 in pools::get_bits_from_pools (this=0x66bd50,
n_bits_requested=<optimized out>, buffer=<optimized out>,
allow_prng=false, ignore_rngtest_fips140=true, pfips=0x66a190,
ignore_rngtest_scc=true,
    pscc=0x66acd0, max_duration=13.5) at pools.cpp:553
#5  0x0000000000436995 in do_client_get (client=client@entry=0x66fc80,
no_bits=no_bits@entry=0x7ffff5d94d60) at hc_protocol.cpp:147
#6  0x000000000043735b in do_client (client=0x66fc80,
no_bits=0x7ffff5d94d60, new_bits=0x7ffff5d94d70,
is_full=0x7ffff5d94d80) at hc_protocol.cpp:366
#7  0x0000000000437e16 in thread (data=0x66fc80) at handle_client.cpp:315
#8  0x00007ffff5fa0b50 in start_thread (arg=<optimized out>) at
pthread_create.c:304
#9  0x00007ffff628e9dd in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()

To clarify: frame 2 calles the init() of encrypt_stream_aes, and that
is the point where the thread allocates its local encryptor instance:
enc = new CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption(key,
CryptoPP::AES::DEFAULT_KEYLENGTH, ivec);

Thread 3 (Thread 0x7ffff5594700 (LWP 8418)):
#0  0x00007ffff7082296 in
CryptoPP::Rijndael_Enc_AdvancedProcessBlocks(void*, unsigned int
const*) () from /usr/lib/libcrypto++.so.9
#1  0x00007ffff7082663 in
CryptoPP::Rijndael::Enc::AdvancedProcessBlocks(unsigned char const*,
unsigned char const*, unsigned char*, unsigned long, unsigned int)
const () from /usr/lib/libcrypto++.so.9
#2  0x00007ffff7059b91 in CryptoPP::CFB_ModePolicy::Iterate(unsigned
char*, unsigned char const*, CryptoPP::CipherDir, unsigned long) ()
from /usr/lib/libcrypto++.so.9
#3  0x00007ffff6faef04 in
CryptoPP::CFB_CipherTemplate<CryptoPP::AbstractPolicyHolder<CryptoPP::CFB_CipherAbstractPolicy,
CryptoPP::CFB_ModePolicy> >::ProcessData(unsigned char*, unsigned char
const*, unsigned long) ()
   from /usr/lib/libcrypto++.so.9
#4  0x0000000000441d65 in stirrer_aes::do_stir (this=0x66d280,
ivec=0x7ffff00014b0 "data", target=0x674460 "~\273\235\227u\022",
target_size=2048,
    data_in=0x7ffff0001d10 "data"..., data_in_size=16,
    temp_buffer=0x7ffff0002800 "data", <incomplete sequence \311>,
direction=true) at stirrer_aes.cpp:45
#5  0x000000000043e117 in pool::add_entropy_data (this=0x672070,
    entropy_data=0x7ffff0001d10 "data"..., n_bytes_in=<optimized out>)
at pool.cpp:223
#6  0x0000000000435135 in pools::add_bits_to_pools (this=<optimized out>,
    data=0x7ffff0001d00 "data"..., n_bytes=2803,
ignore_rngtest_fips140=true, pfips=0x670050, ignore_rngtest_scc=true,
    pscc=0x670b90, max_duration=13.5) at pools.cpp:632
#7  0x0000000000436fef in do_client_put (client=client@entry=0x66ff50,
new_bits=new_bits@entry=0x7ffff5593d70,
is_full=is_full@entry=0x7ffff5593d80) at hc_protocol.cpp:327
#8  0x000000000043732f in do_client (client=0x66ff50,
no_bits=0x7ffff5593d60, new_bits=0x7ffff5593d70,
is_full=0x7ffff5593d80) at hc_protocol.cpp:370
#9  0x0000000000437e16 in thread (data=0x66ff50) at handle_client.cpp:315
#10 0x00007ffff5fa0b50 in start_thread (arg=<optimized out>) at
pthread_create.c:304
#11 0x00007ffff628e9dd in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#12 0x0000000000000000 in ?? ()

=> I replaced actual data with the string "data"

--
www.vanheusden.com

bitcoin account: 14ExronPRN44urf4jqPMyoAN46T75MKGgP
msn address: [email protected]

-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.

Reply via email to