hack: restrict AES keySize to 16

* original security partaker was 16 so it didn’t matter. But it’s 20
now, so this is a quick hack/fix. In future should intelligently “round
down”
This commit is contained in:
Olaoluwa Osuntokun
2015-10-22 13:22:04 -07:00
parent 2e89e5a4be
commit 15fd3085dd

View File

@@ -314,7 +314,8 @@ func generateKey(keyType string, sharedKey [sharedSecretSize]byte) [securityPara
// generateHeaderPadding...
// TODO(roasbeef): comments...
func generateCipherStream(key [securityParameter]byte, numBytes uint) []byte {
block, _ := aes.NewCipher(key[:])
// Key must be 16, 24, or 32 bytes.
block, _ := aes.NewCipher(key[:16])
// We use AES in CTR mode to generate a psuedo randmom stream of bytes
// by encrypting a plaintext of all zeroes.