module Net::SSH::Transport::GCMCipher

def update_cipher_mac(payload, _sequence_number)

def update_cipher_mac(payload, _sequence_number)
  #
  # --- RFC 5647 7.3 ---
  # When using AES-GCM with secure shell, the packet_length field is to
  # be treated as additional authenticated data, not as plaintext.
  #
  length_data      = [payload.bytesize].pack('N')
  cipher.auth_data = length_data
  encrypted_data   = cipher.update(payload) << cipher.final
  mac              = cipher.auth_tag
  incr_nonce
  length_data + encrypted_data + mac
end