Browse Source

Fix: workaround in efe8761 was not effective

- The mingw-based 64-bit Windows build still failed (even with
  the missing "!windows" added to chacha20poly1305_amd64.go)
- Revert to workaround in
  https://github.com/Psiphon-Labs/psiphon-tunnel-core/commit/c36ea33b5439856f34a38ba27937b466be00f7ac
- This actually keeps the optimization in place for Windows
Rod Hynes 8 years ago
parent
commit
1efb3c505c
1 changed files with 10 additions and 13 deletions
  1. 10 13
      psiphon/common/crypto/chacha20poly1305/chacha20poly1305_amd64.s

+ 10 - 13
psiphon/common/crypto/chacha20poly1305/chacha20poly1305_amd64.s

@@ -4,10 +4,7 @@
 
 // This file was originally from https://golang.org/cl/24717 by Vlad Krasnov of CloudFlare.
 
-// [Psiphon]
-// disable for windows builds due to multiple definition error in mingw
-
-// +build go1.7,amd64,!gccgo,!appengine,!windows
+// +build go1.7,amd64,!gccgo,!appengine
 
 #include "textflag.h"
 // General register allocation
@@ -212,7 +209,7 @@ GLOBL ·andMask<>(SB), (NOPTR+RODATA), $240
 #define polyMul polyMulStage1; polyMulStage2; polyMulStage3; polyMulReduceStage
 #define polyMulAVX2 polyMulStage1_AVX2; polyMulStage2_AVX2; polyMulStage3_AVX2; polyMulReduceStage
 // ----------------------------------------------------------------------------
-TEXT polyHashADInternal<>(SB), NOSPLIT, $0
+TEXT polyHashADInternalPsiphon<>(SB), NOSPLIT, $0
 	// adp points to beginning of additional data
 	// itr2 holds ad length
 	XORQ acc0, acc0
@@ -318,7 +315,7 @@ openSSEPreparePolyKey:
 
 	// Hash AAD
 	MOVQ ad_len+80(FP), itr2
-	CALL polyHashADInternal<>(SB)
+	CALL polyHashADInternalPsiphon<>(SB)
 
 openSSEMainLoop:
 	CMPQ inl, $256
@@ -479,7 +476,7 @@ openSSE128InnerCipherLoop:
 
 	// Hash
 	MOVQ ad_len+80(FP), itr2
-	CALL polyHashADInternal<>(SB)
+	CALL polyHashADInternalPsiphon<>(SB)
 
 openSSE128Open:
 	CMPQ inl, $16
@@ -825,7 +822,7 @@ openAVX2PreparePolyKey:
 
 	// Hash AD + first 64 bytes
 	MOVQ ad_len+80(FP), itr2
-	CALL polyHashADInternal<>(SB)
+	CALL polyHashADInternalPsiphon<>(SB)
 	XORQ itr1, itr1
 
 openAVX2InitialHash64:
@@ -1017,7 +1014,7 @@ openAVX2192InnerCipherLoop:
 openAVX2ShortOpen:
 	// Hash
 	MOVQ ad_len+80(FP), itr2
-	CALL polyHashADInternal<>(SB)
+	CALL polyHashADInternalPsiphon<>(SB)
 
 openAVX2ShortOpenLoop:
 	CMPQ inl, $32
@@ -1549,7 +1546,7 @@ sealSSEIntroLoop:
 
 	// Hash AAD
 	MOVQ ad_len+80(FP), itr2
-	CALL polyHashADInternal<>(SB)
+	CALL polyHashADInternalPsiphon<>(SB)
 
 	MOVOU (0*16)(inp), A0; MOVOU (1*16)(inp), B0; MOVOU (2*16)(inp), C0; MOVOU (3*16)(inp), D0
 	PXOR  A0, A1; PXOR B0, B1; PXOR C0, C1; PXOR D0, D1
@@ -1854,7 +1851,7 @@ sealSSE128InnerCipherLoop:
 
 	// Hash
 	MOVQ ad_len+80(FP), itr2
-	CALL polyHashADInternal<>(SB)
+	CALL polyHashADInternalPsiphon<>(SB)
 	XORQ itr1, itr1
 
 sealSSE128SealHash:
@@ -2029,7 +2026,7 @@ sealAVX2IntroLoop:
 
 	// Hash AD
 	MOVQ ad_len+80(FP), itr2
-	CALL polyHashADInternal<>(SB)
+	CALL polyHashADInternalPsiphon<>(SB)
 
 	// Can store at least 320 bytes
 	VPXOR   (0*32)(inp), AA0, AA0
@@ -2292,7 +2289,7 @@ sealAVX2192InnerCipherLoop:
 sealAVX2ShortSeal:
 	// Hash aad
 	MOVQ ad_len+80(FP), itr2
-	CALL polyHashADInternal<>(SB)
+	CALL polyHashADInternalPsiphon<>(SB)
 	XORQ itr1, itr1
 
 sealAVX2SealHash: