'Called when we receive a MSG_KEX_DH_GEX_REQUEST message.  Payload::
integer minimum
integer ideal
integer maximum
The client is asking for a Diffie-Hellman group between minimum and
maximum size, and close to ideal if possible.  We reply with a
MSG_KEX_DH_GEX_GROUP message.
If we were told to ignore the next key exchange packet by ssh_KEXINIT,
drop it on the floor and return.
@type packet: L{bytes}
@param packet: The message data.'

def ssh_KEX_DH_GEX_REQUEST(self, packet):

    if self.ignoreNextPacket:
        self.ignoreNextPacket = 0
        return
    self.dhGexRequest = packet
    (min, ideal, max) = struct.unpack('>3L', packet)
    (self.g, self.p) = self.factory.getDHPrime(ideal)
    self.sendPacket(MSG_KEX_DH_GEX_GROUP, (MP(self.p) + MP(self.g)))
