UniqueMutex for explicit ordering with ScopedSslBio

The MUTEX_LOCK / MUTEX_UNLOCK semantics work if you also explicitly
clear out resources that were supposed to be cleared before the lock is
released. However, with wrapper classes that do it automatically, you
can't get the correct ordering. Instead of converting these all to
manual acquire and release, convert the mutex handling to use automatic
release via UniqueMutex so that ordering is correct with resources that
should be protected by the mutex.

Thanks to Zhen Song for finding these issues.

Bug: 28473706
Change-Id: I4b63ce674e0fc343fe156936df7e8f6e3130722f
1 file changed