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

Side by Side Diff: Source/modules/crypto/NormalizeAlgorithm.h

Issue 255453002: [refactor] Use a lookup table rather than binary search for algorithm normalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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 NormalizeAlgorithm_h 31 #ifndef NormalizeAlgorithm_h
32 #define NormalizeAlgorithm_h 32 #define NormalizeAlgorithm_h
33 33
34 #include "public/platform/WebCryptoAlgorithm.h" 34 #include "public/platform/WebCryptoAlgorithm.h"
35 #include "public/platform/WebCryptoKey.h"
35 #include "wtf/Assertions.h" 36 #include "wtf/Assertions.h"
36 #include "wtf/Forward.h" 37 #include "wtf/Forward.h"
37 38
38 namespace blink { class WebCryptoAlgorithm; } 39 namespace blink { class WebCryptoAlgorithm; }
39 40
40 namespace WebCore { 41 namespace WebCore {
41 42
42 class CryptoResult; 43 class CryptoResult;
43 class Dictionary; 44 class Dictionary;
44 45
(...skipping 22 matching lines...) Expand all
67 // On failure parseAlgorithm returns false and completes the CryptoResult 68 // On failure parseAlgorithm returns false and completes the CryptoResult
68 // with a (non-localized) debug string. 69 // with a (non-localized) debug string.
69 // 70 //
70 // [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules 71 // [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules
71 bool parseAlgorithm(const Dictionary&, AlgorithmOperation, blink::WebCryptoAlgor ithm&, CryptoResult*) WARN_UNUSED_RETURN; 72 bool parseAlgorithm(const Dictionary&, AlgorithmOperation, blink::WebCryptoAlgor ithm&, CryptoResult*) WARN_UNUSED_RETURN;
72 73
73 // Returns a null-terminated C-string literal. Caller can assume the pointer 74 // Returns a null-terminated C-string literal. Caller can assume the pointer
74 // will be valid for the program's entire runtime. 75 // will be valid for the program's entire runtime.
75 const char* algorithmIdToName(blink::WebCryptoAlgorithmId); 76 const char* algorithmIdToName(blink::WebCryptoAlgorithmId);
76 77
78 // Returns true if the key usages are valid for creating keys for the given
79 // algorithm. Otherwise returns false and sets an error on the result.
80 bool verifyUsagesAreConsistentForAlgorithm(blink::WebCryptoAlgorithmId, blink::W ebCryptoKeyUsageMask, CryptoResult*);
81
77 } // namespace WebCore 82 } // namespace WebCore
78 83
79 #endif 84 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698