OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_ | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_ |
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_ | 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_ |
9 | 9 |
| 10 #include <stddef.h> |
| 11 |
10 #include "native_client/src/include/nacl_base.h" | 12 #include "native_client/src/include/nacl_base.h" |
| 13 #include "native_client/src/include/portability.h" |
11 | 14 |
12 EXTERN_C_BEGIN | 15 EXTERN_C_BEGIN |
13 | 16 |
| 17 struct NaClValidationMetadata; |
| 18 |
14 /* | 19 /* |
15 * This interface allows the validator to query a database of validation results | 20 * This interface allows the validator to query a database of validation results |
16 * while hiding details of how the database is implemented. | 21 * while hiding details of how the database is implemented. |
17 * | 22 * |
18 * query = cache->CreateQuery(cache->handle); | 23 * query = cache->CreateQuery(cache->handle); |
19 * CreateQuery: create an opaque query object, given an opaque context object. | 24 * CreateQuery: create an opaque query object, given an opaque context object. |
20 * The context object contains persistent variables that will be used for all | 25 * The context object contains persistent variables that will be used for all |
21 * queries, whereas the query object contains information relevant to a single | 26 * queries, whereas the query object contains information relevant to a single |
22 * validation result. | 27 * validation result. |
23 * | 28 * |
(...skipping 22 matching lines...) Expand all Loading... |
46 | 51 |
47 struct NaClValidationCache { | 52 struct NaClValidationCache { |
48 void *handle; | 53 void *handle; |
49 void *(*CreateQuery)(void *handle); | 54 void *(*CreateQuery)(void *handle); |
50 void (*AddData)(void *query, const unsigned char *data, size_t length); | 55 void (*AddData)(void *query, const unsigned char *data, size_t length); |
51 int (*QueryKnownToValidate)(void *query); | 56 int (*QueryKnownToValidate)(void *query); |
52 void (*SetKnownToValidate)(void *query); | 57 void (*SetKnownToValidate)(void *query); |
53 void (*DestroyQuery)(void *query); | 58 void (*DestroyQuery)(void *query); |
54 }; | 59 }; |
55 | 60 |
| 61 /* Helper function for identifying the code being validated. */ |
| 62 extern void AddCodeIdentity(uint8_t *data, |
| 63 size_t size, |
| 64 const struct NaClValidationMetadata *metadata, |
| 65 struct NaClValidationCache *cache, |
| 66 void *query); |
| 67 |
56 EXTERN_C_END | 68 EXTERN_C_END |
57 | 69 |
58 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_ */ | 70 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_VALIDATION_CACHE_H_ */ |
OLD | NEW |