mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-06 08:20:07 +01:00
Fix signed/unsigned compiler warnings.
This commit is contained in:
@@ -46,7 +46,7 @@ struct crypt_cipher {
|
|||||||
|
|
||||||
struct cipher_alg {
|
struct cipher_alg {
|
||||||
const char *name;
|
const char *name;
|
||||||
unsigned int blocksize;
|
int blocksize;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* FIXME: Getting block size should be dynamic from cipher backend. */
|
/* FIXME: Getting block size should be dynamic from cipher backend. */
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ static int crypt_sector_iv_init(struct crypt_sector_iv *ctx,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
hash_size = crypt_hash_size(++hash_name);
|
hash_size = crypt_hash_size(++hash_name);
|
||||||
if (hash_size < 0 || hash_size > sizeof(tmp))
|
if (hash_size < 0 || (unsigned)hash_size > sizeof(tmp))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (crypt_hash_init(&h, hash_name))
|
if (crypt_hash_init(&h, hash_name))
|
||||||
@@ -227,7 +227,8 @@ int crypt_storage_decrypt(struct crypt_storage *ctx,
|
|||||||
uint64_t sector, size_t count,
|
uint64_t sector, size_t count,
|
||||||
char *buffer)
|
char *buffer)
|
||||||
{
|
{
|
||||||
int i, r = 0;
|
unsigned int i;
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
r = crypt_sector_iv_generate(&ctx->cipher_iv, sector + i);
|
r = crypt_sector_iv_generate(&ctx->cipher_iv, sector + i);
|
||||||
@@ -250,7 +251,8 @@ int crypt_storage_encrypt(struct crypt_storage *ctx,
|
|||||||
uint64_t sector, size_t count,
|
uint64_t sector, size_t count,
|
||||||
char *buffer)
|
char *buffer)
|
||||||
{
|
{
|
||||||
int i, r = 0;
|
unsigned int i;
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
r = crypt_sector_iv_generate(&ctx->cipher_iv, sector + i);
|
r = crypt_sector_iv_generate(&ctx->cipher_iv, sector + i);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ static int device_check(struct reenc_ctx *rc, header_magic set_magic)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s = read(devfd, buf, buf_size);
|
s = read(devfd, buf, buf_size);
|
||||||
if (s < 0 || s != buf_size) {
|
if (s < 0 || s != (ssize_t)buf_size) {
|
||||||
log_err(_("Cannot read device %s.\n"), rc->device);
|
log_err(_("Cannot read device %s.\n"), rc->device);
|
||||||
r = -EIO;
|
r = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -193,7 +193,7 @@ static int device_check(struct reenc_ctx *rc, header_magic set_magic)
|
|||||||
if (lseek(devfd, 0, SEEK_SET) == -1)
|
if (lseek(devfd, 0, SEEK_SET) == -1)
|
||||||
goto out;
|
goto out;
|
||||||
s = write(devfd, buf, buf_size);
|
s = write(devfd, buf, buf_size);
|
||||||
if (s < 0 || s != buf_size) {
|
if (s < 0 || s != (ssize_t)buf_size) {
|
||||||
log_err(_("Cannot write device %s.\n"), rc->device);
|
log_err(_("Cannot write device %s.\n"), rc->device);
|
||||||
r = -EIO;
|
r = -EIO;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user