When exporting a TLS keys from the kernel keyring a line might have a
newline. Strip the newline away as the nvme_import_tls_key is not
expecting it and thus fails to load an exported keyfile.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
}
*tls_key = '\0';
tls_key++;
+ tls_key[strcspn(tls_key, "\n")] = 0;
psk = nvme_import_tls_key(tls_key, &key_len, &hmac);
if (!psk) {
nvme_show_error("Failed to import key in line %d",