From owner-p4-projects@FreeBSD.ORG Mon Oct 20 21:28:09 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 15D1FF77; Mon, 20 Oct 2014 21:28:09 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CABA4F75 for ; Mon, 20 Oct 2014 21:28:08 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6E76CFA for ; Mon, 20 Oct 2014 21:28:08 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KLS8EP093674 for ; Mon, 20 Oct 2014 21:28:08 GMT (envelope-from jmg@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.9/8.14.9/Submit) id s9KLS8cb093671 for perforce@freebsd.org; Mon, 20 Oct 2014 21:28:08 GMT (envelope-from jmg@freebsd.org) Date: Mon, 20 Oct 2014 21:28:08 GMT Message-Id: <201410202128.s9KLS8cb093671@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jmg@freebsd.org using -f From: John-Mark Gurney Subject: PERFORCE change 1201823 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.18-1 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 21:28:09 -0000 http://p4web.freebsd.org/@@1201823?ac=10 Change 1201823 by jmg@jmg_carbon2 on 2014/10/20 21:27:22 cast [ani]bytes to uint64_t so that the *8 doesn't overflow them... This ups the size limit from 512MB-1 to 4GB-1... The original Intel code used int (signed) so their limit was slightly smaller... Submitted by: Mike Hamburg (reviewer) Sponsored by: FreeBSD Foundation Sponsored by: Netgate Affected files ... .. //depot/projects/opencrypto/sys/crypto/aesni/aesni_ghash.c#5 edit Differences ... ==== //depot/projects/opencrypto/sys/crypto/aesni/aesni_ghash.c#5 (text+ko) ==== @@ -314,7 +314,7 @@ Y = _mm_xor_si128(Y, tmp1); gfmul(Y, H, &Y); } - tmp1 = _mm_insert_epi64(tmp1, ibytes*8, 0); + tmp1 = _mm_insert_epi64(tmp1, (uint64_t)ibytes*8, 0); tmp1 = _mm_insert_epi64(tmp1, 0, 1); Y = _mm_xor_si128(Y, tmp1); @@ -496,8 +496,8 @@ X = _mm_xor_si128(X, tmp1); gfmul(X, H, &X); } - tmp1 = _mm_insert_epi64(tmp1, nbytes*8, 0); - tmp1 = _mm_insert_epi64(tmp1, abytes*8, 1); + tmp1 = _mm_insert_epi64(tmp1, (uint64_t)nbytes*8, 0); + tmp1 = _mm_insert_epi64(tmp1, (uint64_t)abytes*8, 1); X = _mm_xor_si128(X, tmp1); gfmul(X,H,&X); @@ -572,7 +572,7 @@ Y = _mm_xor_si128(Y, tmp1); gfmul(Y, H, &Y); } - tmp1 = _mm_insert_epi64(tmp1, ibytes*8, 0); + tmp1 = _mm_insert_epi64(tmp1, (uint64_t)ibytes*8, 0); tmp1 = _mm_insert_epi64(tmp1, 0, 1); Y = _mm_xor_si128(Y, tmp1); @@ -651,8 +651,8 @@ gfmul(X, H, &X); } - tmp1 = _mm_insert_epi64(tmp1, nbytes*8, 0); - tmp1 = _mm_insert_epi64(tmp1, abytes*8, 1); + tmp1 = _mm_insert_epi64(tmp1, (uint64_t)nbytes*8, 0); + tmp1 = _mm_insert_epi64(tmp1, (uint64_t)abytes*8, 1); X = _mm_xor_si128(X, tmp1); gfmul(X,H,&X);