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:

This attempts to fix the flakes we've been seeing with (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-by: David Benjamin <>
Commit-Queue: Pavol Marko <>
Cr-Original-Commit-Position: refs/heads/master@{#698053}
Cr-Mirrored-Commit: f07ce70196dfb8a4000f76eed5f3e28492aadfdd
3 files changed