X-Git-Url: https://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=ctypescrypto%2Fengine.py;fp=ctypescrypto%2Fengine.py;h=0446d48c2649426fef33ba16ca10b19ae6b0c7d0;hb=954b6dc9e3312f8d8b49f20f8466e6d2a8342f35;hp=898b20dc4c0268f687a443373dc569e5fe06ec5c;hpb=3ddc0864d900227434283bfc5956e0c4342a6b01;p=oss%2Fctypescrypto.git diff --git a/ctypescrypto/engine.py b/ctypescrypto/engine.py index 898b20d..0446d48 100644 --- a/ctypescrypto/engine.py +++ b/ctypescrypto/engine.py @@ -10,25 +10,25 @@ __all__=['default','set_default'] default=None def set_default(engine): - """ - Loads specified engine and sets it as default for all - algorithms, supported by it - """ - global default - e=libcrypto.ENGINE_by_id(engine) - if e is None: - # Try load engine - e = libcrypto.ENGINE_by_id("dynamic") - if e is None: - raise LibCryptoError("Cannot get 'dynamic' engine") - if not libcrypto.ENGINE_ctrl_cmd_string(e,"SO_PATH",engine,0): - raise LibCryptoError("Cannot execute ctrl cmd SO_PATH") - if not libcrypto.ENGINE_ctrl_cmd_string(e,"LOAD",None,0): - raise LibCryptoError("Cannot execute ctrl cmd LOAD") - if e is None: - raise ValueError("Cannot find engine "+engine) - libcrypto.ENGINE_set_default(e,c_int(0xFFFF)) - default=e + """ + Loads specified engine and sets it as default for all + algorithms, supported by it + """ + global default + e=libcrypto.ENGINE_by_id(engine) + if e is None: + # Try load engine + e = libcrypto.ENGINE_by_id("dynamic") + if e is None: + raise LibCryptoError("Cannot get 'dynamic' engine") + if not libcrypto.ENGINE_ctrl_cmd_string(e,"SO_PATH",engine,0): + raise LibCryptoError("Cannot execute ctrl cmd SO_PATH") + if not libcrypto.ENGINE_ctrl_cmd_string(e,"LOAD",None,0): + raise LibCryptoError("Cannot execute ctrl cmd LOAD") + if e is None: + raise ValueError("Cannot find engine "+engine) + libcrypto.ENGINE_set_default(e,c_int(0xFFFF)) + default=e # Declare function result and arguments for used functions libcrypto.ENGINE_by_id.restype=c_void_p