diff options
author | Heikki Toivonen <heikki@heikkitoivonen.net> | 2010-02-13 05:22:05 +0000 |
---|---|---|
committer | Heikki Toivonen <heikki@heikkitoivonen.net> | 2010-02-13 05:22:05 +0000 |
commit | 2ec1d6f4edb0d9e50cd96c3c542bc0a114f67096 (patch) | |
tree | e4989118d2e1225d73aa4781564c6152a1f34062 | |
parent | fa3751712065b89d2ecac7f8c024faf0a4081061 (diff) | |
download | m2crypto-2ec1d6f4edb0d9e50cd96c3c542bc0a114f67096.tar.gz |
Rename m2.engine_init to engine_init_error so that ENGINE_init and ENGINE_finish can be exposed, thanks to Erlo (see http://stackoverflow.com/questions/2195179/need-help-using-m2crypto-engine-to-access-usb-token).
git-svn-id: http://svn.osafoundation.org/m2crypto/trunk@720 2715db39-9adf-0310-9c64-84f055769b4b
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | M2Crypto/Engine.py | 12 | ||||
-rw-r--r-- | SWIG/_engine.i | 8 |
3 files changed, 20 insertions, 2 deletions
@@ -2,6 +2,8 @@ ------------------- - (Re)Enable configuration and use with OpenSSL 0.9.7g and older by disabling RSA PSS methods when using such old OpenSSL, thanks to Stef Walter +- Rename m2.engine_init to engine_init_error so that + ENGINE_init and ENGINE_finish can be exposed, thanks to Erlo 0.20.1 - 2009-08-27 ------------------- diff --git a/M2Crypto/Engine.py b/M2Crypto/Engine.py index 6bafab9..d6b879b 100644 --- a/M2Crypto/Engine.py +++ b/M2Crypto/Engine.py @@ -10,7 +10,7 @@ from M2Crypto import m2, EVP, X509, Err class EngineError(Exception): pass -m2.engine_init(EngineError) +m2.engine_init_error(EngineError) class Engine: """Wrapper for ENGINE object.""" @@ -32,6 +32,16 @@ class Engine: if getattr(self, '_pyfree', 0): self.m2_engine_free(self._ptr) + def init(self): + """Obtain a functional reference to the engine. + + @return: 0 on error, non-zero on success.""" + return m2.engine_init(self._ptr) + + def finish(self): + """Release a functional and structural reference to the engine.""" + return m2.engine_finish(self._ptr) + def ctrl_cmd_string(self, cmd, arg, optional = 0): """Call ENGINE_ctrl_cmd_string""" if not m2.engine_ctrl_cmd_string(self._ptr, cmd, arg, optional): diff --git a/SWIG/_engine.i b/SWIG/_engine.i index 12cbcfb..b55720f 100644 --- a/SWIG/_engine.i +++ b/SWIG/_engine.i @@ -44,6 +44,12 @@ extern ENGINE * ENGINE_by_id(const char *); %rename(engine_free) ENGINE_free; extern int ENGINE_free(ENGINE *); +%rename(engine_init) ENGINE_init; +extern int ENGINE_init(ENGINE *); + +%rename(engine_finish) ENGINE_finish; +extern int ENGINE_finish(ENGINE *); + /* * Engine id/name functions */ @@ -161,7 +167,7 @@ extern EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, %inline %{ static PyObject *_engine_err; -void engine_init(PyObject *engine_err) { +void engine_init_error(PyObject *engine_err) { Py_INCREF(engine_err); _engine_err = engine_err; } |