mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-18 14:20:09 +01:00
Fix error messages and include benchmark string for translators.
This commit is contained in:
@@ -271,7 +271,7 @@ int LUKS2_builtin_token_create(struct crypt_device *cd,
|
|||||||
|
|
||||||
r = th->set(&jobj_token, params);
|
r = th->set(&jobj_token, params);
|
||||||
if (r) {
|
if (r) {
|
||||||
log_err(cd, _("Failed to create builtin token %s\n"), type);
|
log_err(cd, _("Failed to create builtin token %s.\n"), type);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -635,7 +635,7 @@ static int benchmark_callback(uint32_t time_ms, void *usrptr)
|
|||||||
|
|
||||||
check_signal(&r);
|
check_signal(&r);
|
||||||
if (r)
|
if (r)
|
||||||
log_err("Benchmark interrupted.\n");
|
log_err(_("Benchmark interrupted.\n"));
|
||||||
else
|
else
|
||||||
log_dbg("PBKDF benchmark: memory cost = %u, iterations = %u, "
|
log_dbg("PBKDF benchmark: memory cost = %u, iterations = %u, "
|
||||||
"threads = %u (took %u ms)", pbkdf->max_memory_kb,
|
"threads = %u (took %u ms)", pbkdf->max_memory_kb,
|
||||||
@@ -656,9 +656,9 @@ static int action_benchmark_kdf(const char *kdf, const char *hash, size_t key_si
|
|||||||
r = crypt_benchmark_pbkdf(NULL, &pbkdf, "foo", 3, "bar", 3, key_size,
|
r = crypt_benchmark_pbkdf(NULL, &pbkdf, "foo", 3, "bar", 3, key_size,
|
||||||
&benchmark_callback, &pbkdf);
|
&benchmark_callback, &pbkdf);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_std("PBKDF2-%-9s N/A\n", hash);
|
log_std(_("PBKDF2-%-9s N/A\n"), hash);
|
||||||
else
|
else
|
||||||
log_std("PBKDF2-%-9s %7u iterations per second for %zu-bit key\n",
|
log_std(_("PBKDF2-%-9s %7u iterations per second for %zu-bit key\n"),
|
||||||
hash, pbkdf.iterations, key_size * 8);
|
hash, pbkdf.iterations, key_size * 8);
|
||||||
} else {
|
} else {
|
||||||
struct crypt_pbkdf_type pbkdf = {
|
struct crypt_pbkdf_type pbkdf = {
|
||||||
@@ -672,11 +672,11 @@ static int action_benchmark_kdf(const char *kdf, const char *hash, size_t key_si
|
|||||||
"0123456789abcdef0123456789abcdef", 32,
|
"0123456789abcdef0123456789abcdef", 32,
|
||||||
key_size, &benchmark_callback, &pbkdf);
|
key_size, &benchmark_callback, &pbkdf);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_std("%-10s N/A\n", kdf);
|
log_std(_("%-10s N/A\n"), kdf);
|
||||||
else
|
else
|
||||||
log_std("%-10s %4u iterations, %5u memory, "
|
log_std(_("%-10s %4u iterations, %5u memory, "
|
||||||
"%1u parallel threads (CPUs) for "
|
"%1u parallel threads (CPUs) for "
|
||||||
"%zu-bit key (requested %u ms time)\n", kdf,
|
"%zu-bit key (requested %u ms time)\n"), kdf,
|
||||||
pbkdf.iterations, pbkdf.max_memory_kb, pbkdf.parallel_threads,
|
pbkdf.iterations, pbkdf.max_memory_kb, pbkdf.parallel_threads,
|
||||||
key_size * 8, pbkdf.time_ms);
|
key_size * 8, pbkdf.time_ms);
|
||||||
}
|
}
|
||||||
@@ -776,8 +776,9 @@ static int action_benchmark(void)
|
|||||||
key_size, iv_size,
|
key_size, iv_size,
|
||||||
&enc_mbr, &dec_mbr);
|
&enc_mbr, &dec_mbr);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
log_std(N_("# Algorithm | Key | Encryption | Decryption\n"));
|
/* TRANSLATORS: The string is header of a table and must be exactly (right side) aligned. */
|
||||||
log_std("%11s-%s %4db %6.1f MiB/s %6.1f MiB/s\n",
|
log_std(_("# Algorithm | Key | Encryption | Decryption\n"));
|
||||||
|
log_std("%11s-%s %9db %10.1f MiB/s %10.1f MiB/s\n",
|
||||||
cipher, cipher_mode, key_size*8, enc_mbr, dec_mbr);
|
cipher, cipher_mode, key_size*8, enc_mbr, dec_mbr);
|
||||||
} else if (r == -ENOENT)
|
} else if (r == -ENOENT)
|
||||||
log_err(_("Cipher %s is not available.\n"), opt_cipher);
|
log_err(_("Cipher %s is not available.\n"), opt_cipher);
|
||||||
@@ -799,15 +800,16 @@ static int action_benchmark(void)
|
|||||||
if (r == -ENOENT)
|
if (r == -ENOENT)
|
||||||
skipped++;
|
skipped++;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
log_std(N_("# Algorithm | Key | Encryption | Decryption\n"));
|
/* TRANSLATORS: The string is header of a table and must be exactly (right side) aligned. */
|
||||||
|
log_std(_("# Algorithm | Key | Encryption | Decryption\n"));
|
||||||
|
|
||||||
snprintf(cipher, MAX_CIPHER_LEN, "%s-%s",
|
snprintf(cipher, MAX_CIPHER_LEN, "%s-%s",
|
||||||
bciphers[i].cipher, bciphers[i].mode);
|
bciphers[i].cipher, bciphers[i].mode);
|
||||||
if (!r)
|
if (!r)
|
||||||
log_std("%15s %4zub %6.1f MiB/s %6.1f MiB/s\n",
|
log_std("%15s %9zub %10.1f MiB/s %10.1f MiB/s\n",
|
||||||
cipher, bciphers[i].key_size*8, enc_mbr, dec_mbr);
|
cipher, bciphers[i].key_size*8, enc_mbr, dec_mbr);
|
||||||
else
|
else
|
||||||
log_std("%15s %4zub %13s %13s\n", cipher,
|
log_std("%15s %9zub %17s %17s\n", cipher,
|
||||||
bciphers[i].key_size*8, _("N/A"), _("N/A"));
|
bciphers[i].key_size*8, _("N/A"), _("N/A"));
|
||||||
}
|
}
|
||||||
if (skipped && skipped == i)
|
if (skipped && skipped == i)
|
||||||
@@ -967,9 +969,8 @@ static int action_luksFormat(void)
|
|||||||
|
|
||||||
header_device = opt_header_device ?: action_argv[0];
|
header_device = opt_header_device ?: action_argv[0];
|
||||||
|
|
||||||
if(asprintf(&msg, _("This will overwrite data on %s irrevocably."),
|
r = asprintf(&msg, _("This will overwrite data on %s irrevocably."), header_device);
|
||||||
header_device) == -1) {
|
if (r == -1) {
|
||||||
log_err(_("memory allocation error in action_luksFormat"));
|
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ int main(int argc, const char **argv)
|
|||||||
{ "interleave-sectors", '\0', POPT_ARG_INT, &opt_interleave_sectors, 0, N_("Interleave sectors"), N_("SECTORS") },
|
{ "interleave-sectors", '\0', POPT_ARG_INT, &opt_interleave_sectors, 0, N_("Interleave sectors"), N_("SECTORS") },
|
||||||
{ "journal-watermark", '\0', POPT_ARG_INT, &opt_journal_watermark, 0, N_("Journal watermark"),N_("percent") },
|
{ "journal-watermark", '\0', POPT_ARG_INT, &opt_journal_watermark, 0, N_("Journal watermark"),N_("percent") },
|
||||||
{ "journal-commit-time",'\0', POPT_ARG_INT, &opt_journal_commit_time,0, N_("Journal commit time"), N_("ms") },
|
{ "journal-commit-time",'\0', POPT_ARG_INT, &opt_journal_commit_time,0, N_("Journal commit time"), N_("ms") },
|
||||||
{ "tag-size", 't', POPT_ARG_INT, &opt_tag_size, 0, N_("Tag size per-sector"), N_("bytes") },
|
{ "tag-size", 't', POPT_ARG_INT, &opt_tag_size, 0, N_("Tag size (per-sector)"), N_("bytes") },
|
||||||
{ "sector-size", 's', POPT_ARG_INT, &opt_sector_size, 0, N_("Sector size"), N_("bytes") },
|
{ "sector-size", 's', POPT_ARG_INT, &opt_sector_size, 0, N_("Sector size"), N_("bytes") },
|
||||||
{ "buffer-sectors", '\0', POPT_ARG_INT, &opt_buffer_sectors, 0, N_("Buffers size"), N_("SECTORS") },
|
{ "buffer-sectors", '\0', POPT_ARG_INT, &opt_buffer_sectors, 0, N_("Buffers size"), N_("SECTORS") },
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user