Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: net/base/cert_verify_proc_openssl.cc

Issue 10171009: Update net/android/network_library.cc with fresher code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added comments, fixed caller Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/cert_verify_proc_openssl.h" 5 #include "net/base/cert_verify_proc_openssl.h"
6 6
7 #include <openssl/x509v3.h> 7 #include <openssl/x509v3.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 hashes->push_back(hash); 152 hashes->push_back(hash);
153 } 153 }
154 } 154 }
155 155
156 #if defined(OS_ANDROID) 156 #if defined(OS_ANDROID)
157 // Returns true if we have verification result in |verify_result| from Android 157 // Returns true if we have verification result in |verify_result| from Android
158 // Trust Manager. Otherwise returns false. 158 // Trust Manager. Otherwise returns false.
159 bool VerifyFromAndroidTrustManager(const std::vector<std::string>& cert_bytes, 159 bool VerifyFromAndroidTrustManager(const std::vector<std::string>& cert_bytes,
160 CertVerifyResult* verify_result) { 160 CertVerifyResult* verify_result) {
161 // TODO(joth): Fetch the authentication type from SSL rather than hardcode. 161 // TODO(joth): Fetch the authentication type from SSL rather than hardcode.
162 // TODO(jnd): Remove unused |hostname| from net::android::VerifyX509CertChain.
163 bool verified = true; 162 bool verified = true;
164 #if 0
165 android::VerifyResult result = 163 android::VerifyResult result =
166 android::VerifyX509CertChain(cert_bytes, hostname, "RSA"); 164 android::VerifyX509CertChain(cert_bytes, "RSA");
167 #else
168 // TODO(jingzhao): Recover the original implementation once we support JNI.
169 android::VerifyResult result = android::VERIFY_INVOCATION_ERROR;
170 NOTIMPLEMENTED();
171 #endif
172 switch (result) { 165 switch (result) {
173 case android::VERIFY_OK: 166 case android::VERIFY_OK:
174 break; 167 break;
175 case android::VERIFY_BAD_HOSTNAME:
176 verify_result->cert_status |= CERT_STATUS_COMMON_NAME_INVALID;
177 break;
178 case android::VERIFY_NO_TRUSTED_ROOT: 168 case android::VERIFY_NO_TRUSTED_ROOT:
179 verify_result->cert_status |= CERT_STATUS_AUTHORITY_INVALID; 169 verify_result->cert_status |= CERT_STATUS_AUTHORITY_INVALID;
180 break; 170 break;
181 case android::VERIFY_INVOCATION_ERROR: 171 case android::VERIFY_INVOCATION_ERROR:
182 verified = false; 172 verified = false;
183 break; 173 break;
184 default: 174 default:
185 verify_result->cert_status |= CERT_STATUS_INVALID; 175 verify_result->cert_status |= CERT_STATUS_INVALID;
186 break; 176 break;
187 } 177 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // TODO(joth): if the motivations described in 269 // TODO(joth): if the motivations described in
280 // http://src.chromium.org/viewvc/chrome?view=rev&revision=80778 become an 270 // http://src.chromium.org/viewvc/chrome?view=rev&revision=80778 become an
281 // issue on OpenSSL builds, we will need to embed a hardcoded list of well 271 // issue on OpenSSL builds, we will need to embed a hardcoded list of well
282 // known root CAs, as per the _mac and _win versions. 272 // known root CAs, as per the _mac and _win versions.
283 verify_result->is_issued_by_known_root = true; 273 verify_result->is_issued_by_known_root = true;
284 274
285 return OK; 275 return OK;
286 } 276 }
287 277
288 } // namespace net 278 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698