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

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: 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
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 // TODO(bryaneyler): Also include these in OpenSSL build.
8 #if defined(USE_NSS)
9 #include "content/renderer/webcrypto_sha_digest.h"
10 #endif
11
12 #include "base/memory/scoped_ptr.h"
7 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
8 14
9 namespace content { 15 namespace content {
10 16
11 WebKit::WebCryptoOperation* WebCryptoImpl::digest( 17 void WebCryptoImpl::digest(
12 const WebKit::WebCryptoAlgorithm& algorithm) { 18 const WebKit::WebCryptoAlgorithm& algorithm,
19 WebKit::WebCryptoOperationResult& result) {
20 // TODO(bryaneyler): Also include these in OpenSSL build.
21 #if defined(USE_NSS)
13 switch (algorithm.id()) { 22 switch (algorithm.id()) {
14 case WebKit::WebCryptoAlgorithmIdSha1: 23 case WebKit::WebCryptoAlgorithmIdSha1:
15 case WebKit::WebCryptoAlgorithmIdSha224: 24 case WebKit::WebCryptoAlgorithmIdSha224:
16 case WebKit::WebCryptoAlgorithmIdSha256: 25 case WebKit::WebCryptoAlgorithmIdSha256:
17 case WebKit::WebCryptoAlgorithmIdSha384: 26 case WebKit::WebCryptoAlgorithmIdSha384:
18 case WebKit::WebCryptoAlgorithmIdSha512: 27 case WebKit::WebCryptoAlgorithmIdSha512: {
19 // TODO(eroman): Implement. 28 scoped_ptr<WebCryptoSHADigest> operation(
20 return NULL; 29 new WebCryptoSHADigest(algorithm.id(), result));
Ryan Sleevi 2013/07/31 18:19:19 If you're using the HASH model from NSS (or the EV
Bryan Eyler 2013/08/02 00:49:05 Should this just be WebCryptoDigest then?
eroman 2013/08/02 01:42:58 Yes please
Bryan Eyler 2013/08/02 21:08:08 Done.
30
31 if(!operation->Initialize()) {
Ryan Sleevi 2013/07/31 18:19:19 style: if (!operation->Initialize()) {
Bryan Eyler 2013/08/02 00:49:05 Done.
32 result.initializationFailed();
33 } else {
34 result.initializationSucceeded(operation.release());
35 }
36 return;
37 }
21 default: 38 default:
22 // Not a digest algorithm. 39 // Not a digest algorithm.
23 return NULL; 40 result.initializationFailed();
41 return;
24 } 42 }
43 #else
44 // No way to process.
45 result.initializationFailed();
46 #endif
25 } 47 }
26 48
27 } // namespace content 49 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698