-/* SPDX-License-Identifier: LGPL-2.1+ */
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "hexdecoct.h"
#include "homework-pkcs11.h"
void *userdata) {
_cleanup_(erase_and_freep) void *decrypted_key = NULL;
- struct pkcs11_callback_data *data = userdata;
+ struct pkcs11_callback_data *data = ASSERT_PTR(userdata);
_cleanup_free_ char *token_label = NULL;
CK_TOKEN_INFO updated_token_info;
size_t decrypted_key_size;
CK_OBJECT_HANDLE object;
- char **i;
CK_RV rv;
int r;
assert(slot_info);
assert(token_info);
assert(uri);
- assert(data);
/* Special return values:
*
if (rv != CKR_OK)
return log_error_errno(SYNTHETIC_ERRNO(EIO), "Failed to log into security token '%s': %s", token_label, p11_kit_strerror(rv));
- log_info("Successully logged into security token '%s' via protected authentication path.", token_label);
+ log_info("Successfully logged into security token '%s' via protected authentication path.", token_label);
goto decrypt;
}
goto decrypt;
}
- if (strv_isempty(data->secret->pkcs11_pin))
- return log_error_errno(SYNTHETIC_ERRNO(ENOANO), "Security Token requires PIN.");
+ if (strv_isempty(data->secret->token_pin))
+ return log_error_errno(SYNTHETIC_ERRNO(ENOANO), "Security token requires PIN.");
- STRV_FOREACH(i, data->secret->pkcs11_pin) {
+ STRV_FOREACH(i, data->secret->token_pin) {
rv = m->C_Login(session, CKU_USER, (CK_UTF8CHAR*) *i, strlen(*i));
if (rv == CKR_OK) {
log_info("Successfully logged into security token '%s' with PIN.", token_label);