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

Side by Side Diff: chrome/renderer/pepper/ppb_nacl_hash_private_impl.cc

Issue 14683004: Check that the PNaCl cache hash is truly derived from the bitcode content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/pepper/ppb_nacl_hash_private_impl.h"
6
7 #ifndef DISABLE_NACL
8
9 #include "crypto/secure_hash.h"
10 #include "crypto/secure_util.h"
11 #include "ppapi/c/pp_bool.h"
12
13 namespace {
14
15 void* CreateSHA256Hash() {
16 return static_cast<void*>(crypto::SecureHash::Create(
17 crypto::SecureHash::SHA256));
18 }
19
20 void Update(void* hasher, const void* data, uint32_t len) {
21 crypto::SecureHash* h = static_cast<crypto::SecureHash*>(hasher);
22 h->Update(data, len);
23 }
24
25 void Finish(void* hasher, void* output, uint32_t len) {
26 crypto::SecureHash* h = static_cast<crypto::SecureHash*>(hasher);
27 h->Finish(output, len);
28 }
29
30 void Delete(const void* hasher) {
31 const crypto::SecureHash* h =
32 static_cast<const crypto::SecureHash*>(hasher);
33 delete h;
34 }
35
36 PP_Bool SecureMemEqual(const void* h1, const void* h2, uint32_t len) {
37 return PP_FromBool(crypto::SecureMemEqual(h1, h2, len));
38 }
39
40 const PPB_NaCl_Hash_Private nacl_hash_interface = {
41 &CreateSHA256Hash,
42 &Update,
43 &Finish,
44 &Delete,
45 &SecureMemEqual
46 };
47
48 } // namespace
49
50 const PPB_NaCl_Hash_Private* PPB_NaCl_Hash_Private_Impl::GetInterface() {
51 return &nacl_hash_interface;
52 }
53
54 #endif // DISABLE_NACL
OLDNEW
« no previous file with comments | « chrome/renderer/pepper/ppb_nacl_hash_private_impl.h ('k') | chrome/test/data/nacl/nacl_test_data.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698