OLD | NEW |
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 WebCryptoAlgorithmParamsTypeAesKeyGenParams, | 78 WebCryptoAlgorithmParamsTypeAesKeyGenParams, |
79 WebCryptoAlgorithmParamsTypeHmacImportParams, | 79 WebCryptoAlgorithmParamsTypeHmacImportParams, |
80 WebCryptoAlgorithmParamsTypeHmacKeyGenParams, | 80 WebCryptoAlgorithmParamsTypeHmacKeyGenParams, |
81 WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, | 81 WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, |
82 WebCryptoAlgorithmParamsTypeRsaHashedImportParams, | 82 WebCryptoAlgorithmParamsTypeRsaHashedImportParams, |
83 WebCryptoAlgorithmParamsTypeAesGcmParams, | 83 WebCryptoAlgorithmParamsTypeAesGcmParams, |
84 WebCryptoAlgorithmParamsTypeRsaOaepParams, | 84 WebCryptoAlgorithmParamsTypeRsaOaepParams, |
85 WebCryptoAlgorithmParamsTypeAesCtrParams, | 85 WebCryptoAlgorithmParamsTypeAesCtrParams, |
86 }; | 86 }; |
87 | 87 |
| 88 struct WebCryptoAlgorithmInfo { |
| 89 typedef char ParamsTypeOrUndefined; |
| 90 static const ParamsTypeOrUndefined Undefined = -1; |
| 91 |
| 92 // The canonical (case-sensitive) name for the algorithm as a |
| 93 // null-terminated C-string literal. |
| 94 const char* name; |
| 95 |
| 96 // A map from the operation to the expected parameter type of the algorithm. |
| 97 // If an operation is not applicable for the algorithm, set to Undefined. |
| 98 const ParamsTypeOrUndefined operationToParamsType[WebCryptoOperationLast + 1
]; |
| 99 }; |
| 100 |
| 101 |
88 class WebCryptoAesCbcParams; | 102 class WebCryptoAesCbcParams; |
89 class WebCryptoAesKeyGenParams; | 103 class WebCryptoAesKeyGenParams; |
90 class WebCryptoHmacImportParams; | 104 class WebCryptoHmacImportParams; |
91 class WebCryptoHmacKeyGenParams; | 105 class WebCryptoHmacKeyGenParams; |
92 class WebCryptoAesGcmParams; | 106 class WebCryptoAesGcmParams; |
93 class WebCryptoRsaOaepParams; | 107 class WebCryptoRsaOaepParams; |
94 class WebCryptoAesCtrParams; | 108 class WebCryptoAesCtrParams; |
95 class WebCryptoRsaHashedKeyGenParams; | 109 class WebCryptoRsaHashedKeyGenParams; |
96 class WebCryptoRsaHashedImportParams; | 110 class WebCryptoRsaHashedImportParams; |
97 | 111 |
(...skipping 10 matching lines...) Expand all Loading... |
108 class WebCryptoAlgorithm { | 122 class WebCryptoAlgorithm { |
109 public: | 123 public: |
110 #if INSIDE_BLINK | 124 #if INSIDE_BLINK |
111 WebCryptoAlgorithm() { } | 125 WebCryptoAlgorithm() { } |
112 BLINK_PLATFORM_EXPORT WebCryptoAlgorithm(WebCryptoAlgorithmId, PassOwnPtr<We
bCryptoAlgorithmParams>); | 126 BLINK_PLATFORM_EXPORT WebCryptoAlgorithm(WebCryptoAlgorithmId, PassOwnPtr<We
bCryptoAlgorithmParams>); |
113 #endif | 127 #endif |
114 | 128 |
115 BLINK_PLATFORM_EXPORT static WebCryptoAlgorithm createNull(); | 129 BLINK_PLATFORM_EXPORT static WebCryptoAlgorithm createNull(); |
116 BLINK_PLATFORM_EXPORT static WebCryptoAlgorithm adoptParamsAndCreate(WebCryp
toAlgorithmId, WebCryptoAlgorithmParams*); | 130 BLINK_PLATFORM_EXPORT static WebCryptoAlgorithm adoptParamsAndCreate(WebCryp
toAlgorithmId, WebCryptoAlgorithmParams*); |
117 | 131 |
| 132 // Returns a WebCryptoAlgorithmInfo for the algorithm with the given ID. If |
| 133 // the ID is invalid, return 0. The caller can assume the pointer will be |
| 134 // valid for the program's entire runtime. |
| 135 BLINK_PLATFORM_EXPORT static const WebCryptoAlgorithmInfo* lookupAlgorithmIn
fo(WebCryptoAlgorithmId); |
| 136 |
118 ~WebCryptoAlgorithm() { reset(); } | 137 ~WebCryptoAlgorithm() { reset(); } |
119 | 138 |
120 WebCryptoAlgorithm(const WebCryptoAlgorithm& other) { assign(other); } | 139 WebCryptoAlgorithm(const WebCryptoAlgorithm& other) { assign(other); } |
121 WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm& other) | 140 WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm& other) |
122 { | 141 { |
123 assign(other); | 142 assign(other); |
124 return *this; | 143 return *this; |
125 } | 144 } |
126 | 145 |
127 BLINK_PLATFORM_EXPORT bool isNull() const; | 146 BLINK_PLATFORM_EXPORT bool isNull() const; |
(...skipping 20 matching lines...) Expand all Loading... |
148 private: | 167 private: |
149 BLINK_PLATFORM_EXPORT void assign(const WebCryptoAlgorithm& other); | 168 BLINK_PLATFORM_EXPORT void assign(const WebCryptoAlgorithm& other); |
150 BLINK_PLATFORM_EXPORT void reset(); | 169 BLINK_PLATFORM_EXPORT void reset(); |
151 | 170 |
152 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; | 171 WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; |
153 }; | 172 }; |
154 | 173 |
155 } // namespace blink | 174 } // namespace blink |
156 | 175 |
157 #endif | 176 #endif |
OLD | NEW |