[core] Security: proper validation of IRC server certificatee

I noticed this issue few weeks ago when I was writing elad661/ssl_cert_info.
Basically, the way I originally implemented certificate verification was shit.

It was shit because of few major reasons:
 1) It did not verify wildcard according to the RFC, and it ignored DNS fields
in the certificate
 2) It opened a connection to fetch and verify the cert CN, and only then
it opened the actual connection. A clever MITM attack could have bypassed
this easily, if it got the timing right.
 3) It was slow.

Due to the recently introduced dependecy on backports.ssl_match_hostname,
fixing this was easy.

This commit also removed the useless code we had in place to do the handshake
manually, and let Python do the work for us. This simplifies SSL handling code
in the core.

I also removed verify_ssl_cn() from tools, I hope nobody was using it because
that implementation was extremely wrong.