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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 BIO_free(bio); | 436 BIO_free(bio); |
437 FATAL() << "unreachable code"; | 437 FATAL() << "unreachable code"; |
438 } | 438 } |
439 char* data; | 439 char* data; |
440 size_t length = BIO_get_mem_data(bio, &data); | 440 size_t length = BIO_get_mem_data(bio, &data); |
441 der_buffer->SetData(data, length); | 441 der_buffer->SetData(data, length); |
442 BIO_free(bio); | 442 BIO_free(bio); |
443 } | 443 } |
444 | 444 |
445 void OpenSSLCertificate::AddReference() const { | 445 void OpenSSLCertificate::AddReference() const { |
446 ASSERT(x509_ != NULL); | 446 RTC_DCHECK(x509_ != NULL); |
447 #if defined(OPENSSL_IS_BORINGSSL) | 447 #if defined(OPENSSL_IS_BORINGSSL) |
448 X509_up_ref(x509_); | 448 X509_up_ref(x509_); |
449 #else | 449 #else |
450 CRYPTO_add(&x509_->references, 1, CRYPTO_LOCK_X509); | 450 CRYPTO_add(&x509_->references, 1, CRYPTO_LOCK_X509); |
451 #endif | 451 #endif |
452 } | 452 } |
453 | 453 |
454 bool OpenSSLCertificate::operator==(const OpenSSLCertificate& other) const { | 454 bool OpenSSLCertificate::operator==(const OpenSSLCertificate& other) const { |
455 return X509_cmp(this->x509_, other.x509_) == 0; | 455 return X509_cmp(this->x509_, other.x509_) == 0; |
456 } | 456 } |
(...skipping 14 matching lines...) Expand all Loading... |
471 } else { | 471 } else { |
472 return -1; | 472 return -1; |
473 } | 473 } |
474 | 474 |
475 return ASN1TimeToSec(expire_time->data, expire_time->length, long_format); | 475 return ASN1TimeToSec(expire_time->data, expire_time->length, long_format); |
476 } | 476 } |
477 | 477 |
478 OpenSSLIdentity::OpenSSLIdentity(OpenSSLKeyPair* key_pair, | 478 OpenSSLIdentity::OpenSSLIdentity(OpenSSLKeyPair* key_pair, |
479 OpenSSLCertificate* certificate) | 479 OpenSSLCertificate* certificate) |
480 : key_pair_(key_pair), certificate_(certificate) { | 480 : key_pair_(key_pair), certificate_(certificate) { |
481 ASSERT(key_pair != NULL); | 481 RTC_DCHECK(key_pair != NULL); |
482 ASSERT(certificate != NULL); | 482 RTC_DCHECK(certificate != NULL); |
483 } | 483 } |
484 | 484 |
485 OpenSSLIdentity::~OpenSSLIdentity() = default; | 485 OpenSSLIdentity::~OpenSSLIdentity() = default; |
486 | 486 |
487 OpenSSLIdentity* OpenSSLIdentity::GenerateInternal( | 487 OpenSSLIdentity* OpenSSLIdentity::GenerateInternal( |
488 const SSLIdentityParams& params) { | 488 const SSLIdentityParams& params) { |
489 OpenSSLKeyPair* key_pair = OpenSSLKeyPair::Generate(params.key_params); | 489 OpenSSLKeyPair* key_pair = OpenSSLKeyPair::Generate(params.key_params); |
490 if (key_pair) { | 490 if (key_pair) { |
491 OpenSSLCertificate* certificate = | 491 OpenSSLCertificate* certificate = |
492 OpenSSLCertificate::Generate(key_pair, params); | 492 OpenSSLCertificate::Generate(key_pair, params); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 *this->certificate_ == *other.certificate_; | 571 *this->certificate_ == *other.certificate_; |
572 } | 572 } |
573 | 573 |
574 bool OpenSSLIdentity::operator!=(const OpenSSLIdentity& other) const { | 574 bool OpenSSLIdentity::operator!=(const OpenSSLIdentity& other) const { |
575 return !(*this == other); | 575 return !(*this == other); |
576 } | 576 } |
577 | 577 |
578 } // namespace rtc | 578 } // namespace rtc |
579 | 579 |
580 #endif // HAVE_OPENSSL_SSL_H | 580 #endif // HAVE_OPENSSL_SSL_H |
OLD | NEW |