summaryrefslogtreecommitdiff
path: root/client/pkcs11.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/pkcs11.c')
-rw-r--r--client/pkcs11.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/client/pkcs11.c b/client/pkcs11.c
index a2f16f3..d388ed4 100644
--- a/client/pkcs11.c
+++ b/client/pkcs11.c
@@ -250,19 +250,15 @@ static void _backend_free(Backend *backend) {
EVP_cleanup();
}
-/* Backend functions */
-static const Backend backend_template = {
- .init = _backend_init,
- .scan = _backend_scan,
- .free = _backend_free,
- .freeToken = _backend_freeToken,
- .getBase64Chain = _backend_getBase64Chain,
- .sign = _backend_sign,
-};
Backend *pkcs11_getBackend(void) {
- Backend *backend = malloc(sizeof(Backend));
- memcpy(backend, &backend_template, sizeof(Backend));
+ Backend *backend = calloc(1, sizeof(Backend));
+ backend->init = _backend_init;
+ backend->free = _backend_free;
+ backend->freeToken = _backend_freeToken;
+ backend->scan = _backend_scan;
+ backend->getBase64Chain = _backend_getBase64Chain;
+ backend->sign = _backend_sign;
return backend;
}