From: Claudio-Daniel Freire Date: Fri, 30 Sep 2011 06:25:26 +0000 (+0200) Subject: Switch SystemRandom with os.urandom X-Git-Tag: nepi-3.0.0~204 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=e4dd305715d598dccb5de4c4afdb3830388c76a1;p=nepi.git Switch SystemRandom with os.urandom --- diff --git a/src/nepi/testbeds/planetlab/interfaces.py b/src/nepi/testbeds/planetlab/interfaces.py index 4c04e90c..e9abf117 100644 --- a/src/nepi/testbeds/planetlab/interfaces.py +++ b/src/nepi/testbeds/planetlab/interfaces.py @@ -170,7 +170,11 @@ class TunIface(object): # Generate an initial random cryptographic key to use for tunnelling # Upon connection, both endpoints will agree on a common one based on # this one. - self.tun_key = os.urandom(32).encode("base64").strip() + self.tun_key = ( ''.join(map(chr, [ + r.getrandbits(8) + for i in xrange(32) + for r in (random.SystemRandom(),) ]) + ).encode("base64").strip() ) def __str__(self):