Package: gajim
Version: 0.16-1
Severity: important
Tags: upstream patch
Forwarded: https://trac.gajim.org/ticket/7866

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

prosody trunk today threw this at me when negotiating an E2E session:

Traceback (most recent call last):
    File "/usr/share/gajim/src/dialogs.py", line 1680, in on_response_yes
        self.user_response_yes(self.is_checked())
    File "/usr/share/gajim/src/session.py", line 457, in 
accept_nondefault_options
        self.accept_e2e_alice(form, negotiated)
    File "/usr/share/gajim/src/common/stanza_session.py", line 956, in 
accept_e2e_alice
        rshashes.append(crypto.random_bytes(rshash_size))
    File "/usr/share/gajim/src/common/crypto.py", line 122, in random_bytes
        OpenSSL.rand.add(os.urandom(bytes_), bytes_)
    File "/usr/lib/python2.7/dist-packages/OpenSSL/rand.py", line 64, in add
        raise TypeError("entropy must be an integer")
TypeError: entropy must be an integer

This results from hashlib.sha256().digest_size returning a long instead
of an integer on my platform, for whatever reason that arises now.

I imagine that none of the hash algs in use, the least sha256, will have
a digest size justifying the use of a long, so casting to int looks safe
here.

The exact same code that causes the issue is present in 0.16, so
reporting against that.

A patch fixing the issue is attached.

- -- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.14-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQJOBAEBCAA4BQJUSrAEMRpodHRwczovL3d3dy5kb21pbmlrLWdlb3JnZS5kZS9n
cGctcG9saWN5LnR4dC5hc2MACgkQt5o8FqDE8pbSUxAAgJHkE2wXSVlt6WaRFbtt
YEBwCXDcHKFqk2fmL3A1EtlzaD8u7T2ENssiz8fJZwxIPYwdQY/djTNXtO2x18r3
ErsfoSy3VhJEGLt68aWByCBjDN+cHrn1GKQxU8fHG2BFSkDHxC7BZUBkpLyywvBS
ookKLkXZFoOYRLocIO34xA71PrguT8haMQ3J0IfjMqNk4w5K+PDFQpO6I7iJJJs+
nMjOV31x6VRG4wDPZiXaWuSWurxdXwEgZk+0H4st0R1aLPNBewHJwYvrtbmRlf5V
s3RdlFuLqnG3cfSM/f1d0RI7Bqk9+fHgutom8Svgy3CMF3EmYtLt3jXApjDWBfrB
iB1Hq6iYwApBvBl1rcuhY602WWTWaTZZrl3Px3tE8RQF42MLI5Z4IibHg57fBR0R
La1Ltzg9urX6sWb0xEuizdnKZUfyOikXczSUsnMnLVj8ggLHDPsaqgCanq/G4dTw
5WKIa6n/llaUkBy42TQe/khhEoVsVq+L9FKrLBbO5HRdjzDaKWnOONOiaW4wiXl6
MiL7ege8VjjP8lL8zaMmeDceDTW579MZV1wFyS4ngjNu8vheWJa9UqLV+ZPK9i4K
jOfz8+yi8LH67uS8//xiosbXbivwKZ50xHhKXO2mI9F7LAxOdNZNuF02A2BWEWo0
iqjsN7OSTeNgK9Jageuyno0=
=RRYj
-----END PGP SIGNATURE-----
changeset:   15552:375dd51393bb
tag:         tip
parent:      15503:a8bd9ca4ef63
user:        Dominik George <n...@naturalnet.de>
date:        Fri Oct 24 21:45:17 2014 +0200
summary:     Fix bug #7866 - cast digest_size from hashlib to int for OpenSSL

diff -r a8bd9ca4ef63 -r 375dd51393bb src/common/stanza_session.py
--- a/src/common/stanza_session.py	Sat Oct 18 22:08:51 2014 +0200
+++ b/src/common/stanza_session.py	Fri Oct 24 21:45:17 2014 +0200
@@ -949,7 +949,7 @@
 
             if not rshashes:
                 # we've never spoken before, but we'll pretend we have
-                rshash_size = self.hash_alg().digest_size
+                rshash_size = int(self.hash_alg().digest_size)
                 rshashes.append(crypto.random_bytes(rshash_size))
 
             rshashes = [base64.b64encode(rshash) for rshash in rshashes]

Reply via email to