From fa8f416fa27c7cd27f39f7ecc3075df1a18b67d6 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Thu, 17 Jul 2014 17:14:00 +0300 Subject: [PATCH] Use 0.20 API if present --- pdns/pkcs11signers.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pdns/pkcs11signers.cc b/pdns/pkcs11signers.cc index d5c36ded06..847a027459 100644 --- a/pdns/pkcs11signers.cc +++ b/pdns/pkcs11signers.cc @@ -62,6 +62,10 @@ class P11KitSlot; typedef enum { Attribute_Byte, Attribute_Long, Attribute_String } CkaValueType; +#ifdef HAVE_P11KIT1_V2 +static CK_FUNCTION_LIST** p11_modules; +#endif + // Attribute handling class P11KitAttribute { private: @@ -264,7 +268,11 @@ class P11KitModule // basically get the function list bool initialize() { +#ifdef HAVE_P11KIT1_V2 + functions = p11_kit_module_for_name(p11_modules, d_module.c_str()); +#else functions = p11_kit_registered_name_to_module(d_module.c_str()); +#endif if (functions == NULL) return false; return true; }; @@ -839,10 +847,18 @@ struct LoaderStruct { LoaderStruct() { +#ifdef HAVE_P11KIT1_V2 + p11_modules = p11_kit_modules_load(NULL, 0); +#else p11_kit_initialize_registered(); +#endif }; ~LoaderStruct() { +#ifdef HAVE_P11KIT1_V2 + p11_kit_modules_release(p11_modules); +#else p11_kit_finalize_registered(); +#endif }; } loaderPkcs11; } -- 2.47.2