summaryrefslogtreecommitdiff
path: root/SWIG/_ec.i
diff options
context:
space:
mode:
authorHeikki Toivonen <heikki@heikkitoivonen.net>2010-02-13 06:53:13 +0000
committerHeikki Toivonen <heikki@heikkitoivonen.net>2010-02-13 06:53:13 +0000
commiteaa8985b0d8917003baf9d19c3400322c57afc25 (patch)
tree9bbec7825d1f2193809b1d39645bb8596d75cafc /SWIG/_ec.i
parent515a2677e1c49d9bc0ea6e5a971e2c87b8dbce8f (diff)
downloadm2crypto-eaa8985b0d8917003baf9d19c3400322c57afc25.tar.gz
Bug 12935, 0.20 started releasing Python locks even around some operations that
interacted with the Python runtime, potentially causing crashes and other weirdness, fix by Miloslav Trmac. git-svn-id: http://svn.osafoundation.org/m2crypto/trunk@723 2715db39-9adf-0310-9c64-84f055769b4b
Diffstat (limited to 'SWIG/_ec.i')
-rw-r--r--SWIG/_ec.i9
1 files changed, 6 insertions, 3 deletions
diff --git a/SWIG/_ec.i b/SWIG/_ec.i
index a9383c1..f0e52bd 100644
--- a/SWIG/_ec.i
+++ b/SWIG/_ec.i
@@ -205,39 +205,42 @@ int ec_key_write_pubkey(EC_KEY *key, BIO *f) {
}
%}
-%threadallow ec_key_read_bio;
%inline %{
EC_KEY *ec_key_read_bio(BIO *f, PyObject *pyfunc) {
EC_KEY *ret;
Py_INCREF(pyfunc);
+ Py_BEGIN_ALLOW_THREADS
ret = PEM_read_bio_ECPrivateKey(f, NULL, passphrase_callback, (void *)pyfunc);
+ Py_END_ALLOW_THREADS
Py_DECREF(pyfunc);
return ret;
}
%}
-%threadallow ec_key_write_bio;
%inline %{
int ec_key_write_bio(EC_KEY *key, BIO *f, EVP_CIPHER *cipher, PyObject *pyfunc) {
int ret;
Py_INCREF(pyfunc);
+ Py_BEGIN_ALLOW_THREADS
ret = PEM_write_bio_ECPrivateKey(f, key, cipher, NULL, 0,
passphrase_callback, (void *)pyfunc);
+ Py_END_ALLOW_THREADS
Py_DECREF(pyfunc);
return ret;
}
%}
-%threadallow ec_key_write_bio_no_cipher;
%inline %{
int ec_key_write_bio_no_cipher(EC_KEY *key, BIO *f, PyObject *pyfunc) {
int ret;
Py_INCREF(pyfunc);
+ Py_BEGIN_ALLOW_THREADS
ret = PEM_write_bio_ECPrivateKey(f, key, NULL, NULL, 0,
passphrase_callback, (void *)pyfunc);
+ Py_END_ALLOW_THREADS
Py_DECREF(pyfunc);
return ret;
}