Changed the way we calculate the message size of the handshake, such that strlen is used as few times as possible