Date: Thu, 23 Sep 2010 11:26:38 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r213064 - head/sys/crypto/aesni Message-ID: <201009231126.o8NBQcNK067475@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Thu Sep 23 11:26:38 2010 New Revision: 213064 URL: http://svn.freebsd.org/changeset/base/213064 Log: Simplify code a bit. MFC after: 1 week Modified: head/sys/crypto/aesni/aesni.c head/sys/crypto/aesni/aesni_wrap.c Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Thu Sep 23 11:23:10 2010 (r213063) +++ head/sys/crypto/aesni/aesni.c Thu Sep 23 11:26:38 2010 (r213064) @@ -69,14 +69,12 @@ aesni_identify(driver_t *drv, device_t p 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); } Modified: head/sys/crypto/aesni/aesni_wrap.c ============================================================================== --- head/sys/crypto/aesni/aesni_wrap.c Thu Sep 23 11:23:10 2010 (r213063) +++ head/sys/crypto/aesni/aesni_wrap.c Thu Sep 23 11:26:38 2010 (r213064) @@ -147,15 +147,13 @@ aesni_cipher_process(struct aesni_sessio 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_sessio 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009231126.o8NBQcNK067475>