From owner-svn-src-head@FreeBSD.ORG Thu Sep 23 11:26:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93A5A106564A; Thu, 23 Sep 2010 11:26:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 832718FC1C; Thu, 23 Sep 2010 11:26:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NBQcde067478; Thu, 23 Sep 2010 11:26:38 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NBQcNK067475; Thu, 23 Sep 2010 11:26:38 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201009231126.o8NBQcNK067475@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 23 Sep 2010 11:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213064 - head/sys/crypto/aesni X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2010 11:26:38 -0000 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); }