summaryrefslogtreecommitdiff
path: root/leakcheck/context-passphrase-callback.py
diff options
context:
space:
mode:
Diffstat (limited to 'leakcheck/context-passphrase-callback.py')
-rw-r--r--leakcheck/context-passphrase-callback.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/leakcheck/context-passphrase-callback.py b/leakcheck/context-passphrase-callback.py
index ba71655..141ac8d 100644
--- a/leakcheck/context-passphrase-callback.py
+++ b/leakcheck/context-passphrase-callback.py
@@ -15,17 +15,23 @@ from OpenSSL.crypto import TYPE_RSA, FILETYPE_PEM, PKey, dump_privatekey
k = PKey()
k.generate_key(TYPE_RSA, 128)
-file('pkey.pem', 'w').write(dump_privatekey(FILETYPE_PEM, k, "blowfish", "foobar"))
+file("pkey.pem", "w").write(
+ dump_privatekey(FILETYPE_PEM, k, "blowfish", "foobar")
+)
count = count()
+
+
def go():
def cb(a, b, c):
print count.next()
return "foobar"
+
c = Context(TLSv1_METHOD)
c.set_passwd_cb(cb)
while 1:
- c.use_privatekey_file('pkey.pem')
+ c.use_privatekey_file("pkey.pem")
+
threads = [Thread(target=go, args=()) for i in xrange(2)]
for th in threads: