projects
/
platform
/
upstream
/
cryptsetup.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
549ab64
)
Fix some problems found by Coverity scan.
author
Milan Broz
<gmazyland@gmail.com>
Mon, 10 Dec 2012 16:28:52 +0000
(17:28 +0100)
committer
Milan Broz
<gmazyland@gmail.com>
Mon, 10 Dec 2012 16:28:52 +0000
(17:28 +0100)
lib/crypto_backend/pbkdf_check.c
patch
|
blob
|
history
lib/setup.c
patch
|
blob
|
history
lib/tcrypt/tcrypt.c
patch
|
blob
|
history
lib/utils_benchmark.c
patch
|
blob
|
history
src/cryptsetup.c
patch
|
blob
|
history
diff --git
a/lib/crypto_backend/pbkdf_check.c
b/lib/crypto_backend/pbkdf_check.c
index
69f6bfb
..
ce5bd1e
100644
(file)
--- a/
lib/crypto_backend/pbkdf_check.c
+++ b/
lib/crypto_backend/pbkdf_check.c
@@
-82,10
+82,6
@@
int crypt_pbkdf_check(const char *kdf, const char *hash,
return -EINVAL;
}
return -EINVAL;
}
- /* Safety check if anything went wrong */
- if (ms < 10)
- return -EINVAL;
-
if (iter_secs)
*iter_secs = (iterations * 1000) / ms;
return r;
if (iter_secs)
*iter_secs = (iterations * 1000) / ms;
return r;
diff --git
a/lib/setup.c
b/lib/setup.c
index
5e01f99
..
5914f9d
100644
(file)
--- a/
lib/setup.c
+++ b/
lib/setup.c
@@
-1679,7
+1679,7
@@
int crypt_keyslot_change_by_passphrase(struct crypt_device *cd,
r = LUKS_open_key_with_hdr(keyslot_old, passphrase, passphrase_size,
&cd->u.luks1.hdr, &vk, cd);
if (r < 0)
r = LUKS_open_key_with_hdr(keyslot_old, passphrase, passphrase_size,
&cd->u.luks1.hdr, &vk, cd);
if (r < 0)
-
return r
;
+
goto out
;
if (keyslot_old != CRYPT_ANY_SLOT && keyslot_old != r) {
log_dbg("Keyslot mismatch.");
if (keyslot_old != CRYPT_ANY_SLOT && keyslot_old != r) {
log_dbg("Keyslot mismatch.");
diff --git
a/lib/tcrypt/tcrypt.c
b/lib/tcrypt/tcrypt.c
index
b1ebd05
..
1672c71
100644
(file)
--- a/
lib/tcrypt/tcrypt.c
+++ b/
lib/tcrypt/tcrypt.c
@@
-471,12
+471,16
@@
static int TCRYPT_init_hdr(struct crypt_device *cd,
struct crypt_params_tcrypt *params)
{
unsigned char pwd[TCRYPT_KEY_POOL_LEN] = {};
struct crypt_params_tcrypt *params)
{
unsigned char pwd[TCRYPT_KEY_POOL_LEN] = {};
- size_t passphrase_size;
+ size_t passphrase_size
, alignment
;
char *key;
unsigned int i, skipped = 0;
int r = -EINVAL, legacy_modes;
char *key;
unsigned int i, skipped = 0;
int r = -EINVAL, legacy_modes;
- if (posix_memalign((void*)&key, crypt_getpagesize(), TCRYPT_HDR_KEY_LEN))
+ alignment = crypt_getpagesize();
+ if (alignment < 0)
+ return -EINVAL;
+
+ if (posix_memalign((void*)&key, alignment, TCRYPT_HDR_KEY_LEN))
return -ENOMEM;
if (params->keyfiles_count)
return -ENOMEM;
if (params->keyfiles_count)
diff --git
a/lib/utils_benchmark.c
b/lib/utils_benchmark.c
index
4ee0c03
..
f392382
100644
(file)
--- a/
lib/utils_benchmark.c
+++ b/
lib/utils_benchmark.c
@@
-128,9
+128,14
@@
static int cipher_perf(struct cipher_perf *cp,
{
long ms_enc, ms_dec, ms;
int repeat_enc, repeat_dec;
{
long ms_enc, ms_dec, ms;
int repeat_enc, repeat_dec;
+ size_t alignment;
void *buf = NULL;
void *buf = NULL;
- if (posix_memalign(&buf, crypt_getpagesize(), cp->buffer_size))
+ alignment = crypt_getpagesize();
+ if (alignment < 0)
+ return -EINVAL;
+
+ if (posix_memalign(&buf, alignment, cp->buffer_size))
return -ENOMEM;
ms_enc = 0;
return -ENOMEM;
ms_enc = 0;
diff --git
a/src/cryptsetup.c
b/src/cryptsetup.c
index
d652bad
..
4592897
100644
(file)
--- a/
src/cryptsetup.c
+++ b/
src/cryptsetup.c
@@
-491,10
+491,8
@@
static int action_benchmark(void)
&enc_mbr, &dec_mbr);
if (!r) {
log_std("# Algorithm | Key | Encryption | Decryption\n");
&enc_mbr, &dec_mbr);
if (!r) {
log_std("# Algorithm | Key | Encryption | Decryption\n");
- strncat(cipher, "-", MAX_CIPHER_LEN);
- strncat(cipher, cipher_mode, MAX_CIPHER_LEN);
- log_std("%12s %4db %5.1f MiB/s %5.1f MiB/s\n",
- cipher, key_size, enc_mbr, dec_mbr);
+ log_std("%8s-%s %4db %5.1f MiB/s %5.1f MiB/s\n",
+ cipher, cipher_mode, key_size, enc_mbr, dec_mbr);
} else if (r == -ENOENT)
log_err(_("Cipher %s is not available.\n"), opt_cipher);
} else {
} else if (r == -ENOENT)
log_err(_("Cipher %s is not available.\n"), opt_cipher);
} else {