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 "content/common/ssl_status_serialization.h" | 5 #include "content/common/ssl_status_serialization.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 return true; | 24 return true; |
25 } | 25 } |
26 return false; | 26 return false; |
27 } | 27 } |
28 | 28 |
29 // Checks that an integer |sct_status| is a valid net::ct::SCTVerifyStatus enum | 29 // Checks that an integer |sct_status| is a valid net::ct::SCTVerifyStatus enum |
30 // value. Returns true if valid, false otherwise. | 30 // value. Returns true if valid, false otherwise. |
31 bool CheckSCTStatus(uint32_t sct_status) { | 31 bool CheckSCTStatus(uint32_t sct_status) { |
32 switch (sct_status) { | 32 switch (sct_status) { |
33 case net::ct::SCT_STATUS_LOG_UNKNOWN: | 33 case net::ct::SCT_STATUS_LOG_UNKNOWN: |
34 // INVALID is deprecated and should not be used anymore, but it | |
35 // might have been previously written into the disk cache. | |
36 case net::ct::SCT_STATUS_INVALID: | |
37 case net::ct::SCT_STATUS_INVALID_SIGNATURE: | 34 case net::ct::SCT_STATUS_INVALID_SIGNATURE: |
38 case net::ct::SCT_STATUS_OK: | 35 case net::ct::SCT_STATUS_OK: |
39 case net::ct::SCT_STATUS_INVALID_TIMESTAMP: | 36 case net::ct::SCT_STATUS_INVALID_TIMESTAMP: |
40 return true; | 37 return true; |
41 case net::ct::SCT_STATUS_NONE: | 38 case net::ct::SCT_STATUS_NONE: |
42 // SCT_STATUS_NONE should never happen, so it isn't valid to | 39 // SCT_STATUS_NONE should never happen, so it isn't valid to |
43 // receive a status of NONE in a serialized SSLStatus. | 40 // receive a status of NONE in a serialized SSLStatus. |
44 return false; | 41 return false; |
42 case 2: | |
estark
2016/08/31 22:03:33
Is this necessary? Can we just fall through to lin
Ryan Sleevi
2016/09/01 00:01:29
+1
Eran Messeri
2016/09/01 14:16:34
Done.
| |
43 // Was SCT_STATUS_INVALID, which was removed. | |
44 return false; | |
45 } | 45 } |
46 return false; | 46 return false; |
47 } | 47 } |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 namespace content { | 51 namespace content { |
52 | 52 |
53 std::string SerializeSecurityInfo(const SSLStatus& ssl_status) { | 53 std::string SerializeSecurityInfo(const SSLStatus& ssl_status) { |
54 base::Pickle pickle; | 54 base::Pickle pickle; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 // Sanity check |key_exchange_info|: 0 or greater. | 122 // Sanity check |key_exchange_info|: 0 or greater. |
123 if (ssl_status->key_exchange_info < 0) { | 123 if (ssl_status->key_exchange_info < 0) { |
124 *ssl_status = SSLStatus(); | 124 *ssl_status = SSLStatus(); |
125 return false; | 125 return false; |
126 } | 126 } |
127 | 127 |
128 return true; | 128 return true; |
129 } | 129 } |
130 | 130 |
131 } // namespace content | 131 } // namespace content |
OLD | NEW |