Index: sys/geom/eli/g_eli_integrity.c =================================================================== --- sys/geom/eli/g_eli_integrity.c +++ sys/geom/eli/g_eli_integrity.c @@ -515,6 +515,17 @@ if (bp->bio_cmd == BIO_WRITE) memset(data + sc->sc_alen + data_secsize, 0, encr_secsize - sc->sc_alen - data_secsize); + } else if (data_secsize + sc->sc_alen != encr_secsize) { + /* + * If the HMAC size is not a multiple of 128 bits, the + * per-sector data size is rounded down to ensure that + * encryption can be performed without requiring any + * padding. In this case, each sector contains unused + * bytes. + */ + if (bp->bio_cmd == BIO_WRITE) + memset(data + sc->sc_alen + data_secsize, 0, + encr_secsize - sc->sc_alen - data_secsize); } if (bp->bio_cmd == BIO_WRITE) {