OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 if (!OpenSSLCertificate::ComputeDigest( | 1083 if (!OpenSSLCertificate::ComputeDigest( |
1084 peer_certificate_->x509(), peer_certificate_digest_algorithm_, digest, | 1084 peer_certificate_->x509(), peer_certificate_digest_algorithm_, digest, |
1085 sizeof(digest), &digest_length)) { | 1085 sizeof(digest), &digest_length)) { |
1086 LOG(LS_WARNING) << "Failed to compute peer cert digest."; | 1086 LOG(LS_WARNING) << "Failed to compute peer cert digest."; |
1087 return false; | 1087 return false; |
1088 } | 1088 } |
1089 | 1089 |
1090 Buffer computed_digest(digest, digest_length); | 1090 Buffer computed_digest(digest, digest_length); |
1091 if (computed_digest != peer_certificate_digest_value_) { | 1091 if (computed_digest != peer_certificate_digest_value_) { |
1092 LOG(LS_WARNING) << "Rejected peer certificate due to mismatched digest."; | 1092 LOG(LS_WARNING) << "Rejected peer certificate due to mismatched digest."; |
1093 return 0; | 1093 return false; |
1094 } | 1094 } |
1095 // Ignore any verification error if the digest matches, since there is no | 1095 // Ignore any verification error if the digest matches, since there is no |
1096 // value in checking the validity of a self-signed cert issued by untrusted | 1096 // value in checking the validity of a self-signed cert issued by untrusted |
1097 // sources. | 1097 // sources. |
1098 LOG(LS_INFO) << "Accepted peer certificate."; | 1098 LOG(LS_INFO) << "Accepted peer certificate."; |
1099 peer_certificate_verified_ = true; | 1099 peer_certificate_verified_ = true; |
1100 return true; | 1100 return true; |
1101 } | 1101 } |
1102 | 1102 |
1103 int OpenSSLStreamAdapter::SSLVerifyCallback(int ok, X509_STORE_CTX* store) { | 1103 int OpenSSLStreamAdapter::SSLVerifyCallback(int ok, X509_STORE_CTX* store) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 } | 1210 } |
1211 | 1211 |
1212 return false; | 1212 return false; |
1213 } | 1213 } |
1214 | 1214 |
1215 void OpenSSLStreamAdapter::enable_time_callback_for_testing() { | 1215 void OpenSSLStreamAdapter::enable_time_callback_for_testing() { |
1216 g_use_time_callback_for_testing = true; | 1216 g_use_time_callback_for_testing = true; |
1217 } | 1217 } |
1218 | 1218 |
1219 } // namespace rtc | 1219 } // namespace rtc |
OLD | NEW |