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

Side by Side Diff: webrtc/base/opensslidentity.cc

Issue 1808763002: Remove code interfacing legacy openssl. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Further simplifications with boringssl Created 4 years, 9 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
« no previous file with comments | « webrtc/base/openssladapter.cc ('k') | webrtc/base/opensslstreamadapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 OpenSSLKeyPair::~OpenSSLKeyPair() { 167 OpenSSLKeyPair::~OpenSSLKeyPair() {
168 EVP_PKEY_free(pkey_); 168 EVP_PKEY_free(pkey_);
169 } 169 }
170 170
171 OpenSSLKeyPair* OpenSSLKeyPair::GetReference() { 171 OpenSSLKeyPair* OpenSSLKeyPair::GetReference() {
172 AddReference(); 172 AddReference();
173 return new OpenSSLKeyPair(pkey_); 173 return new OpenSSLKeyPair(pkey_);
174 } 174 }
175 175
176 void OpenSSLKeyPair::AddReference() { 176 void OpenSSLKeyPair::AddReference() {
177 #if defined(OPENSSL_IS_BORINGSSL)
178 EVP_PKEY_up_ref(pkey_); 177 EVP_PKEY_up_ref(pkey_);
179 #else
180 CRYPTO_add(&pkey_->references, 1, CRYPTO_LOCK_EVP_PKEY);
181 #endif
182 } 178 }
183 179
184 #if !defined(NDEBUG) 180 #if !defined(NDEBUG)
185 // Print a certificate to the log, for debugging. 181 // Print a certificate to the log, for debugging.
186 static void PrintCert(X509* x509) { 182 static void PrintCert(X509* x509) {
187 BIO* temp_memory_bio = BIO_new(BIO_s_mem()); 183 BIO* temp_memory_bio = BIO_new(BIO_s_mem());
188 if (!temp_memory_bio) { 184 if (!temp_memory_bio) {
189 LOG_F(LS_ERROR) << "Failed to allocate temporary memory bio"; 185 LOG_F(LS_ERROR) << "Failed to allocate temporary memory bio";
190 return; 186 return;
191 } 187 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 FATAL() << "unreachable code"; 350 FATAL() << "unreachable code";
355 } 351 }
356 char* data; 352 char* data;
357 size_t length = BIO_get_mem_data(bio, &data); 353 size_t length = BIO_get_mem_data(bio, &data);
358 der_buffer->SetData(data, length); 354 der_buffer->SetData(data, length);
359 BIO_free(bio); 355 BIO_free(bio);
360 } 356 }
361 357
362 void OpenSSLCertificate::AddReference() const { 358 void OpenSSLCertificate::AddReference() const {
363 ASSERT(x509_ != NULL); 359 ASSERT(x509_ != NULL);
364 #if defined(OPENSSL_IS_BORINGSSL)
365 X509_up_ref(x509_); 360 X509_up_ref(x509_);
366 #else
367 CRYPTO_add(&x509_->references, 1, CRYPTO_LOCK_X509);
368 #endif
369 } 361 }
370 362
371 // Documented in sslidentity.h. 363 // Documented in sslidentity.h.
372 int64_t OpenSSLCertificate::CertificateExpirationTime() const { 364 int64_t OpenSSLCertificate::CertificateExpirationTime() const {
373 ASN1_TIME* expire_time = X509_get_notAfter(x509_); 365 ASN1_TIME* expire_time = X509_get_notAfter(x509_);
374 bool long_format; 366 bool long_format;
375 367
376 if (expire_time->type == V_ASN1_UTCTIME) { 368 if (expire_time->type == V_ASN1_UTCTIME) {
377 long_format = false; 369 long_format = false;
378 } else if (expire_time->type == V_ASN1_GENERALIZEDTIME) { 370 } else if (expire_time->type == V_ASN1_GENERALIZEDTIME) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 SSL_CTX_use_PrivateKey(ctx, key_pair_->pkey()) != 1) { 461 SSL_CTX_use_PrivateKey(ctx, key_pair_->pkey()) != 1) {
470 LogSSLErrors("Configuring key and certificate"); 462 LogSSLErrors("Configuring key and certificate");
471 return false; 463 return false;
472 } 464 }
473 return true; 465 return true;
474 } 466 }
475 467
476 } // namespace rtc 468 } // namespace rtc
477 469
478 #endif // HAVE_OPENSSL_SSL_H 470 #endif // HAVE_OPENSSL_SSL_H
OLDNEW
« no previous file with comments | « webrtc/base/openssladapter.cc ('k') | webrtc/base/opensslstreamadapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698