]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm-integrity: rename internal_hash
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 17 Sep 2025 15:51:36 +0000 (17:51 +0200)
committerMikulas Patocka <mpatocka@redhat.com>
Tue, 23 Sep 2025 12:51:04 +0000 (14:51 +0200)
Rename "internal_hash" to "internal_shash" and introduce a boolean value
"internal_hash".

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-integrity.c

index 79befa0594222f65203c6266e80c2b1798efebd6..67c98e45a4d30df0fde8b0cbf5cf3f92835bfe8f 100644 (file)
@@ -219,10 +219,11 @@ struct dm_integrity_c {
        __u8 log2_blocks_per_bitmap_bit;
 
        unsigned char mode;
+       bool internal_hash;
 
        int failed;
 
-       struct crypto_shash *internal_hash;
+       struct crypto_shash *internal_shash;
        unsigned int internal_hash_digestsize;
 
        struct dm_target *ti;
@@ -1639,11 +1640,11 @@ static void integrity_sector_checksum(struct dm_integrity_c *ic, sector_t sector
                                      const char *data, unsigned offset, char *result)
 {
        __le64 sector_le = cpu_to_le64(sector);
-       SHASH_DESC_ON_STACK(req, ic->internal_hash);
+       SHASH_DESC_ON_STACK(req, ic->internal_shash);
        int r;
        unsigned int digest_size;
 
-       req->tfm = ic->internal_hash;
+       req->tfm = ic->internal_shash;
 
        r = crypto_shash_init(req);
        if (unlikely(r < 0)) {
@@ -4708,12 +4709,14 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
                buffer_sectors = 1;
        ic->log2_buffer_sectors = min((int)__fls(buffer_sectors), 31 - SECTOR_SHIFT);
 
-       r = get_mac(&ic->internal_hash, &ic->internal_hash_alg, &ti->error,
+       r = get_mac(&ic->internal_shash, &ic->internal_hash_alg, &ti->error,
                    "Invalid internal hash", "Error setting internal hash key");
        if (r)
                goto bad;
-       if (ic->internal_hash)
-               ic->internal_hash_digestsize = crypto_shash_digestsize(ic->internal_hash);
+       if (ic->internal_shash) {
+               ic->internal_hash = true;
+               ic->internal_hash_digestsize = crypto_shash_digestsize(ic->internal_shash);
+       }
 
        r = get_mac(&ic->journal_mac, &ic->journal_mac_alg, &ti->error,
                    "Invalid journal mac", "Error setting journal mac key");
@@ -5235,8 +5238,8 @@ static void dm_integrity_dtr(struct dm_target *ti)
        if (ic->sb)
                free_pages_exact(ic->sb, SB_SECTORS << SECTOR_SHIFT);
 
-       if (ic->internal_hash)
-               crypto_free_shash(ic->internal_hash);
+       if (ic->internal_shash)
+               crypto_free_shash(ic->internal_shash);
        free_alg(&ic->internal_hash_alg);
 
        if (ic->journal_crypt)