| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/loader/nacl_validation_query.h" | 5 #include "components/nacl/loader/nacl_validation_query.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "components/nacl/loader/nacl_validation_db.h" | 8 #include "components/nacl/loader/nacl_validation_db.h" |
| 9 #include "crypto/nss_util.h" | 9 #include "crypto/nss_util.h" |
| 10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 NaClValidationQuery* query = new NaClValidationQuery(db_, profile_key_); | 28 NaClValidationQuery* query = new NaClValidationQuery(db_, profile_key_); |
| 29 // Changing the version effectively invalidates existing hashes. | 29 // Changing the version effectively invalidates existing hashes. |
| 30 query->AddData(nacl_version_); | 30 query->AddData(nacl_version_); |
| 31 return query; | 31 return query; |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool NaClValidationQueryContext::ResolveFileToken( | 34 bool NaClValidationQueryContext::ResolveFileToken( |
| 35 struct NaClFileToken* file_token, | 35 struct NaClFileToken* file_token, |
| 36 int32* fd, | 36 int32* fd, |
| 37 std::string* path) { | 37 std::string* path) { |
| 38 return db_->ResolveFileToken(file_token, fd, path); | 38 // This should no longer be used. |
| 39 CHECK(false); |
| 40 return false; |
| 39 } | 41 } |
| 40 | 42 |
| 41 NaClValidationQuery::NaClValidationQuery(NaClValidationDB* db, | 43 NaClValidationQuery::NaClValidationQuery(NaClValidationDB* db, |
| 42 const std::string& profile_key) | 44 const std::string& profile_key) |
| 43 : state_(READY), | 45 : state_(READY), |
| 44 hasher_(crypto::HMAC::SHA256), | 46 hasher_(crypto::HMAC::SHA256), |
| 45 db_(db), | 47 db_(db), |
| 46 buffer_length_(0) { | 48 buffer_length_(0) { |
| 47 // Without this line on Linux, HMAC::Init will instantiate a singleton that | 49 // Without this line on Linux, HMAC::Init will instantiate a singleton that |
| 48 // in turn attempts to open a file. Disabling this behavior avoids a ~70 ms | 50 // in turn attempts to open a file. Disabling this behavior avoids a ~70 ms |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 memset(cache, 0, sizeof(*cache)); | 165 memset(cache, 0, sizeof(*cache)); |
| 164 cache->handle = new NaClValidationQueryContext(db, profile_key, nacl_version); | 166 cache->handle = new NaClValidationQueryContext(db, profile_key, nacl_version); |
| 165 cache->CreateQuery = CreateQuery; | 167 cache->CreateQuery = CreateQuery; |
| 166 cache->AddData = AddData; | 168 cache->AddData = AddData; |
| 167 cache->QueryKnownToValidate = QueryKnownToValidate; | 169 cache->QueryKnownToValidate = QueryKnownToValidate; |
| 168 cache->SetKnownToValidate = SetKnownToValidate; | 170 cache->SetKnownToValidate = SetKnownToValidate; |
| 169 cache->DestroyQuery = DestroyQuery; | 171 cache->DestroyQuery = DestroyQuery; |
| 170 cache->ResolveFileToken = ResolveFileToken; | 172 cache->ResolveFileToken = ResolveFileToken; |
| 171 return cache; | 173 return cache; |
| 172 } | 174 } |
| OLD | NEW |