Index: sbin/geom/class/eli/geom_eli.c =================================================================== --- sbin/geom/class/eli/geom_eli.c +++ sbin/geom/class/eli/geom_eli.c @@ -666,7 +666,7 @@ eli_init(struct gctl_req *req) { struct g_eli_metadata md; - unsigned char sector[sizeof(struct g_eli_metadata)]; + unsigned char sector[sizeof(struct g_eli_metadata)] __aligned(4); unsigned char key[G_ELI_USERKEYLEN]; char backfile[MAXPATHLEN]; const char *str, *prov; Index: sys/geom/eli/g_eli.h =================================================================== --- sys/geom/eli/g_eli.h +++ sys/geom/eli/g_eli.h @@ -248,6 +248,7 @@ uint8_t md_salt[G_ELI_SALTLEN]; /* Salt. */ /* Encrypted master key (IV-key, Data-key, HMAC). */ uint8_t md_mkeys[G_ELI_MAXMKEYS * G_ELI_MKEYLEN]; + uint8_t unused; /* Alignment */ u_char md_hash[16]; /* MD5 hash. */ } __packed; #ifndef _OpenSSL_ Index: sys/geom/eli/g_eli_integrity.c =================================================================== --- sys/geom/eli/g_eli_integrity.c +++ sys/geom/eli/g_eli_integrity.c @@ -410,6 +410,7 @@ off_t dstoff; u_char *p, *data, *auth, *authkey, *plaindata; int error; + int val; G_ELI_LOGREQ(3, bp, "%s", __func__); @@ -444,6 +445,7 @@ size += sizeof(*crde) * nsec; size += sizeof(*crda) * nsec; size += G_ELI_AUTH_SECKEYLEN * nsec; + size += 8; /* space for alignment */ data = malloc(size, M_ELI, M_WAITOK); bp->bio_driver2 = data; p = data + encr_secsize * nsec; @@ -451,6 +453,11 @@ bp->bio_inbed = 0; bp->bio_children = nsec; + /* Align the pointer */ + val = (uintptr_t)p & (sizeof(uintptr_t) - 1); + if (val) + p += (sizeof(uintptr_t) - val); + for (i = 1; i <= nsec; i++, dstoff += encr_secsize) { crp = (struct cryptop *)p; p += sizeof(*crp); crde = (struct cryptodesc *)p; p += sizeof(*crde);