Fix initialization races in X509CertImpl DO NOT MERGE

X509CertImpl instances can be shared between threads without a caller
knowing due to the CERT_CACHE in X509CertFactoryImpl. In some cases,
initialization of pairs of fields such as notBefore/notAfter and
sigAlgOID/sigAlgName were protected by checking if only was one of the
two values were initialized. This could lead to one thread half
initializing a pair and a second thread seeing the half initialized
pair, would assume both halves were initialized, returning an
uninitialized value. Even in the lazy initialization of single fields
there was no use of volatile or synchonized to be properly safe.

git cherry-pick -e ef6370c1b62edf75dc7c3e5411468b55627e037d
http://code.google.com/p/android/issues/detail?id=11870
Bug: 2295023

Change-Id: I82ff6e2742b3562e06fe3988dff1071b8ef5e82b
1 file changed