fix module name handling
patch supplied by Michael Bell <michael.bell@cms.hu-berlin.de> git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1788 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
3560f1a49e
commit
7a88ff4d87
|
@ -38,11 +38,13 @@ PKCS11_CTX *ctx;
|
||||||
char *pin = NULL;
|
char *pin = NULL;
|
||||||
int quiet = 1;
|
int quiet = 1;
|
||||||
|
|
||||||
const char *module = PKCS11_DEFAULT_MODULE_NAME;
|
char *module = PKCS11_DEFAULT_MODULE_NAME;
|
||||||
|
int default_module = 1;
|
||||||
|
|
||||||
int set_module(const char *modulename)
|
int set_module(const char *modulename)
|
||||||
{
|
{
|
||||||
module = modulename;
|
module = strdup (modulename);
|
||||||
|
default_module = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +94,7 @@ int pkcs11_init(ENGINE * engine)
|
||||||
}
|
}
|
||||||
ctx = PKCS11_CTX_new();
|
ctx = PKCS11_CTX_new();
|
||||||
if (PKCS11_CTX_load(ctx, module) < 0) {
|
if (PKCS11_CTX_load(ctx, module) < 0) {
|
||||||
fprintf(stderr, "unable to load module\n");
|
fprintf(stderr, "unable to load module %s\n", module);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -103,6 +105,9 @@ int pkcs11_rsa_finish(RSA * rsa)
|
||||||
if (pin) {
|
if (pin) {
|
||||||
free(pin);
|
free(pin);
|
||||||
}
|
}
|
||||||
|
if (!default_module && module) {
|
||||||
|
free(module);
|
||||||
|
}
|
||||||
/* need to free RSA_ex_data? */
|
/* need to free RSA_ex_data? */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue