Merge pull request #1330 from reaperhulk/fix-commoncrypto-gcm

Fix two bugs with CommonCrypto GCM that can result in invalid output.