crypto-native: refactor GCM code to use generic types