Permalink
Browse files

Fix usage of aesni_encrypt_xts() and aesni_decrypt_xts()

  • Loading branch information...
1 parent f7b7133 commit 8d083b6b372c1fdd42bc9dfef00281e389ccad0f @kmoore134 kmoore134 committed Sep 13, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 sys/fs/pefs/pefs_aesni.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <fs/pefs/pefs_crypto.h>
+#include <cryptodev_if.h>
#define AESNI_ENABLE_ENV "vfs.pefs.aesni_enable"
@@ -117,7 +118,8 @@ pefs_aesni_encrypt(const struct pefs_session *xses,
const struct pefs_aesni_ctx *ctx = &xctx->o.pctx_aesni;
if (ses->fpu_saved >= 0)
- aesni_encrypt_xts(ctx->rounds - 1, ctx->enc_schedule, in, out, NULL);
+ aesni_encrypt_xts(ses->rounds, ses->enc_schedule,
+ ses->xts_schedule, AES_BLOCK_LEN, in, out, NULL);
else
rijndael_encrypt(&ctx->sw, in, out);
}
@@ -130,7 +132,8 @@ pefs_aesni_decrypt(const struct pefs_session *xses,
const struct pefs_aesni_ctx *ctx = &xctx->o.pctx_aesni;
if (ses->fpu_saved >= 0)
- aesni_decrypt_xts(ctx->rounds - 1, ctx->dec_schedule, in, out, NULL);
+ aesni_decrypt_xts(ses->rounds, ses->enc_schedule,
+ ses->xts_schedule, AES_BLOCK_LEN, in, out, NULL);
else
rijndael_decrypt(&ctx->sw, in, out);
}

0 comments on commit 8d083b6

Please sign in to comment.