Port GMac implementation and tests from bc-java.

GMac implementation with tests from bc-java.