| 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 <stdint.h> |
| 8 #include <string.h> |
| 9 |
| 7 #include "base/logging.h" | 10 #include "base/logging.h" |
| 8 #include "components/nacl/loader/nacl_validation_db.h" | 11 #include "components/nacl/loader/nacl_validation_db.h" |
| 9 #include "crypto/nss_util.h" | 12 #include "crypto/nss_util.h" |
| 10 #include "native_client/src/include/portability.h" | 13 #include "native_client/src/include/portability.h" |
| 11 #include "native_client/src/public/validation_cache.h" | 14 #include "native_client/src/public/validation_cache.h" |
| 12 | 15 |
| 13 NaClValidationQueryContext::NaClValidationQueryContext( | 16 NaClValidationQueryContext::NaClValidationQueryContext( |
| 14 NaClValidationDB* db, | 17 NaClValidationDB* db, |
| 15 const std::string& profile_key, | 18 const std::string& profile_key, |
| 16 const std::string& nacl_version) | 19 const std::string& nacl_version) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 memcpy(buffer_, temp, kDigestLength); | 98 memcpy(buffer_, temp, kDigestLength); |
| 96 buffer_length_ = kDigestLength; | 99 buffer_length_ = kDigestLength; |
| 97 } | 100 } |
| 98 | 101 |
| 99 // OO wrappers | 102 // OO wrappers |
| 100 | 103 |
| 101 static void* CreateQuery(void* handle) { | 104 static void* CreateQuery(void* handle) { |
| 102 return static_cast<NaClValidationQueryContext*>(handle)->CreateQuery(); | 105 return static_cast<NaClValidationQueryContext*>(handle)->CreateQuery(); |
| 103 } | 106 } |
| 104 | 107 |
| 105 static void AddData(void* query, const uint8* data, size_t length) { | 108 static void AddData(void* query, const uint8_t* data, size_t length) { |
| 106 static_cast<NaClValidationQuery*>(query)->AddData(data, length); | 109 static_cast<NaClValidationQuery*>(query)->AddData(data, length); |
| 107 } | 110 } |
| 108 | 111 |
| 109 static int QueryKnownToValidate(void* query) { | 112 static int QueryKnownToValidate(void* query) { |
| 110 return static_cast<NaClValidationQuery*>(query)->QueryKnownToValidate(); | 113 return static_cast<NaClValidationQuery*>(query)->QueryKnownToValidate(); |
| 111 } | 114 } |
| 112 | 115 |
| 113 static void SetKnownToValidate(void* query) { | 116 static void SetKnownToValidate(void* query) { |
| 114 static_cast<NaClValidationQuery*>(query)->SetKnownToValidate(); | 117 static_cast<NaClValidationQuery*>(query)->SetKnownToValidate(); |
| 115 } | 118 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 126 // Make sure any fields introduced in a cross-repo change are zeroed. | 129 // Make sure any fields introduced in a cross-repo change are zeroed. |
| 127 memset(cache, 0, sizeof(*cache)); | 130 memset(cache, 0, sizeof(*cache)); |
| 128 cache->handle = new NaClValidationQueryContext(db, profile_key, nacl_version); | 131 cache->handle = new NaClValidationQueryContext(db, profile_key, nacl_version); |
| 129 cache->CreateQuery = CreateQuery; | 132 cache->CreateQuery = CreateQuery; |
| 130 cache->AddData = AddData; | 133 cache->AddData = AddData; |
| 131 cache->QueryKnownToValidate = QueryKnownToValidate; | 134 cache->QueryKnownToValidate = QueryKnownToValidate; |
| 132 cache->SetKnownToValidate = SetKnownToValidate; | 135 cache->SetKnownToValidate = SetKnownToValidate; |
| 133 cache->DestroyQuery = DestroyQuery; | 136 cache->DestroyQuery = DestroyQuery; |
| 134 return cache; | 137 return cache; |
| 135 } | 138 } |
| OLD | NEW |