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

Unified Diff: runtime/bin/security_context_fuchsia.cc

Issue 2903743002: Porting SecureSocket to use BoringSSL on OSX (Closed)
Patch Set: Addressed nits, confirmed change works on Windows Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/security_context_android.cc ('k') | runtime/bin/security_context_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/security_context_fuchsia.cc
diff --git a/runtime/bin/security_context_fuchsia.cc b/runtime/bin/security_context_fuchsia.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c49476bd6c59ef02db551d8735a33c66c840ba67
--- /dev/null
+++ b/runtime/bin/security_context_fuchsia.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#if !defined(DART_IO_DISABLED) && !defined(DART_IO_SECURE_SOCKET_DISABLED)
+
+#include "platform/globals.h"
+#if defined(HOST_OS_FUCHSIA)
+
+#include "bin/security_context.h"
+
+#include <openssl/bio.h>
+#include <openssl/ssl.h>
+#include <openssl/x509.h>
+
+#include "bin/directory.h"
+#include "bin/file.h"
+#include "bin/log.h"
+#include "bin/secure_socket_filter.h"
+#include "bin/secure_socket_utils.h"
+
+namespace dart {
+namespace bin {
+
+// The security context won't necessarily use the compiled-in root certificates,
+// but since there is no way to update the size of the allocation after creating
+// the weak persistent handle, we assume that it will. Note that when the
+// root certs aren't compiled in, |root_certificates_pem_length| is 0.
+const intptr_t SSLCertContext::kApproximateSize =
+ sizeof(SSLCertContext) + root_certificates_pem_length;
+
+const char* commandline_root_certs_file = NULL;
+const char* commandline_root_certs_cache = NULL;
+
+void SSLCertContext::TrustBuiltinRoots() {
+ // First, try to use locations specified on the command line.
+ if (commandline_root_certs_file != NULL) {
+ LoadRootCertFile(commandline_root_certs_file);
+ return;
+ }
+
+ if (commandline_root_certs_cache != NULL) {
+ LoadRootCertCache(commandline_root_certs_cache);
+ return;
+ }
+
+ // Fall back on the compiled-in certs if the standard locations don't exist,
+ // or we aren't on Linux.
+ if (SSL_LOG_STATUS) {
+ Log::Print("Trusting compiled-in roots\n");
+ }
+ AddCompiledInCerts();
+}
+
+
+void SSLCertContext::RegisterCallbacks(SSL* ssl) {
+ // No callbacks to register for implementations using BoringSSL's built-in
+ // verification mechanism.
+}
+
+} // namespace bin
+} // namespace dart
+
+#endif // defined(HOST_OS_FUCHSIA)
+
+#endif // !defined(DART_IO_DISABLED) &&
+ // !defined(DART_IO_SECURE_SOCKET_DISABLED)
« no previous file with comments | « runtime/bin/security_context_android.cc ('k') | runtime/bin/security_context_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698