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

Unified Diff: chrome/nacl/nacl_validation_query.cc

Issue 14750007: NaCl: enable meta-based validation for shared libraries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks Created 7 years, 7 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 | « chrome/nacl/nacl_validation_query.h ('k') | chrome/nacl/nacl_validation_query_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/nacl/nacl_validation_query.cc
diff --git a/chrome/nacl/nacl_validation_query.cc b/chrome/nacl/nacl_validation_query.cc
index 37d9b7866e51fa0c356e4a4871b1a7f95f926b2e..0ff831c5f0025d45cb7f8a15cff9a18cf062c5b4 100644
--- a/chrome/nacl/nacl_validation_query.cc
+++ b/chrome/nacl/nacl_validation_query.cc
@@ -7,6 +7,8 @@
#include "base/logging.h"
#include "crypto/nss_util.h"
#include "chrome/nacl/nacl_validation_db.h"
+#include "native_client/src/include/portability.h"
Mark Seaborn 2013/05/24 22:48:11 Why? You shouldn't be using native_client/src/inc
+#include "native_client/src/trusted/validator/nacl_file_info.h"
#include "native_client/src/trusted/validator/validation_cache.h"
NaClValidationQueryContext::NaClValidationQueryContext(
@@ -29,6 +31,13 @@ NaClValidationQuery* NaClValidationQueryContext::CreateQuery() {
return query;
}
+bool NaClValidationQueryContext::ResolveFileToken(
+ struct NaClFileToken* file_token,
+ int32* fd,
+ std::string* path) {
+ return db_->ResolveFileToken(file_token, fd, path);
+}
+
NaClValidationQuery::NaClValidationQuery(NaClValidationDB* db,
const std::string& profile_key)
: state_(READY),
@@ -127,6 +136,24 @@ static void DestroyQuery(void* query) {
delete static_cast<NaClValidationQuery*>(query);
}
+static int ResolveFileToken(void* handle, struct NaClFileToken* file_token,
+ int32* fd, char** file_path,
+ uint32* file_path_length) {
+ std::string path;
+ *file_path = NULL;
+ *file_path_length = 0;
+ bool ok = static_cast<NaClValidationQueryContext*>(handle)->
+ ResolveFileToken(file_token, fd, &path);
+ if (ok) {
+ *file_path = static_cast<char*>(malloc(path.length() + 1));
+ CHECK(*file_path);
+ memcpy(*file_path, path.data(), path.length());
+ (*file_path)[path.length()] = 0;
+ *file_path_length = static_cast<uint32>(path.length());
+ }
+ return ok;
+}
+
struct NaClValidationCache* CreateValidationCache(
NaClValidationDB* db, const std::string& profile_key,
const std::string& nacl_version) {
@@ -140,5 +167,6 @@ struct NaClValidationCache* CreateValidationCache(
cache->QueryKnownToValidate = QueryKnownToValidate;
cache->SetKnownToValidate = SetKnownToValidate;
cache->DestroyQuery = DestroyQuery;
+ cache->ResolveFileToken = ResolveFileToken;
return cache;
}
« no previous file with comments | « chrome/nacl/nacl_validation_query.h ('k') | chrome/nacl/nacl_validation_query_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698