PERFORCE change 1201823 for review

John-Mark Gurney jmg at FreeBSD.org
Mon Oct 20 21:28:09 UTC 2014


http://p4web.freebsd.org/@@1201823?ac=10

Change 1201823 by jmg at 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);


More information about the p4-projects mailing list