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

Side by Side Diff: public/platform/WebCrypto.h

Issue 151673005: Add digestSynchronous WebCrypto method. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated the function's arguments. Created 6 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebCrypto_h 31 #ifndef WebCrypto_h
32 #define WebCrypto_h 32 #define WebCrypto_h
33 33
34 #include "WebCommon.h" 34 #include "WebCommon.h"
35 #include "WebCryptoAlgorithm.h"
35 #include "WebCryptoKey.h" 36 #include "WebCryptoKey.h"
36 #include "WebPrivatePtr.h" 37 #include "WebPrivatePtr.h"
37 38
38 namespace WebCore { class CryptoResult; } 39 namespace WebCore { class CryptoResult; }
39 40
40 #if INSIDE_BLINK 41 #if INSIDE_BLINK
41 namespace WTF { template <typename T> class PassRefPtr; } 42 namespace WTF { template <typename T> class PassRefPtr; }
42 #endif 43 #endif
43 44
44 namespace blink { 45 namespace blink {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 virtual void verifySignature(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsigned char* signature, unsigned signatureSize, const unsigned char* da ta, unsigned dataSize, WebCryptoResult result) { result.completeWithError(); } 172 virtual void verifySignature(const WebCryptoAlgorithm&, const WebCryptoKey&, const unsigned char* signature, unsigned signatureSize, const unsigned char* da ta, unsigned dataSize, WebCryptoResult result) { result.completeWithError(); }
172 virtual void digest(const WebCryptoAlgorithm&, const unsigned char* data, un signed dataSize, WebCryptoResult result) { result.completeWithError(); } 173 virtual void digest(const WebCryptoAlgorithm&, const unsigned char* data, un signed dataSize, WebCryptoResult result) { result.completeWithError(); }
173 virtual void generateKey(const WebCryptoAlgorithm&, bool extractable, WebCry ptoKeyUsageMask, WebCryptoResult result) { result.completeWithError(); } 174 virtual void generateKey(const WebCryptoAlgorithm&, bool extractable, WebCry ptoKeyUsageMask, WebCryptoResult result) { result.completeWithError(); }
174 // It is possible for the WebCryptoAlgorithm to be "isNull()" 175 // It is possible for the WebCryptoAlgorithm to be "isNull()"
175 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, uns igned keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsag eMask, WebCryptoResult result) { result.completeWithError(); } 176 virtual void importKey(WebCryptoKeyFormat, const unsigned char* keyData, uns igned keyDataSize, const WebCryptoAlgorithm&, bool extractable, WebCryptoKeyUsag eMask, WebCryptoResult result) { result.completeWithError(); }
176 virtual void exportKey(WebCryptoKeyFormat, const WebCryptoKey&, WebCryptoRes ult result) { result.completeWithError(); } 177 virtual void exportKey(WebCryptoKeyFormat, const WebCryptoKey&, WebCryptoRes ult result) { result.completeWithError(); }
177 virtual void wrapKey(WebCryptoKeyFormat, const WebCryptoKey& key, const WebC ryptoKey& wrappingKey, const WebCryptoAlgorithm&, WebCryptoResult result) { resu lt.completeWithError(); } 178 virtual void wrapKey(WebCryptoKeyFormat, const WebCryptoKey& key, const WebC ryptoKey& wrappingKey, const WebCryptoAlgorithm&, WebCryptoResult result) { resu lt.completeWithError(); }
178 // It is possible that unwrappedKeyAlgorithm.isNull() 179 // It is possible that unwrappedKeyAlgorithm.isNull()
179 virtual void unwrapKey(WebCryptoKeyFormat, const unsigned char* wrappedKey, unsigned wrappedKeySize, const WebCryptoKey&, const WebCryptoAlgorithm& unwrapAl gorithm, const WebCryptoAlgorithm& unwrappedKeyAlgorithm, bool extractable, WebC ryptoKeyUsageMask, WebCryptoResult result) { result.completeWithError(); } 180 virtual void unwrapKey(WebCryptoKeyFormat, const unsigned char* wrappedKey, unsigned wrappedKeySize, const WebCryptoKey&, const WebCryptoAlgorithm& unwrapAl gorithm, const WebCryptoAlgorithm& unwrappedKeyAlgorithm, bool extractable, WebC ryptoKeyUsageMask, WebCryptoResult result) { result.completeWithError(); }
180 181
182 // This is the one exception to the "Completing the request" guarantees
183 // outlined above. digestSynchronous must provide the result into result
184 // synchronously. It must return |true| on successful calculation of the
185 // digest and |false| otherwise. This is useful for Blink internal crypto
186 // and is not part of the WebCrypto standard.
187 virtual bool digestSynchronous(const WebCryptoAlgorithmId algorithmId, const unsigned char* data, unsigned dataSize, WebArrayBuffer& result) { return false; }
188
181 protected: 189 protected:
182 virtual ~WebCrypto() { } 190 virtual ~WebCrypto() { }
183 }; 191 };
184 192
185 } // namespace blink 193 } // namespace blink
186 194
187 #endif 195 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698