| 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: |
| 34 case net::ct::SCT_STATUS_INVALID_SIGNATURE: | 37 case net::ct::SCT_STATUS_INVALID_SIGNATURE: |
| 35 case net::ct::SCT_STATUS_OK: | 38 case net::ct::SCT_STATUS_OK: |
| 36 case net::ct::SCT_STATUS_INVALID_TIMESTAMP: | 39 case net::ct::SCT_STATUS_INVALID_TIMESTAMP: |
| 37 return true; | 40 return true; |
| 38 case net::ct::SCT_STATUS_NONE: | 41 case net::ct::SCT_STATUS_NONE: |
| 39 // SCT_STATUS_NONE should never happen, so it isn't valid to | 42 // SCT_STATUS_NONE should never happen, so it isn't valid to |
| 40 // receive a status of NONE in a serialized SSLStatus. | 43 // receive a status of NONE in a serialized SSLStatus. |
| 41 return false; | 44 return false; |
| 42 } | 45 } |
| 43 return false; | 46 return false; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // Sanity check |key_exchange_info|: 0 or greater. | 122 // Sanity check |key_exchange_info|: 0 or greater. |
| 120 if (ssl_status->key_exchange_info < 0) { | 123 if (ssl_status->key_exchange_info < 0) { |
| 121 *ssl_status = SSLStatus(); | 124 *ssl_status = SSLStatus(); |
| 122 return false; | 125 return false; |
| 123 } | 126 } |
| 124 | 127 |
| 125 return true; | 128 return true; |
| 126 } | 129 } |
| 127 | 130 |
| 128 } // namespace content | 131 } // namespace content |
| OLD | NEW |