| Index: chrome/renderer/pepper/ppb_nacl_hash_private_impl.cc
|
| diff --git a/chrome/renderer/pepper/ppb_nacl_hash_private_impl.cc b/chrome/renderer/pepper/ppb_nacl_hash_private_impl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1ef81cfa0096a3ac1fb1023173f6c2074de43177
|
| --- /dev/null
|
| +++ b/chrome/renderer/pepper/ppb_nacl_hash_private_impl.cc
|
| @@ -0,0 +1,54 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/renderer/pepper/ppb_nacl_hash_private_impl.h"
|
| +
|
| +#ifndef DISABLE_NACL
|
| +
|
| +#include "crypto/secure_hash.h"
|
| +#include "crypto/secure_util.h"
|
| +#include "ppapi/c/pp_bool.h"
|
| +
|
| +namespace {
|
| +
|
| +void* CreateSHA256Hash() {
|
| + return static_cast<void*>(crypto::SecureHash::Create(
|
| + crypto::SecureHash::SHA256));
|
| +}
|
| +
|
| +void Update(void* hasher, const void* data, uint32_t len) {
|
| + crypto::SecureHash* h = static_cast<crypto::SecureHash*>(hasher);
|
| + h->Update(data, len);
|
| +}
|
| +
|
| +void Finish(void* hasher, void* output, uint32_t len) {
|
| + crypto::SecureHash* h = static_cast<crypto::SecureHash*>(hasher);
|
| + h->Finish(output, len);
|
| +}
|
| +
|
| +void Delete(const void* hasher) {
|
| + const crypto::SecureHash* h =
|
| + static_cast<const crypto::SecureHash*>(hasher);
|
| + delete h;
|
| +}
|
| +
|
| +PP_Bool SecureMemEqual(const void* h1, const void* h2, uint32_t len) {
|
| + return PP_FromBool(crypto::SecureMemEqual(h1, h2, len));
|
| +}
|
| +
|
| +const PPB_NaCl_Hash_Private nacl_hash_interface = {
|
| + &CreateSHA256Hash,
|
| + &Update,
|
| + &Finish,
|
| + &Delete,
|
| + &SecureMemEqual
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +const PPB_NaCl_Hash_Private* PPB_NaCl_Hash_Private_Impl::GetInterface() {
|
| + return &nacl_hash_interface;
|
| +}
|
| +
|
| +#endif // DISABLE_NACL
|
|
|