Fix and add more tests and add GCM test support.

GCM test support largely based on upstream commit 15652f9.