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

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: minor 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(void* hasher) {
31 crypto::SecureHash* h = static_cast<crypto::SecureHash*>(hasher);
32 delete h;
33 }
34
35 PP_Bool SecureMemEqual(const char* h1, const char* h2, uint32_t len) {
36 return PP_FromBool(crypto::SecureMemEqual(h1, h2, len));
37 }
38
39 const PPB_NaCl_Hash_Private nacl_hash_interface = {
40 &CreateSHA256Hash,
41 &Update,
42 &Finish,
43 &Delete,
44 &SecureMemEqual
45 };
46
47 } // namespace
48
49 const PPB_NaCl_Hash_Private* PPB_NaCl_Hash_Private_Impl::GetInterface() {
50 return &nacl_hash_interface;
51 }
52
53 #endif // DISABLE_NACL
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698