Chromium Code Reviews| 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 case net::ct::SCT_STATUS_INVALID: | 34 case net::ct::SCT_STATUS_INVALID_SIGNATURE: |
| 35 case net::ct::SCT_STATUS_OK: | 35 case net::ct::SCT_STATUS_OK: |
| 36 case net::ct::SCT_STATUS_INVALID_TIMESTAMP: | |
| 36 case net::ct::SCT_STATUS_MAX: | 37 case net::ct::SCT_STATUS_MAX: |
|
eroman
2016/08/15 19:20:22
Why is MAX considered valid?
From the definition:
Eran Messeri
2016/08/16 14:17:18
(1) MAX shouldn't be considered valid - I've moved
| |
| 37 return true; | 38 return true; |
| 38 case net::ct::SCT_STATUS_NONE: | 39 case net::ct::SCT_STATUS_NONE: |
| 39 // SCT_STATUS_NONE should never happen, so it isn't valid to | 40 // SCT_STATUS_NONE should never happen, so it isn't valid to |
| 40 // receive a status of NONE in a serialized SSLStatus. | 41 // receive a status of NONE in a serialized SSLStatus. |
| 41 return false; | 42 return false; |
| 42 } | 43 } |
| 43 return false; | 44 return false; |
| 44 } | 45 } |
| 45 | 46 |
| 46 } // namespace | 47 } // namespace |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 // Sanity check |key_exchange_info|: 0 or greater. | 120 // Sanity check |key_exchange_info|: 0 or greater. |
| 120 if (ssl_status->key_exchange_info < 0) { | 121 if (ssl_status->key_exchange_info < 0) { |
| 121 *ssl_status = SSLStatus(); | 122 *ssl_status = SSLStatus(); |
| 122 return false; | 123 return false; |
| 123 } | 124 } |
| 124 | 125 |
| 125 return true; | 126 return true; |
| 126 } | 127 } |
| 127 | 128 |
| 128 } // namespace content | 129 } // namespace content |
| OLD | NEW |