TLS 1.2 support, backported from Opera Software fork

Backported from https://github.com/operasoftware/tlslite . The changes included here were done in 2009. All notes from the original author indicate that his work is in compliance with original tlslite license of that time, i.e. public domain. Note that repository above contains more changes. I backported only TLS 1.2 support, as introduced in https://github.com/operasoftware/tlslite/commit/823878dc7405c069fa718f7e7b4ee2e79732db14 (some of the changes done in that revision are superceded by changes done later in tlslite upstream).