Date: Wed, 20 May 2020 22:25:41 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361306 - in head: stand/libsa/geli sys/opencrypto Message-ID: <202005202225.04KMPfoF033285@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed May 20 22:25:41 2020 New Revision: 361306 URL: https://svnweb.freebsd.org/changeset/base/361306 Log: Fix libstand build breakage after r361298. - Use enc_xform_aes_xts.setkey() directly instead of duplicating the code now that it no longer calls malloc(). - Rather than bringing back all of xform_userland.h, add a conditional #include of <stand.h> to xform_enc.h. - Update calls to encrypt/decrypt callbacks in enc_xform_aes_xts for separate input/output pointers. Pointy hat to: jhb Modified: head/stand/libsa/geli/geliboot_crypto.c head/sys/opencrypto/xform_enc.h Modified: head/stand/libsa/geli/geliboot_crypto.c ============================================================================== --- head/stand/libsa/geli/geliboot_crypto.c Wed May 20 22:20:53 2020 (r361305) +++ head/stand/libsa/geli/geliboot_crypto.c Wed May 20 22:25:41 2020 (r361306) @@ -78,20 +78,20 @@ geliboot_crypt(u_int algo, int enc, u_char *data, size xts_len = keysize << 1; ctxp = &xtsctx; - rijndael_set_key(&ctxp->key1, key, xts_len / 2); - rijndael_set_key(&ctxp->key2, key + (xts_len / 16), xts_len / 2); + enc_xform_aes_xts.setkey(ctxp, key, xts_len / 8); + enc_xform_aes_xts.reinit(ctxp, iv); - enc_xform_aes_xts.reinit((caddr_t)ctxp, iv); - switch (enc) { case 0: /* decrypt */ for (i = 0; i < datasize; i += AES_XTS_BLOCKSIZE) { - enc_xform_aes_xts.decrypt((caddr_t)ctxp, data + i); + enc_xform_aes_xts.decrypt(ctxp, data + i, + data + i); } break; case 1: /* encrypt */ for (i = 0; i < datasize; i += AES_XTS_BLOCKSIZE) { - enc_xform_aes_xts.encrypt((caddr_t)ctxp, data + i); + enc_xform_aes_xts.encrypt(ctxp, data + i, + data + 1); } break; } Modified: head/sys/opencrypto/xform_enc.h ============================================================================== --- head/sys/opencrypto/xform_enc.h Wed May 20 22:20:53 2020 (r361305) +++ head/sys/opencrypto/xform_enc.h Wed May 20 22:25:41 2020 (r361306) @@ -36,6 +36,9 @@ #include <crypto/rijndael/rijndael.h> #include <crypto/camellia/camellia.h> #include <opencrypto/cryptodev.h> +#ifdef _STANDALONE +#include <stand.h> +#endif #define AESICM_BLOCKSIZE AES_BLOCK_LEN #define AES_XTS_BLOCKSIZE 16
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005202225.04KMPfoF033285>