OLD | NEW |
---|---|
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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/format_macros.h" | 6 #include "base/format_macros.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "crypto/sha2.h" | 14 #include "crypto/sha2.h" |
15 #include "net/cert/crl_set.h" | 15 #include "net/cert/crl_set.h" |
16 #include "third_party/zlib/zlib.h" | 16 #include "third_party/zlib/zlib.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 // Decompress zlib decompressed |in| into |out|. |out_len| is the number of | 20 // Decompress zlib decompressed |in| into |out|. |out_len| is the number of |
21 // bytes at |out| and must be exactly equal to the size of the decompressed | 21 // bytes at |out| and must be exactly equal to the size of the decompressed |
22 // data. | 22 // data. |
23 static bool DecompressZlib(uint8* out, int out_len, base::StringPiece in) { | 23 static bool DecompressZlib(uint8* out, int out_len, base::StringPiece in) { |
24 #if defined(OS_NACL) | |
25 NOTIMPLEMENTED(); | |
26 return false; | |
27 #else // defined(OS_NACL) | |
24 z_stream z; | 28 z_stream z; |
25 memset(&z, 0, sizeof(z)); | 29 memset(&z, 0, sizeof(z)); |
26 | 30 |
27 z.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(in.data())); | 31 z.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(in.data())); |
28 z.avail_in = in.size(); | 32 z.avail_in = in.size(); |
29 z.next_out = reinterpret_cast<Bytef*>(out); | 33 z.next_out = reinterpret_cast<Bytef*>(out); |
30 z.avail_out = out_len; | 34 z.avail_out = out_len; |
31 | 35 |
32 if (inflateInit(&z) != Z_OK) | 36 if (inflateInit(&z) != Z_OK) |
33 return false; | 37 return false; |
34 bool ret = false; | 38 bool ret = false; |
35 int r = inflate(&z, Z_FINISH); | 39 int r = inflate(&z, Z_FINISH); |
36 if (r != Z_STREAM_END) | 40 if (r != Z_STREAM_END) |
37 goto err; | 41 goto err; |
38 if (z.avail_in || z.avail_out) | 42 if (z.avail_in || z.avail_out) |
39 goto err; | 43 goto err; |
40 ret = true; | 44 ret = true; |
41 | 45 |
42 err: | 46 err: |
43 inflateEnd(&z); | 47 inflateEnd(&z); |
44 return ret; | 48 return ret; |
49 #endif // !defined(OS_NACL) | |
Ryan Sleevi
2014/03/06 22:02:17
This approach is really ugly here. CRLSets won't w
Sergey Ulanov
2014/03/07 00:19:47
SSLClientSocket depends on CertVerifier and CertVe
| |
45 } | 50 } |
46 | 51 |
47 CRLSet::CRLSet() | 52 CRLSet::CRLSet() |
48 : sequence_(0), | 53 : sequence_(0), |
49 not_after_(0) { | 54 not_after_(0) { |
50 } | 55 } |
51 | 56 |
52 CRLSet::~CRLSet() { | 57 CRLSet::~CRLSet() { |
53 } | 58 } |
54 | 59 |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 crl_set->crls_index_by_issuer_[spki] = 0; | 607 crl_set->crls_index_by_issuer_[spki] = 0; |
603 } | 608 } |
604 | 609 |
605 if (!serial_number.empty()) | 610 if (!serial_number.empty()) |
606 crl_set->crls_[0].second.push_back(serial_number); | 611 crl_set->crls_[0].second.push_back(serial_number); |
607 | 612 |
608 return crl_set; | 613 return crl_set; |
609 } | 614 } |
610 | 615 |
611 } // namespace net | 616 } // namespace net |
OLD | NEW |