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

Side by Side Diff: net/cert/x509_util_openssl.cc

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 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 | « net/cert/x509_util_nss_certs.cc ('k') | net/cookies/cookie_util.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/cert/x509_util_openssl.h" 5 #include "net/cert/x509_util_openssl.h"
6 6
7 #include <openssl/asn1.h> 7 #include <openssl/asn1.h>
8 #include <openssl/mem.h> 8 #include <openssl/mem.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return cert.release(); 129 return cert.release();
130 } 130 }
131 131
132 // DER-encodes |x509|. On success, returns true and writes the 132 // DER-encodes |x509|. On success, returns true and writes the
133 // encoding to |*out_der|. 133 // encoding to |*out_der|.
134 bool DerEncodeCert(X509* x509, std::string* out_der) { 134 bool DerEncodeCert(X509* x509, std::string* out_der) {
135 int len = i2d_X509(x509, NULL); 135 int len = i2d_X509(x509, NULL);
136 if (len < 0) 136 if (len < 0)
137 return false; 137 return false;
138 138
139 uint8_t* ptr = reinterpret_cast<uint8_t*>(WriteInto(out_der, len + 1)); 139 uint8_t* ptr = reinterpret_cast<uint8_t*>(base::WriteInto(out_der, len + 1));
140 if (i2d_X509(x509, &ptr) < 0) { 140 if (i2d_X509(x509, &ptr) < 0) {
141 NOTREACHED(); 141 NOTREACHED();
142 out_der->clear(); 142 out_der->clear();
143 return false; 143 return false;
144 } 144 }
145 return true; 145 return true;
146 } 146 }
147 147
148 bool SignAndDerEncodeCert(X509* cert, 148 bool SignAndDerEncodeCert(X509* cert,
149 EVP_PKEY* key, 149 EVP_PKEY* key,
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 internal_cache = new_cache.get(); 414 internal_cache = new_cache.get();
415 X509_set_ex_data(x509, x509_der_cache_index, new_cache.release()); 415 X509_set_ex_data(x509, x509_der_cache_index, new_cache.release());
416 } 416 }
417 *der_cache = base::StringPiece(internal_cache->data); 417 *der_cache = base::StringPiece(internal_cache->data);
418 return true; 418 return true;
419 } 419 }
420 420
421 } // namespace x509_util 421 } // namespace x509_util
422 422
423 } // namespace net 423 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_util_nss_certs.cc ('k') | net/cookies/cookie_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698