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

Side by Side Diff: content/renderer/webcrypto_impl.cc

Issue 19757011: WebCrypto: Implement digest() using NSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split out crypto functionality from abstract result class from Blink. Created 7 years, 4 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
« no previous file with comments | « content/renderer/webcrypto_impl.h ('k') | content/renderer/webcrypto_impl_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/webcrypto_impl.h" 5 #include "content/renderer/webcrypto_impl.h"
6 6
7 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 7 #include "third_party/WebKit/public/platform/WebArrayBuffer.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 WebKit::WebCryptoOperation* WebCryptoImpl::digest( 11 void WebCryptoImpl::digest(
12 const WebKit::WebCryptoAlgorithm& algorithm) { 12 const WebKit::WebCryptoAlgorithm& algorithm,
13 switch (algorithm.id()) { 13 const unsigned char* data,
14 case WebKit::WebCryptoAlgorithmIdSha1: 14 size_t data_size,
15 case WebKit::WebCryptoAlgorithmIdSha224: 15 WebKit::WebCryptoResult result) {
16 case WebKit::WebCryptoAlgorithmIdSha256: 16 WebKit::WebArrayBuffer buffer;
17 case WebKit::WebCryptoAlgorithmIdSha384: 17 if (!digestInternal(algorithm, data, data_size, &buffer)) {
18 case WebKit::WebCryptoAlgorithmIdSha512: 18 result.completeWithError();
19 // TODO(eroman): Implement. 19 } else {
20 return NULL; 20 result.completeWithBuffer(buffer);
21 default:
22 // Not a digest algorithm.
23 return NULL;
24 } 21 }
25 } 22 }
26 23
27 } // namespace content 24 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/webcrypto_impl.h ('k') | content/renderer/webcrypto_impl_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698