blob: 2905f3b111fa128237cba858750c13bab41f5589 [file] [log] [blame]
[email protected]408699c2013-07-17 21:23:161// 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 "content/renderer/webcrypto_impl.h"
6
[email protected]e5b794b2013-08-30 01:32:547#include "third_party/WebKit/public/platform/WebArrayBuffer.h"
[email protected]408699c2013-07-17 21:23:168
9namespace content {
10
[email protected]7e4c36f2013-09-12 06:10:1911WebCryptoImpl::WebCryptoImpl() {
12 Init();
13}
14
[email protected]e5b794b2013-08-30 01:32:5415void WebCryptoImpl::digest(
16 const WebKit::WebCryptoAlgorithm& algorithm,
17 const unsigned char* data,
[email protected]ed80a092013-09-10 16:36:3818 unsigned data_size,
[email protected]e5b794b2013-08-30 01:32:5419 WebKit::WebCryptoResult result) {
20 WebKit::WebArrayBuffer buffer;
[email protected]ed80a092013-09-10 16:36:3821 if (!DigestInternal(algorithm, data, data_size, &buffer)) {
[email protected]e5b794b2013-08-30 01:32:5422 result.completeWithError();
23 } else {
24 result.completeWithBuffer(buffer);
[email protected]408699c2013-07-17 21:23:1625 }
26}
27
28} // namespace content