| Index: net/base/test_root_certs_android.cc
|
| diff --git a/net/base/test_root_certs_openssl.cc b/net/base/test_root_certs_android.cc
|
| similarity index 55%
|
| copy from net/base/test_root_certs_openssl.cc
|
| copy to net/base/test_root_certs_android.cc
|
| index e01d5c95dadc9f5e6879158c060ad346e83e41ac..5ad185f3784ff5b31910289aaa4e255e72cf70d0 100644
|
| --- a/net/base/test_root_certs_openssl.cc
|
| +++ b/net/base/test_root_certs_android.cc
|
| @@ -4,29 +4,20 @@
|
|
|
| #include "net/base/test_root_certs.h"
|
|
|
| -#include <openssl/err.h>
|
| -#include <openssl/x509v3.h>
|
| -
|
| #include "base/location.h"
|
| #include "base/logging.h"
|
| -#include "crypto/openssl_util.h"
|
| +#include "net/android/network_library.h"
|
| #include "net/base/x509_certificate.h"
|
|
|
| namespace net {
|
|
|
| bool TestRootCerts::Add(X509Certificate* certificate) {
|
| - if (!X509_STORE_add_cert(X509Certificate::cert_store(),
|
| - certificate->os_cert_handle())) {
|
| - unsigned long error_code = ERR_peek_error();
|
| - if (ERR_GET_LIB(error_code) != ERR_LIB_X509 ||
|
| - ERR_GET_REASON(error_code) != X509_R_CERT_ALREADY_IN_HASH_TABLE) {
|
| - crypto::ClearOpenSSLERRStack(FROM_HERE);
|
| + std::string cert_bytes;
|
| + if (!X509Certificate::GetDEREncoded(certificate->os_cert_handle(),
|
| + &cert_bytes))
|
| return false;
|
| - }
|
| - ERR_clear_error();
|
| - }
|
| -
|
| - empty_ = false;
|
| + android::AddTestRootCertificate(
|
| + reinterpret_cast<const uint8*>(cert_bytes.data()), cert_bytes.size());
|
| return true;
|
| }
|
|
|
| @@ -34,7 +25,7 @@ void TestRootCerts::Clear() {
|
| if (empty_)
|
| return;
|
|
|
| - X509Certificate::ResetCertStore();
|
| + android::ClearTestRootCertificates();
|
| empty_ = true;
|
| }
|
|
|
|
|