[tahoe-dev] [pycryptopp] #17: pycryptopp fails self-tests on ARMv5 architecture

pycryptopp trac at allmydata.org
Wed Mar 11 10:20:55 PDT 2009


#17: pycryptopp fails self-tests on ARMv5 architecture
-------------------+--------------------------------------------------------
Reporter:  zooko   |           Owner:       
    Type:  defect  |          Status:  new  
Priority:  major   |         Version:  0.5.1
Keywords:  ARMv5   |   Launchpad_bug:       
-------------------+--------------------------------------------------------
 It looks like Crypto++ is writing into memory one byte earlier than it is
 supposed to -- the last byte of the buffer doesn't get written to, and all
 the other bytes get the value which the next byte over (address one
 higher) was supposed to get.  Of course this could be a bug in the memory
 management of pycryptopp itself, but I didn't see one when examining the
 pycryptopp code, and this bug doesn't manifest on any of the other
 platforms pycryptopp has been run on, only on this ARMv5.  Next steps are
 to check whether it is actually writing the first byte into the memory
 address one less than the beginning of the buffer, and to make a minimal
 test case of pycryptopp's memory management which doesn't actually invoke
 Crypto++ at all.

 Oh, note that this test writes into two different buffers -- the first one
 is 15 bytes long and the second one is 17 bytes long.  The first one is
 handled correctly, and the second one is written into the off-by-one wrong
 location.  So it does seem like some code somewhere might be incorrectly
 padding, so that for example Crypto++ might think that it finished the
 first 16 bytes of CTR mode when it actually did only 15 bytes.  That could
 explain it.  Ah -- maybe I should check whether the first call to Crypto++
 is incorrectly writing the 16th byte!

 {{{
 ======================================================================
 FAIL: test_encrypt_zeroes_in_two_parts (pycryptopp.test.test_aes.AES256)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/admin/pycryptopp/pycryptopp/test/test_aes.py", line 47, in
 test_encrypt_zeroes_in_two_parts
     self.failUnlessEqual(self.enc0, b2a_hex(ct1+ct2))
 AssertionError:
 'dc95c078a2408989ad48a21492842087530f8afbc74536b9a963b4f1c4cb738b' !=
 'dc95c078a2408989ad48a214928420530f8afbc74536b9a963b4f1c4cb738bad'

 ----------------------------------------------------------------------
 Ran 30 tests in 50.729s

 FAILED (failures=1
 sh-3.2$ g++ --version
 g++ (Debian 4.3.2-1.1) 4.3.2
 Copyright (C) 2008 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
 }}}

-- 
Ticket URL: <http://allmydata.org/trac/pycryptopp/ticket/17>
pycryptopp <http://allmydata.org/trac/pycryptopp>
Python bindings for the Crypto++ library


More information about the tahoe-dev mailing list