split out code that is needed only when tls or dtls is used