Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebCryptoAlgorithm_h | |
| 32 #define WebCryptoAlgorithm_h | |
| 33 | |
| 34 #include "WebCommon.h" | |
| 35 #include "WebPrivatePtr.h" | |
| 36 | |
| 37 #if WEBKIT_IMPLEMENTATION | |
| 38 #include "wtf/PassOwnPtr.h" | |
| 39 #endif | |
| 40 | |
| 41 namespace WebKit { | |
| 42 | |
| 43 // The possible algorithm names. | |
|
abarth-chromium
2013/07/02 06:46:36
These aren't algorithm names. They're algorithm I
eroman
2013/07/02 08:12:27
Done.
| |
| 44 enum WebCryptoAlgorithmId { | |
|
eroman
2013/07/02 06:06:53
Note: I only included a few algorithms and paramet
| |
| 45 AesCbc, | |
|
abarth-chromium
2013/07/02 06:46:36
The pattern we use for these API enums is to repea
| |
| 46 Sha1, | |
| 47 Sha224, | |
| 48 Sha256, | |
| 49 Sha384, | |
| 50 Sha512, | |
| 51 #if WEBKIT_IMPLEMENTATION | |
| 52 NumAlgorithmId, | |
| 53 #endif | |
| 54 }; | |
| 55 | |
| 56 // The possible algorithm-specific parameters. | |
|
abarth-chromium
2013/07/02 06:46:36
Please omit this redundant comment.
eroman
2013/07/02 08:12:27
Done.
| |
| 57 enum WebCryptoAlgorithmParamsType { | |
| 58 NoParams, | |
| 59 AesCbcParams, | |
| 60 AesKeyGenParams, | |
| 61 }; | |
| 62 | |
| 63 // Forward declaration for the algorithm parameters types. | |
|
abarth-chromium
2013/07/02 06:46:36
Please omit this comment that just says what the c
eroman
2013/07/02 08:12:27
Done.
| |
| 64 class WebCryptoAesCbcParams; | |
| 65 class WebCryptoAesKeyGenParams; | |
| 66 | |
| 67 class WebCryptoAlgorithmParams; | |
| 68 class WebCryptoAlgorithmPrivate; | |
| 69 | |
| 70 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. | |
| 71 // * Immutable | |
| 72 // * Threadsafe | |
| 73 // * Copiable (cheaply) | |
|
abarth-chromium
2013/07/02 06:46:36
By contrast, this is a very helpful comment!
| |
| 74 class WebCryptoAlgorithm { | |
| 75 public: | |
| 76 #if WEBKIT_IMPLEMENTATION | |
| 77 WebCryptoAlgorithm() { } | |
| 78 WebCryptoAlgorithm(WebCryptoAlgorithmId, const char*, PassOwnPtr<WebCryptoAl gorithmParams>); | |
| 79 #endif | |
| 80 | |
| 81 WEBKIT_EXPORT ~WebCryptoAlgorithm(); | |
|
abarth-chromium
2013/07/02 06:46:36
We generally don't export destructors. Instead, w
eroman
2013/07/02 08:12:27
Done.
| |
| 82 | |
| 83 WEBKIT_EXPORT WebCryptoAlgorithm(const WebCryptoAlgorithm&); | |
| 84 WEBKIT_EXPORT WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm&); | |
|
abarth-chromium
2013/07/02 06:46:36
Similarly, we don't export constructors or operato
eroman
2013/07/02 08:12:27
Done.
| |
| 85 | |
| 86 // Returns a unique identifier for the algorithm. | |
|
abarth-chromium
2013/07/02 06:46:36
Unique in what sense? They're just identifiers fo
eroman
2013/07/02 08:12:27
Removed comment.
| |
| 87 WEBKIT_EXPORT WebCryptoAlgorithmId algorithmId() const; | |
| 88 WEBKIT_EXPORT const char* algorithmName() const; | |
| 89 | |
| 90 // Returns the specific type of parameters. | |
| 91 WEBKIT_EXPORT WebCryptoAlgorithmParamsType paramsType() const; | |
| 92 | |
| 93 // Retrieves the type-specific parameters. The algorithm contains at most 1 | |
| 94 // type of parameters. Retrieving an invalid parameter will return 0. | |
| 95 WebCryptoAesCbcParams* getAesCbcParams() const; | |
|
abarth-chromium
2013/07/02 06:46:36
getAesCbcParams -> aesCbcParams
eroman
2013/07/02 08:12:27
Done.
| |
| 96 WebCryptoAesKeyGenParams* getAesKeyGenParams() const; | |
|
abarth-chromium
2013/07/02 06:46:36
getAesKeyGenParams -> aesKeyGenParams
eroman
2013/07/02 08:12:27
Done.
| |
| 97 | |
| 98 private: | |
| 99 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; | |
| 100 }; | |
| 101 | |
| 102 } // namespace WebKit | |
| 103 | |
| 104 #endif | |
| OLD | NEW |