From owner-cvs-src@FreeBSD.ORG Wed May 17 18:24:40 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5606316A8FB; Wed, 17 May 2006 18:24:40 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4602843D66; Wed, 17 May 2006 18:24:39 +0000 (GMT) (envelope-from pjd@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4HIOIMX040647; Wed, 17 May 2006 18:24:18 GMT (envelope-from pjd@repoman.freebsd.org) Received: (from pjd@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4HIOI1U040646; Wed, 17 May 2006 18:24:18 GMT (envelope-from pjd) Message-Id: <200605171824.k4HIOI1U040646@repoman.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 17 May 2006 18:24:17 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/opencrypto cryptodev.c cryptodev.h cryptosoft.c cryptosoft.h xform.c xform.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 May 2006 18:24:40 -0000 pjd 2006-05-17 18:24:17 UTC FreeBSD src repository Modified files: sys/opencrypto cryptodev.c cryptodev.h cryptosoft.c cryptosoft.h xform.c xform.h Log: - Fix a very old bug in HMAC/SHA{384,512}. When HMAC is using SHA384 or SHA512, the blocksize is 128 bytes, not 64 bytes as anywhere else. The bug also exists in NetBSD, OpenBSD and various other independed implementations I look at. - We cannot decide which hash function to use for HMAC based on the key length, because any HMAC function can use any key length. To fix it split CRYPTO_SHA2_HMAC into three algorithm: CRYPTO_SHA2_256_HMAC, CRYPTO_SHA2_384_HMAC and CRYPTO_SHA2_512_HMAC. Those names are consistent with OpenBSD's naming. - Remove authsize field from auth_hash structure. - Allow consumer to define size of hash he wants to receive. This allows to use HMAC not only for IPsec, where 96 bits MAC is requested. The size of requested MAC is defined at newsession time in the cri_mlen field - when 0, entire MAC will be returned. - Add swcr_authprepare() function which prepares authentication key. - Allow to provide key for every authentication operation, not only at newsession time by honoring CRD_F_KEY_EXPLICIT flag. - Make giving key at newsession time optional - don't try to operate on it if its NULL. - Extend COPYBACK()/COPYDATA() macros to handle CRYPTO_BUF_CONTIG buffer type as well. - Accept CRYPTO_BUF_IOV buffer type in swcr_authcompute() as we have cuio_apply() now. - 16 bits for key length (SW_klen) is more than enough. Reviewed by: sam Revision Changes Path 1.30 +12 -15 src/sys/opencrypto/cryptodev.c 1.14 +11 -6 src/sys/opencrypto/cryptodev.h 1.12 +147 -89 src/sys/opencrypto/cryptosoft.c 1.3 +5 -3 src/sys/opencrypto/cryptosoft.h 1.7 +15 -15 src/sys/opencrypto/xform.c 1.3 +4 -4 src/sys/opencrypto/xform.h