|  | @@ -51,7 +51,7 @@ func TestAuthenticationReaderWriter(t *testing.T) {
 | 
	
		
			
				|  |  |  			Content: iv,
 | 
	
		
			
				|  |  |  		},
 | 
	
		
			
				|  |  |  		AdditionalDataGenerator: &NoOpBytesGenerator{},
 | 
	
		
			
				|  |  | -	}, cache, false)
 | 
	
		
			
				|  |  | +	}, cache)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	actualPayload := make([]byte, 16*1024)
 | 
	
		
			
				|  |  |  	nBytes, err = reader.Read(actualPayload)
 | 
	
	
		
			
				|  | @@ -102,7 +102,7 @@ func TestAuthenticationReaderWriterPartial(t *testing.T) {
 | 
	
		
			
				|  |  |  			Content: iv,
 | 
	
		
			
				|  |  |  		},
 | 
	
		
			
				|  |  |  		AdditionalDataGenerator: &NoOpBytesGenerator{},
 | 
	
		
			
				|  |  | -	}, cache, false)
 | 
	
		
			
				|  |  | +	}, cache)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	actualPayload := make([]byte, 7*1024)
 | 
	
		
			
				|  |  |  	nBytes, err = reader.Read(actualPayload)
 | 
	
	
		
			
				|  | @@ -118,56 +118,3 @@ func TestAuthenticationReaderWriterPartial(t *testing.T) {
 | 
	
		
			
				|  |  |  	_, err = reader.Read(actualPayload)
 | 
	
		
			
				|  |  |  	assert.Error(err).Equals(io.EOF)
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -func TestAuthenticationReaderWriterAggressive(t *testing.T) {
 | 
	
		
			
				|  |  | -	assert := assert.On(t)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	key := make([]byte, 16)
 | 
	
		
			
				|  |  | -	rand.Read(key)
 | 
	
		
			
				|  |  | -	block, err := aes.NewCipher(key)
 | 
	
		
			
				|  |  | -	assert.Error(err).IsNil()
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	aead, err := cipher.NewGCM(block)
 | 
	
		
			
				|  |  | -	assert.Error(err).IsNil()
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	payload := make([]byte, 7*1024)
 | 
	
		
			
				|  |  | -	rand.Read(payload)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	cache := buf.NewLocal(16 * 1024)
 | 
	
		
			
				|  |  | -	iv := make([]byte, 12)
 | 
	
		
			
				|  |  | -	rand.Read(iv)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	writer := NewAuthenticationWriter(&AEADAuthenticator{
 | 
	
		
			
				|  |  | -		AEAD: aead,
 | 
	
		
			
				|  |  | -		NonceGenerator: &StaticBytesGenerator{
 | 
	
		
			
				|  |  | -			Content: iv,
 | 
	
		
			
				|  |  | -		},
 | 
	
		
			
				|  |  | -		AdditionalDataGenerator: &NoOpBytesGenerator{},
 | 
	
		
			
				|  |  | -	}, cache)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	nBytes, err := writer.Write(payload)
 | 
	
		
			
				|  |  | -	assert.Error(err).IsNil()
 | 
	
		
			
				|  |  | -	assert.Int(nBytes).Equals(len(payload))
 | 
	
		
			
				|  |  | -	assert.Int(cache.Len()).GreaterThan(0)
 | 
	
		
			
				|  |  | -	_, err = writer.Write(payload)
 | 
	
		
			
				|  |  | -	assert.Error(err).IsNil()
 | 
	
		
			
				|  |  | -	assert.Int(nBytes).Equals(len(payload))
 | 
	
		
			
				|  |  | -	_, err = writer.Write([]byte{})
 | 
	
		
			
				|  |  | -	assert.Error(err).IsNil()
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	reader := NewAuthenticationReader(&AEADAuthenticator{
 | 
	
		
			
				|  |  | -		AEAD: aead,
 | 
	
		
			
				|  |  | -		NonceGenerator: &StaticBytesGenerator{
 | 
	
		
			
				|  |  | -			Content: iv,
 | 
	
		
			
				|  |  | -		},
 | 
	
		
			
				|  |  | -		AdditionalDataGenerator: &NoOpBytesGenerator{},
 | 
	
		
			
				|  |  | -	}, cache, true)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	actualPayload := make([]byte, 16*1024)
 | 
	
		
			
				|  |  | -	nBytes, err = reader.Read(actualPayload)
 | 
	
		
			
				|  |  | -	assert.Error(err).IsNil()
 | 
	
		
			
				|  |  | -	assert.Int(nBytes).Equals(len(payload) * 2)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	_, err = reader.Read(actualPayload)
 | 
	
		
			
				|  |  | -	assert.Error(err).Equals(io.EOF)
 | 
	
		
			
				|  |  | -}
 |