stand: fix build after recent opencrypto changes

Pass the ivlen along through, and just drop this KASSERT() if we're
building _STANDALONE for the time being.

Fixes:	1833d6042c ("crypto: Permit variable-sized IVs ...")
This commit is contained in:
Kyle Evans 2021-10-06 20:19:47 -05:00
parent 10ff414c14
commit d586c978b9
4 changed files with 8 additions and 5 deletions

View File

@ -345,7 +345,7 @@ geli_io(struct geli_dev *gdev, geli_op_t enc, off_t offset, u_char *buf,
g_eli_key_fill(&gdev->sc, &gkey, keyno);
error = geliboot_crypt(gdev->sc.sc_ealgo, enc, pbuf, secsize,
gkey.gek_key, gdev->sc.sc_ekeylen, iv);
gkey.gek_key, gdev->sc.sc_ekeylen, iv, sizeof(iv));
if (error != 0) {
explicit_bzero(&gkey, sizeof(gkey));

View File

@ -36,7 +36,7 @@
int
geliboot_crypt(u_int algo, geli_op_t enc, u_char *data, size_t datasize,
const u_char *key, size_t keysize, u_char *iv)
const u_char *key, size_t keysize, u_char *iv, size_t ivlen)
{
keyInstance aeskey;
cipherInstance cipher;
@ -81,7 +81,7 @@ geliboot_crypt(u_int algo, geli_op_t enc, u_char *data, size_t datasize,
ctxp = &xtsctx;
enc_xform_aes_xts.setkey(ctxp, key, xts_len / 8);
enc_xform_aes_xts.reinit(ctxp, iv);
enc_xform_aes_xts.reinit(ctxp, iv, ivlen);
switch (enc) {
case GELI_DECRYPT:
@ -113,7 +113,8 @@ g_eli_crypto_cipher(u_int algo, geli_op_t enc, u_char *data, size_t datasize,
u_char iv[keysize];
explicit_bzero(iv, sizeof(iv));
return (geliboot_crypt(algo, enc, data, datasize, key, keysize, iv));
return (geliboot_crypt(algo, enc, data, datasize, key, keysize, iv,
sizeof(iv)));
}
int

View File

@ -68,6 +68,6 @@ struct geli_dev {
};
int geliboot_crypt(u_int algo, geli_op_t enc, u_char *data, size_t datasize,
const u_char *key, size_t keysize, u_char *iv);
const u_char *key, size_t keysize, u_char *iv, size_t ivlen);
#endif /* _GELIBOOT_INTERNAL_H_ */

View File

@ -83,8 +83,10 @@ aes_xts_reinit(void *key, const uint8_t *iv, size_t ivlen)
uint64_t blocknum;
u_int i;
#ifndef _STANDALONE
KASSERT(ivlen == sizeof(blocknum),
("%s: invalid IV length", __func__));
#endif
/*
* Prepare tweak as E_k2(IV). IV is specified as LE representation