Cherry-pick some ssl improvements from Iaae2632

Change-Id: I7fe85f8a3e5ff89c3132858ba759ce37f8c8990f
Merge "Cherry-pick some ssl improvements from Iaae2632"