Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

p11_module.cpp
Go to the documentation of this file.
1 /*
2 * PKCS#11 Module
3 * (C) 2016 Daniel Neus, Sirrix AG
4 * (C) 2016 Philipp Weber, Sirrix AG
5 *
6 * Botan is released under the Simplified BSD License (see license.txt)
7 */
8
9 #include <botan/p11_module.h>
10
11 namespace Botan {
12
13 namespace PKCS11 {
14
15 Module::Module(const std::string& file_path, C_InitializeArgs init_args)
16 : m_file_path(file_path)
17 {
18 reload(init_args);
19 }
20
21 Module::~Module() BOTAN_NOEXCEPT
22 {
23 try
24 {
25 m_low_level->C_Finalize(nullptr, nullptr);
26 }
27 catch(...)
28 {
29 // we are noexcept and must swallow any exception here
30 }
31 }
32
33 void Module::reload(C_InitializeArgs init_args)
34 {
35 if(m_low_level)
36 {
37 m_low_level->C_Finalize(nullptr);
38 }
39
40 m_library.reset(new Dynamically_Loaded_Library(m_file_path));
41 LowLevel::C_GetFunctionList(*m_library, &m_func_list);
42 m_low_level.reset(new LowLevel(m_func_list));
43
44 m_low_level->C_Initialize(&init_args);
45 }
46
47 }
48 }
BOTAN_NOEXCEPT
#define BOTAN_NOEXCEPT
Definition: compiler.h:116
Botan::PKCS11::Module::reload
void reload(C_InitializeArgs init_args={nullptr, nullptr, nullptr, nullptr, static_cast< CK_FLAGS >(Flag::OsLockingOk), nullptr})
Definition: p11_module.cpp:33
Botan::PKCS11::LowLevel::C_GetFunctionList
static bool C_GetFunctionList(Dynamically_Loaded_Library &pkcs11_module, FunctionListPtr *function_list_ptr_ptr, ReturnValue *return_value=ThrowException)
Definition: p11.cpp:102
Botan::PKCS11::LowLevel
Provides access to all PKCS#11 functions.
Definition: p11.h:901
Botan
Definition: alg_id.cpp:13
Botan::Dynamically_Loaded_Library
Definition: dyn_load.h:19
Botan::PKCS11::Module::Module
Module(const std::string &file_path, C_InitializeArgs init_args={nullptr, nullptr, nullptr, nullptr, static_cast< CK_FLAGS >(Flag::OsLockingOk), nullptr})
Definition: p11_module.cpp:15
CK_C_INITIALIZE_ARGS
Definition: pkcs11t.h:1213
Botan::PKCS11::Module::~Module
~Module() BOTAN_NOEXCEPT
Calls C_Finalize()
Definition: p11_module.cpp:21