| OLD | NEW |
| 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 |
| OLD | NEW |