From owner-svn-src-all@FreeBSD.ORG Sun Jan 17 13:31:48 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC006106566B; Sun, 17 Jan 2010 13:31:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99EAB8FC14; Sun, 17 Jan 2010 13:31:48 +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 o0HDVm8p036402; Sun, 17 Jan 2010 13:31:48 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0HDVmqp036400; Sun, 17 Jan 2010 13:31:48 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201001171331.o0HDVmqp036400@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 17 Jan 2010 13:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202475 - stable/7/sys/opencrypto X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jan 2010 13:31:48 -0000 Author: bz Date: Sun Jan 17 13:31:48 2010 New Revision: 202475 URL: http://svn.freebsd.org/changeset/base/202475 Log: MFC r187826: While OpenBSD's crypto/ framework has sha1 and md5 implementations that can cope with a result buffer of NULL in the "Final" function, we cannot. Thus pass in a temporary buffer long enough for either md5 or sha1 results so that we do not panic. PR: bin/126468 Reviewed by: cperciva Modified: stable/7/sys/opencrypto/cryptosoft.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/opencrypto/cryptosoft.c ============================================================================== --- stable/7/sys/opencrypto/cryptosoft.c Sun Jan 17 13:28:25 2010 (r202474) +++ stable/7/sys/opencrypto/cryptosoft.c Sun Jan 17 13:31:48 2010 (r202475) @@ -429,12 +429,17 @@ swcr_authprepare(struct auth_hash *axf, break; case CRYPTO_MD5_KPDK: case CRYPTO_SHA1_KPDK: + { + /* We need a buffer that can hold an md5 and a sha1 result. */ + u_char buf[SHA1_RESULTLEN]; + sw->sw_klen = klen; bcopy(key, sw->sw_octx, klen); axf->Init(sw->sw_ictx); axf->Update(sw->sw_ictx, key, klen); - axf->Final(NULL, sw->sw_ictx); + axf->Final(buf, sw->sw_ictx); break; + } default: printf("%s: CRD_F_KEY_EXPLICIT flag given, but algorithm %d " "doesn't use keys.\n", __func__, axf->type);