Simplify code a bit.

MFC after:	1 week
This commit is contained in:
Pawel Jakub Dawidek 2010-09-23 11:26:38 +00:00
parent 1f0fb66f30
commit 745eb0ccb6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=213064
2 changed files with 5 additions and 10 deletions

View File

@ -69,14 +69,12 @@ aesni_identify(driver_t *drv, device_t parent)
static int
aesni_probe(device_t dev)
{
char capp[32];
if ((cpu_feature2 & CPUID2_AESNI) == 0) {
device_printf(dev, "No AESNI support.\n");
return (EINVAL);
}
strlcpy(capp, "AES-CBC", sizeof(capp));
device_set_desc_copy(dev, capp);
device_set_desc_copy(dev, "AES-CBC");
return (0);
}

View File

@ -147,15 +147,13 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptodesc *enccrd,
int error, allocated;
buf = aesni_cipher_alloc(enccrd, crp, &allocated);
if (buf == NULL) {
error = ENOMEM;
goto out;
}
if (buf == NULL)
return (ENOMEM);
td = curthread;
error = fpu_kern_enter(td, &ses->fpu_ctx, FPU_KERN_NORMAL);
if (error != 0)
goto out1;
goto out;
if ((enccrd->crd_flags & CRD_F_ENCRYPT) != 0) {
if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT) != 0)
@ -184,11 +182,10 @@ aesni_cipher_process(struct aesni_session *ses, struct cryptodesc *enccrd,
crypto_copydata(crp->crp_flags, crp->crp_buf,
enccrd->crd_skip + enccrd->crd_len - AES_BLOCK_LEN,
AES_BLOCK_LEN, ses->iv);
out1:
out:
if (allocated) {
bzero(buf, enccrd->crd_len);
free(buf, M_AESNI);
}
out:
return (error);
}