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

Side by Side Diff: extensions/browser/api/cast_channel/logger.cc

Issue 687733004: Implement crypto signature verification routines using OpenSSL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Misc. fixes Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/logger.h" 5 #include "extensions/browser/api/cast_channel/logger.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/time/tick_clock.h" 10 #include "base/time/tick_clock.h"
(...skipping 28 matching lines...) Expand all
39 case AuthResult::ERROR_NO_PAYLOAD: 39 case AuthResult::ERROR_NO_PAYLOAD:
40 return proto::CHALLENGE_REPLY_ERROR_NO_PAYLOAD; 40 return proto::CHALLENGE_REPLY_ERROR_NO_PAYLOAD;
41 case AuthResult::ERROR_PAYLOAD_PARSING_FAILED: 41 case AuthResult::ERROR_PAYLOAD_PARSING_FAILED:
42 return proto::CHALLENGE_REPLY_ERROR_PAYLOAD_PARSING_FAILED; 42 return proto::CHALLENGE_REPLY_ERROR_PAYLOAD_PARSING_FAILED;
43 case AuthResult::ERROR_MESSAGE_ERROR: 43 case AuthResult::ERROR_MESSAGE_ERROR:
44 return proto::CHALLENGE_REPLY_ERROR_MESSAGE_ERROR; 44 return proto::CHALLENGE_REPLY_ERROR_MESSAGE_ERROR;
45 case AuthResult::ERROR_NO_RESPONSE: 45 case AuthResult::ERROR_NO_RESPONSE:
46 return proto::CHALLENGE_REPLY_ERROR_NO_RESPONSE; 46 return proto::CHALLENGE_REPLY_ERROR_NO_RESPONSE;
47 case AuthResult::ERROR_FINGERPRINT_NOT_FOUND: 47 case AuthResult::ERROR_FINGERPRINT_NOT_FOUND:
48 return proto::CHALLENGE_REPLY_ERROR_FINGERPRINT_NOT_FOUND; 48 return proto::CHALLENGE_REPLY_ERROR_FINGERPRINT_NOT_FOUND;
49 case AuthResult::ERROR_NSS_CERT_PARSING_FAILED: 49 case AuthResult::ERROR_CERT_PARSING_FAILED:
50 return proto::CHALLENGE_REPLY_ERROR_NSS_CERT_PARSING_FAILED; 50 return proto::CHALLENGE_REPLY_ERROR_CERT_PARSING_FAILED;
51 case AuthResult::ERROR_NSS_CERT_NOT_SIGNED_BY_TRUSTED_CA: 51 case AuthResult::ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA:
52 return proto::CHALLENGE_REPLY_ERROR_NSS_CERT_NOT_SIGNED_BY_TRUSTED_CA; 52 return proto::CHALLENGE_REPLY_ERROR_CERT_NOT_SIGNED_BY_TRUSTED_CA;
53 case AuthResult::ERROR_NSS_CANNOT_EXTRACT_PUBLIC_KEY: 53 case AuthResult::ERROR_CANNOT_EXTRACT_PUBLIC_KEY:
54 return proto::CHALLENGE_REPLY_ERROR_NSS_CANNOT_EXTRACT_PUBLIC_KEY; 54 return proto::CHALLENGE_REPLY_ERROR_CANNOT_EXTRACT_PUBLIC_KEY;
55 case AuthResult::ERROR_NSS_SIGNED_BLOBS_MISMATCH: 55 case AuthResult::ERROR_SIGNED_BLOBS_MISMATCH:
56 return proto::CHALLENGE_REPLY_ERROR_NSS_SIGNED_BLOBS_MISMATCH; 56 return proto::CHALLENGE_REPLY_ERROR_SIGNED_BLOBS_MISMATCH;
57 default: 57 default:
58 NOTREACHED(); 58 NOTREACHED();
59 return proto::CHALLENGE_REPLY_ERROR_NONE; 59 return proto::CHALLENGE_REPLY_ERROR_NONE;
60 } 60 }
61 } 61 }
62 62
63 scoped_ptr<char[]> Compress(const std::string& input, size_t* length) { 63 scoped_ptr<char[]> Compress(const std::string& input, size_t* length) {
64 *length = 0; 64 *length = 0;
65 z_stream stream = {0}; 65 z_stream stream = {0};
66 int result = deflateInit2(&stream, 66 int result = deflateInit2(&stream,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 LogSocketEvent(channel_id, event); 257 LogSocketEvent(channel_id, event);
258 } 258 }
259 259
260 void Logger::LogSocketChallengeReplyEvent(int channel_id, 260 void Logger::LogSocketChallengeReplyEvent(int channel_id,
261 const AuthResult& auth_result) { 261 const AuthResult& auth_result) {
262 DCHECK(thread_checker_.CalledOnValidThread()); 262 DCHECK(thread_checker_.CalledOnValidThread());
263 263
264 SocketEvent event = CreateEvent(proto::AUTH_CHALLENGE_REPLY); 264 SocketEvent event = CreateEvent(proto::AUTH_CHALLENGE_REPLY);
265 event.set_challenge_reply_error_type( 265 event.set_challenge_reply_error_type(
266 ChallegeReplyErrorToProto(auth_result.error_type)); 266 ChallegeReplyErrorToProto(auth_result.error_type));
267 if (auth_result.nss_error_code != 0) 267 if (auth_result.nss_error_code != 0) {
268 event.set_nss_error_code(auth_result.nss_error_code); 268 event.set_nss_error_code(auth_result.nss_error_code);
269 }
270 if (!auth_result.openssl_errors.empty()) {
271 for (const auto & next_error : auth_result.openssl_errors) {
272 proto::OpenSSLError* new_error = event.add_openssl_error();
273 new_error->set_filename(next_error.first);
274 new_error->set_line(next_error.second);
275 }
276 }
269 277
270 LogSocketEvent(channel_id, event); 278 LogSocketEvent(channel_id, event);
271 } 279 }
272 280
273 SocketEvent Logger::CreateEvent(EventType event_type) { 281 SocketEvent Logger::CreateEvent(EventType event_type) {
274 SocketEvent event; 282 SocketEvent event;
275 event.set_type(event_type); 283 event.set_type(event_type);
276 event.set_timestamp_micros(clock_->NowTicks().ToInternalValue() - 284 event.set_timestamp_micros(clock_->NowTicks().ToInternalValue() -
277 unix_epoch_time_ticks_.ToInternalValue()); 285 unix_epoch_time_ticks_.ToInternalValue());
278 return event; 286 return event;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 if (it != aggregated_socket_events_.end()) { 370 if (it != aggregated_socket_events_.end()) {
363 return it->second->last_errors; 371 return it->second->last_errors;
364 } else { 372 } else {
365 return LastErrors(); 373 return LastErrors();
366 } 374 }
367 } 375 }
368 376
369 } // namespace cast_channel 377 } // namespace cast_channel
370 } // namespace core_api 378 } // namespace core_api
371 } // namespace extensions 379 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698