tlslite: Make Pyton_RSAKey thread-safe

Make Python_RSAKey thread-safe by handling the blinder/unblinder class
variables only when holding a lock.

The implementation has been taken from tlslite-ng, original commit:
https://github.com/tomato42/tlslite-ng/commit/d1c2bc7d4e5aff924d40d925f1df203b9799c30f

This attempts to fix the flakes we've been seeing with
https_forwarder.py (which ends up using a multi-threaded HTTPServer with
Python_RSAKey indeed) in my local testing.

Bug: 1005082
Test: browser tests still pass, local stress test using CL:1811018
Change-Id: Ibf7fa311da9fea20ef77f6b2ce05593d95e1ebb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814117
Reviewed-by: David Benjamin <davidben@chromium.org>
Commit-Queue: Pavol Marko <pmarko@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#698053}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: f07ce70196dfb8a4000f76eed5f3e28492aadfdd
3 files changed