VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/SecurityToken.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-01-10 23:54:25 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-01-10 23:59:17 +0100
commite40774f54683ba24ffed63aa14bebc8ab42ed087 (patch)
tree0d5dd50021880395dae3917a674842cf36ab66f8 /src/Common/SecurityToken.cpp
parentfe38d6f52c03b5d8383c95f07dc78b5643016a48 (diff)
downloadVeraCrypt-e40774f54683ba24ffed63aa14bebc8ab42ed087.tar.gz
VeraCrypt-e40774f54683ba24ffed63aa14bebc8ab42ed087.zip
Linux/MacOSX: Show better error message when the PKCS#11 library can't be loaded
Diffstat (limited to 'src/Common/SecurityToken.cpp')
-rw-r--r--src/Common/SecurityToken.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp
index d7dacf57..a3fc18d6 100644
--- a/src/Common/SecurityToken.cpp
+++ b/src/Common/SecurityToken.cpp
@@ -520,11 +520,13 @@ namespace VeraCrypt
CloseLibrary();
#ifdef TC_WINDOWS
- Pkcs11LibraryHandle = LoadLibraryW (pkcs11LibraryPath.c_str());
+ Pkcs11LibraryHandle = LoadLibraryW (pkcs11LibraryPath.c_str());
+ throw_sys_if (!Pkcs11LibraryHandle);
#else
- Pkcs11LibraryHandle = dlopen (pkcs11LibraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
+ Pkcs11LibraryHandle = dlopen (pkcs11LibraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
+ throw_sys_sub_if (!Pkcs11LibraryHandle, dlerror());
#endif
- throw_sys_if (!Pkcs11LibraryHandle);
+
typedef CK_RV (*C_GetFunctionList_t) (CK_FUNCTION_LIST_PTR_PTR ppFunctionList);
#ifdef TC_WINDOWS