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

Side by Side Diff: src/trusted/validator/caching/validation_signature.cc

Issue 9430028: Add function for generating validation signatures. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Fixes Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
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
4 * found in the LICENSE file.
5 */
6
7 #include <string.h>
8
9 #include "native_client/src/trusted/validator/caching/validation_signature.h"
10 #include "native_client/src/trusted/validator/caching/hashing_interface.h"
11
12 void GetValidationSignature(const HashingInterface *hashing,
13 const ValidationInfo *info,
14 const unsigned char *code,
15 unsigned int code_length,
16 ValidationSignature *sig) {
17 void *ctx = hashing->create(info->key, info->key_length);
18 /* Generic validation info */
19 hashing->update(ctx, (const unsigned char*) info->isa,
20 strlen(info->isa));
21 hashing->update(ctx, (const unsigned char*) info->version,
22 strlen(info->version));
23 hashing->update(ctx, (const unsigned char *) info->cpu_features,
24 sizeof(NaClCPUFeatures));
25 /* Code identity */
26 hashing->update(ctx, code, code_length);
27 /* Generate hash and cleanup */
28 hashing->digest(ctx, sig->data, &sig->length,
29 VALIDATION_SIGNATURE_MAX_LENGTH);
30 }
OLDNEW
« no previous file with comments | « src/trusted/validator/caching/validation_signature.h ('k') | src/trusted/validator/x86/nacl_cpuid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698