| 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/webcrypto_impl.h" | 5 #include "content/renderer/webcrypto/webcrypto_impl.h" | 
| 6 | 6 | 
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" | 
| 8 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 8 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 
| 9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | 9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" | 
| 10 #include "third_party/WebKit/public/platform/WebCryptoKey.h" | 10 #include "third_party/WebKit/public/platform/WebCryptoKey.h" | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 22     unsigned data_size, | 22     unsigned data_size, | 
| 23     WebKit::WebCryptoResult result) { | 23     WebKit::WebCryptoResult result) { | 
| 24   WebKit::WebArrayBuffer buffer; | 24   WebKit::WebArrayBuffer buffer; | 
| 25   if (!EncryptInternal(algorithm, key, data, data_size, &buffer)) { | 25   if (!EncryptInternal(algorithm, key, data, data_size, &buffer)) { | 
| 26     result.completeWithError(); | 26     result.completeWithError(); | 
| 27   } else { | 27   } else { | 
| 28     result.completeWithBuffer(buffer); | 28     result.completeWithBuffer(buffer); | 
| 29   } | 29   } | 
| 30 } | 30 } | 
| 31 | 31 | 
| 32 void WebCryptoImpl::decrypt( |  | 
| 33     const WebKit::WebCryptoAlgorithm& algorithm, |  | 
| 34     const WebKit::WebCryptoKey& key, |  | 
| 35     const unsigned char* data, |  | 
| 36     unsigned data_size, |  | 
| 37     WebKit::WebCryptoResult result) { |  | 
| 38   WebKit::WebArrayBuffer buffer; |  | 
| 39   if (!DecryptInternal(algorithm, key, data, data_size, &buffer)) { |  | 
| 40     result.completeWithError(); |  | 
| 41   } else { |  | 
| 42     result.completeWithBuffer(buffer); |  | 
| 43   } |  | 
| 44 } |  | 
| 45 |  | 
| 46 void WebCryptoImpl::digest( | 32 void WebCryptoImpl::digest( | 
| 47     const WebKit::WebCryptoAlgorithm& algorithm, | 33     const WebKit::WebCryptoAlgorithm& algorithm, | 
| 48     const unsigned char* data, | 34     const unsigned char* data, | 
| 49     unsigned data_size, | 35     unsigned data_size, | 
| 50     WebKit::WebCryptoResult result) { | 36     WebKit::WebCryptoResult result) { | 
| 51   WebKit::WebArrayBuffer buffer; | 37   WebKit::WebArrayBuffer buffer; | 
| 52   if (!DigestInternal(algorithm, data, data_size, &buffer)) { | 38   if (!DigestInternal(algorithm, data, data_size, &buffer)) { | 
| 53     result.completeWithError(); | 39     result.completeWithError(); | 
| 54   } else { | 40   } else { | 
| 55     result.completeWithBuffer(buffer); | 41     result.completeWithBuffer(buffer); | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 115                                data, | 101                                data, | 
| 116                                data_size, | 102                                data_size, | 
| 117                                &signature_match)) { | 103                                &signature_match)) { | 
| 118     result.completeWithError(); | 104     result.completeWithError(); | 
| 119   } else { | 105   } else { | 
| 120     result.completeWithBoolean(signature_match); | 106     result.completeWithBoolean(signature_match); | 
| 121   } | 107   } | 
| 122 } | 108 } | 
| 123 | 109 | 
| 124 }  // namespace content | 110 }  // namespace content | 
| OLD | NEW | 
|---|