finalize gcm implementation