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

Unified Diff: net/quic/crypto/strike_register.cc

Issue 388333005: Reject reasons from strike register when nonce validation fails. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updating with TOT Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/crypto/strike_register.h ('k') | net/quic/crypto/strike_register_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/strike_register.cc
diff --git a/net/quic/crypto/strike_register.cc b/net/quic/crypto/strike_register.cc
index db3a778d8a1c6711dbecc72081a479de0af08258..f96d36af3d6e4afdfca89936e6ef32ae9f4a7d43 100644
--- a/net/quic/crypto/strike_register.cc
+++ b/net/quic/crypto/strike_register.cc
@@ -130,8 +130,8 @@ void StrikeRegister::Reset() {
internal_node_head_ = kNil;
}
-bool StrikeRegister::Insert(const uint8 nonce[32],
- uint32 current_time_external) {
+InsertStatus StrikeRegister::Insert(const uint8 nonce[32],
+ uint32 current_time_external) {
// Make space for the insertion if the strike register is full.
while (external_node_free_head_ == kNil ||
internal_node_free_head_ == kNil) {
@@ -142,7 +142,7 @@ bool StrikeRegister::Insert(const uint8 nonce[32],
// Check to see if the orbit is correct.
if (memcmp(nonce + sizeof(current_time), orbit_, sizeof(orbit_))) {
- return false;
+ return NONCE_INVALID_ORBIT_FAILURE;
}
const uint32 nonce_time = ExternalTimeToInternal(TimeFromBytes(nonce));
@@ -151,7 +151,7 @@ bool StrikeRegister::Insert(const uint8 nonce[32],
pair<uint32, uint32> valid_range =
StrikeRegister::GetValidRange(current_time);
if (nonce_time < valid_range.first || nonce_time > valid_range.second) {
- return false;
+ return NONCE_INVALID_TIME_FAILURE;
}
// We strip the orbit out of the nonce.
@@ -171,13 +171,13 @@ bool StrikeRegister::Insert(const uint8 nonce[32],
memcpy(external_node(index), value, sizeof(value));
internal_node_head_ = (index | kExternalFlag) << 8;
DCHECK_LE(horizon_, nonce_time);
- return true;
+ return NONCE_OK;
}
const uint8* best_match = external_node(best_match_index);
if (memcmp(best_match, value, sizeof(value)) == 0) {
// We found the value in the tree.
- return false;
+ return NONCE_NOT_UNIQUE_FAILURE;
}
// We are going to insert a new entry into the tree, so get the nodes now.
@@ -263,7 +263,7 @@ bool StrikeRegister::Insert(const uint8 nonce[32],
*where_index = (*where_index & 0xff) | (internal_node_index << 8);
DCHECK_LE(horizon_, nonce_time);
- return true;
+ return NONCE_OK;
}
const uint8* StrikeRegister::orbit() const {
« no previous file with comments | « net/quic/crypto/strike_register.h ('k') | net/quic/crypto/strike_register_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698