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

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, 5 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
7 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 12 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
8 13
9 namespace content { 14 namespace content {
10 15
11 WebKit::WebCryptoOperation* WebCryptoImpl::digest( 16 WebKit::WebCryptoOperation* WebCryptoImpl::digest(
17 // TODO(bryaneyler): Also include these in OpenSSL build.
18 #if defined(USE_NSS)
12 const WebKit::WebCryptoAlgorithm& algorithm) { 19 const WebKit::WebCryptoAlgorithm& algorithm) {
13 switch (algorithm.id()) { 20 switch (algorithm.id()) {
14 case WebKit::WebCryptoAlgorithmIdSha1: 21 case WebKit::WebCryptoAlgorithmIdSha1:
15 case WebKit::WebCryptoAlgorithmIdSha224: 22 case WebKit::WebCryptoAlgorithmIdSha224:
16 case WebKit::WebCryptoAlgorithmIdSha256: 23 case WebKit::WebCryptoAlgorithmIdSha256:
17 case WebKit::WebCryptoAlgorithmIdSha384: 24 case WebKit::WebCryptoAlgorithmIdSha384:
18 case WebKit::WebCryptoAlgorithmIdSha512: 25 case WebKit::WebCryptoAlgorithmIdSha512:
19 // TODO(eroman): Implement. 26 return new WebCryptoSHADigest(algorithm.id());
20 return NULL;
21 default: 27 default:
22 // Not a digest algorithm. 28 // Not a digest algorithm.
23 return NULL; 29 return NULL;
24 } 30 }
31 #else
32 // No way to process.
33 return NULL;
34 #endif
25 } 35 }
26 36
27 } // namespace content 37 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698