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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 {"HMAC", 4, blink::WebCryptoAlgorithmIdHmac}, | 66 {"HMAC", 4, blink::WebCryptoAlgorithmIdHmac}, |
67 {"SHA-1", 5, blink::WebCryptoAlgorithmIdSha1}, | 67 {"SHA-1", 5, blink::WebCryptoAlgorithmIdSha1}, |
68 {"AES-KW", 6, blink::WebCryptoAlgorithmIdAesKw}, | 68 {"AES-KW", 6, blink::WebCryptoAlgorithmIdAesKw}, |
69 {"SHA-512", 7, blink::WebCryptoAlgorithmIdSha512}, | 69 {"SHA-512", 7, blink::WebCryptoAlgorithmIdSha512}, |
70 {"SHA-384", 7, blink::WebCryptoAlgorithmIdSha384}, | 70 {"SHA-384", 7, blink::WebCryptoAlgorithmIdSha384}, |
71 {"SHA-256", 7, blink::WebCryptoAlgorithmIdSha256}, | 71 {"SHA-256", 7, blink::WebCryptoAlgorithmIdSha256}, |
72 {"AES-CBC", 7, blink::WebCryptoAlgorithmIdAesCbc}, | 72 {"AES-CBC", 7, blink::WebCryptoAlgorithmIdAesCbc}, |
73 {"AES-GCM", 7, blink::WebCryptoAlgorithmIdAesGcm}, | 73 {"AES-GCM", 7, blink::WebCryptoAlgorithmIdAesGcm}, |
74 {"AES-CTR", 7, blink::WebCryptoAlgorithmIdAesCtr}, | 74 {"AES-CTR", 7, blink::WebCryptoAlgorithmIdAesCtr}, |
75 {"RSA-OAEP", 8, blink::WebCryptoAlgorithmIdRsaOaep}, | 75 {"RSA-OAEP", 8, blink::WebCryptoAlgorithmIdRsaOaep}, |
76 {"RSAES-PKCS1-V1_5", 16, blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5}, | |
77 {"RSASSA-PKCS1-V1_5", 17, blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5}, | 76 {"RSASSA-PKCS1-V1_5", 17, blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5}, |
78 }; | 77 }; |
79 | 78 |
80 typedef char ParamsTypeOrUndefined; | 79 typedef char ParamsTypeOrUndefined; |
81 const ParamsTypeOrUndefined Undefined = -1; | 80 const ParamsTypeOrUndefined Undefined = -1; |
82 | 81 |
83 struct AlgorithmInfo { | 82 struct AlgorithmInfo { |
84 // The canonical (case-sensitive) name for the algorithm. | 83 // The canonical (case-sensitive) name for the algorithm. |
85 const char* name; | 84 const char* name; |
86 | 85 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 blink::WebCryptoAlgorithmParamsTypeNone, // Verify | 126 blink::WebCryptoAlgorithmParamsTypeNone, // Verify |
128 Undefined, // Digest | 127 Undefined, // Digest |
129 blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, // Generat
eKey | 128 blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, // Generat
eKey |
130 blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams, // ImportK
ey | 129 blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams, // ImportK
ey |
131 Undefined, // DeriveKey | 130 Undefined, // DeriveKey |
132 Undefined, // DeriveBits | 131 Undefined, // DeriveBits |
133 Undefined, // WrapKey | 132 Undefined, // WrapKey |
134 Undefined // UnwrapKey | 133 Undefined // UnwrapKey |
135 } | 134 } |
136 }, { // Index 3 | 135 }, { // Index 3 |
137 "RSAES-PKCS1-v1_5", { | |
138 blink::WebCryptoAlgorithmParamsTypeNone, // Encrypt | |
139 blink::WebCryptoAlgorithmParamsTypeNone, // Decrypt | |
140 Undefined, // Sign | |
141 Undefined, // Verify | |
142 Undefined, // Digest | |
143 blink::WebCryptoAlgorithmParamsTypeRsaKeyGenParams, // GenerateKey | |
144 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey | |
145 Undefined, // DeriveKey | |
146 Undefined, // DeriveBits | |
147 blink::WebCryptoAlgorithmParamsTypeNone, // WrapKey | |
148 blink::WebCryptoAlgorithmParamsTypeNone // UnwrapKey | |
149 } | |
150 }, { // Index 4 | |
151 "SHA-1", { | 136 "SHA-1", { |
152 Undefined, // Encrypt | 137 Undefined, // Encrypt |
153 Undefined, // Decrypt | 138 Undefined, // Decrypt |
154 Undefined, // Sign | 139 Undefined, // Sign |
155 Undefined, // Verify | 140 Undefined, // Verify |
156 blink::WebCryptoAlgorithmParamsTypeNone, // Digest | 141 blink::WebCryptoAlgorithmParamsTypeNone, // Digest |
157 Undefined, // GenerateKey | 142 Undefined, // GenerateKey |
158 Undefined, // ImportKey | 143 Undefined, // ImportKey |
159 Undefined, // DeriveKey | 144 Undefined, // DeriveKey |
160 Undefined, // DeriveBits | 145 Undefined, // DeriveBits |
161 Undefined, // WrapKey | 146 Undefined, // WrapKey |
162 Undefined // UnwrapKey | 147 Undefined // UnwrapKey |
163 } | 148 } |
164 }, { // Index 5 | 149 }, { // Index 4 |
165 "SHA-256", { | 150 "SHA-256", { |
166 Undefined, // Encrypt | 151 Undefined, // Encrypt |
167 Undefined, // Decrypt | 152 Undefined, // Decrypt |
168 Undefined, // Sign | 153 Undefined, // Sign |
169 Undefined, // Verify | 154 Undefined, // Verify |
170 blink::WebCryptoAlgorithmParamsTypeNone, // Digest | 155 blink::WebCryptoAlgorithmParamsTypeNone, // Digest |
171 Undefined, // GenerateKey | 156 Undefined, // GenerateKey |
172 Undefined, // ImportKey | 157 Undefined, // ImportKey |
173 Undefined, // DeriveKey | 158 Undefined, // DeriveKey |
174 Undefined, // DeriveBits | 159 Undefined, // DeriveBits |
175 Undefined, // WrapKey | 160 Undefined, // WrapKey |
176 Undefined // UnwrapKey | 161 Undefined // UnwrapKey |
177 } | 162 } |
178 }, { // Index 6 | 163 }, { // Index 5 |
179 "SHA-384", { | 164 "SHA-384", { |
180 Undefined, // Encrypt | 165 Undefined, // Encrypt |
181 Undefined, // Decrypt | 166 Undefined, // Decrypt |
182 Undefined, // Sign | 167 Undefined, // Sign |
183 Undefined, // Verify | 168 Undefined, // Verify |
184 blink::WebCryptoAlgorithmParamsTypeNone, // Digest | 169 blink::WebCryptoAlgorithmParamsTypeNone, // Digest |
185 Undefined, // GenerateKey | 170 Undefined, // GenerateKey |
186 Undefined, // ImportKey | 171 Undefined, // ImportKey |
187 Undefined, // DeriveKey | 172 Undefined, // DeriveKey |
188 Undefined, // DeriveBits | 173 Undefined, // DeriveBits |
189 Undefined, // WrapKey | 174 Undefined, // WrapKey |
190 Undefined // UnwrapKey | 175 Undefined // UnwrapKey |
191 } | 176 } |
192 }, { // Index 7 | 177 }, { // Index 6 |
193 "SHA-512", { | 178 "SHA-512", { |
194 Undefined, // Encrypt | 179 Undefined, // Encrypt |
195 Undefined, // Decrypt | 180 Undefined, // Decrypt |
196 Undefined, // Sign | 181 Undefined, // Sign |
197 Undefined, // Verify | 182 Undefined, // Verify |
198 blink::WebCryptoAlgorithmParamsTypeNone, // Digest | 183 blink::WebCryptoAlgorithmParamsTypeNone, // Digest |
199 Undefined, // GenerateKey | 184 Undefined, // GenerateKey |
200 Undefined, // ImportKey | 185 Undefined, // ImportKey |
201 Undefined, // DeriveKey | 186 Undefined, // DeriveKey |
202 Undefined, // DeriveBits | 187 Undefined, // DeriveBits |
203 Undefined, // WrapKey | 188 Undefined, // WrapKey |
204 Undefined // UnwrapKey | 189 Undefined // UnwrapKey |
205 } | 190 } |
206 }, { // Index 8 | 191 }, { // Index 7 |
207 "AES-GCM", { | 192 "AES-GCM", { |
208 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Encrypt | 193 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Encrypt |
209 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Decrypt | 194 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Decrypt |
210 Undefined, // Sign | 195 Undefined, // Sign |
211 Undefined, // Verify | 196 Undefined, // Verify |
212 Undefined, // Digest | 197 Undefined, // Digest |
213 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey | 198 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey |
214 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey | 199 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey |
215 Undefined, // DeriveKey | 200 Undefined, // DeriveKey |
216 Undefined, // DeriveBits | 201 Undefined, // DeriveBits |
217 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // WrapKey | 202 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // WrapKey |
218 blink::WebCryptoAlgorithmParamsTypeAesGcmParams // UnwrapKey | 203 blink::WebCryptoAlgorithmParamsTypeAesGcmParams // UnwrapKey |
219 } | 204 } |
220 }, { // Index 9 | 205 }, { // Index 8 |
221 "RSA-OAEP", { | 206 "RSA-OAEP", { |
222 blink::WebCryptoAlgorithmParamsTypeRsaOaepParams, // Encrypt | 207 blink::WebCryptoAlgorithmParamsTypeRsaOaepParams, // Encrypt |
223 blink::WebCryptoAlgorithmParamsTypeRsaOaepParams, // Decrypt | 208 blink::WebCryptoAlgorithmParamsTypeRsaOaepParams, // Decrypt |
224 Undefined, // Sign | 209 Undefined, // Sign |
225 Undefined, // Verify | 210 Undefined, // Verify |
226 Undefined, // Digest | 211 Undefined, // Digest |
227 blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, // Generat
eKey | 212 blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, // Generat
eKey |
228 blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams, // ImportK
ey | 213 blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams, // ImportK
ey |
229 Undefined, // DeriveKey | 214 Undefined, // DeriveKey |
230 Undefined, // DeriveBits | 215 Undefined, // DeriveBits |
231 blink::WebCryptoAlgorithmParamsTypeRsaOaepParams, // WrapKey | 216 blink::WebCryptoAlgorithmParamsTypeRsaOaepParams, // WrapKey |
232 blink::WebCryptoAlgorithmParamsTypeRsaOaepParams // UnwrapKey | 217 blink::WebCryptoAlgorithmParamsTypeRsaOaepParams // UnwrapKey |
233 } | 218 } |
234 }, { // Index 10 | 219 }, { // Index 9 |
235 "AES-CTR", { | 220 "AES-CTR", { |
236 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Encrypt | 221 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Encrypt |
237 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Decrypt | 222 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Decrypt |
238 Undefined, // Sign | 223 Undefined, // Sign |
239 Undefined, // Verify | 224 Undefined, // Verify |
240 Undefined, // Digest | 225 Undefined, // Digest |
241 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey | 226 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey |
242 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey | 227 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey |
243 Undefined, // DeriveKey | 228 Undefined, // DeriveKey |
244 Undefined, // DeriveBits | 229 Undefined, // DeriveBits |
245 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // WrapKey | 230 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // WrapKey |
246 blink::WebCryptoAlgorithmParamsTypeAesCtrParams // UnwrapKey | 231 blink::WebCryptoAlgorithmParamsTypeAesCtrParams // UnwrapKey |
247 } | 232 } |
248 }, { // Index 11 | 233 }, { // Index 10 |
249 "AES-KW", { | 234 "AES-KW", { |
250 Undefined, // Encrypt | 235 Undefined, // Encrypt |
251 Undefined, // Decrypt | 236 Undefined, // Decrypt |
252 Undefined, // Sign | 237 Undefined, // Sign |
253 Undefined, // Verify | 238 Undefined, // Verify |
254 Undefined, // Digest | 239 Undefined, // Digest |
255 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey | 240 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey |
256 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey | 241 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey |
257 Undefined, // DeriveKey | 242 Undefined, // DeriveKey |
258 Undefined, // DeriveBits | 243 Undefined, // DeriveBits |
259 blink::WebCryptoAlgorithmParamsTypeNone, // WrapKey | 244 blink::WebCryptoAlgorithmParamsTypeNone, // WrapKey |
260 blink::WebCryptoAlgorithmParamsTypeNone // UnwrapKey | 245 blink::WebCryptoAlgorithmParamsTypeNone // UnwrapKey |
261 } | 246 } |
262 }, | 247 }, |
263 }; | 248 }; |
264 | 249 |
265 // Initializing the algorithmIdToInfo table above depends on knowing the enum | 250 // Initializing the algorithmIdToInfo table above depends on knowing the enum |
266 // values for algorithm IDs. If those ever change, the table will need to be | 251 // values for algorithm IDs. If those ever change, the table will need to be |
267 // updated. | 252 // updated. |
268 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCbc == 0, AesCbc_idDoesntMatch); | 253 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCbc == 0, AesCbc_idDoesntMatch); |
269 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdHmac == 1, Hmac_idDoesntMatch); | 254 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdHmac == 1, Hmac_idDoesntMatch); |
270 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 == 2, RsaSsaPkcs1v1_5_
idDoesntMatch); | 255 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 == 2, RsaSsaPkcs1v1_5_
idDoesntMatch); |
271 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5 == 3, RsaEsPkcs1v1_5_id
DoesntMatch); | 256 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha1 == 3, Sha1_idDoesntMatch); |
272 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha1 == 4, Sha1_idDoesntMatch); | 257 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha256 == 4, Sha256_idDoesntMatch); |
273 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha256 == 5, Sha256_idDoesntMatch); | 258 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha384 == 5, Sha384_idDoesntMatch); |
274 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha384 == 6, Sha384_idDoesntMatch); | 259 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha512 == 6, Sha512_idDoesntMatch); |
275 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha512 == 7, Sha512_idDoesntMatch); | 260 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesGcm == 7, AesGcm_idDoesntMatch); |
276 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesGcm == 8, AesGcm_idDoesntMatch); | 261 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaOaep == 8, RsaOaep_idDoesntMatch); |
277 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaOaep == 9, RsaOaep_idDoesntMatch); | 262 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCtr == 9, AesCtr_idDoesntMatch); |
278 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCtr == 10, AesCtr_idDoesntMatch); | 263 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesKw == 10, AesKw_idDoesntMatch); |
279 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesKw == 11, AesKw_idDoesntMatch); | 264 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdLast == 10, Last_idDoesntMatch); |
280 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdLast == 11, Last_idDoesntMatch); | |
281 COMPILE_ASSERT(10 == LastAlgorithmOperation, UpdateParamsMapping); | 265 COMPILE_ASSERT(10 == LastAlgorithmOperation, UpdateParamsMapping); |
282 | 266 |
283 #if ASSERT_ENABLED | 267 #if ASSERT_ENABLED |
284 | 268 |
285 // Essentially std::is_sorted() (however that function is new to C++11). | 269 // Essentially std::is_sorted() (however that function is new to C++11). |
286 template <typename Iterator> | 270 template <typename Iterator> |
287 bool isSorted(Iterator begin, Iterator end) | 271 bool isSorted(Iterator begin, Iterator end) |
288 { | 272 { |
289 if (begin == end) | 273 if (begin == end) |
290 return true; | 274 return true; |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 blink::WebCryptoAlgorithm hash; | 696 blink::WebCryptoAlgorithm hash; |
713 if (!parseHash(raw, hash, context, result)) | 697 if (!parseHash(raw, hash, context, result)) |
714 return false; | 698 return false; |
715 | 699 |
716 params = adoptPtr(new blink::WebCryptoRsaHashedImportParams(hash)); | 700 params = adoptPtr(new blink::WebCryptoRsaHashedImportParams(hash)); |
717 return true; | 701 return true; |
718 } | 702 } |
719 | 703 |
720 // Defined by the WebCrypto spec as: | 704 // Defined by the WebCrypto spec as: |
721 // | 705 // |
722 // dictionary RsaKeyGenParams : Algorithm { | |
723 // unsigned long modulusLength; | |
724 // BigInteger publicExponent; | |
725 // }; | |
726 bool parseRsaKeyGenParams(const Dictionary& raw, uint32_t& modulusLength, RefPtr
<Uint8Array>& publicExponent, const ErrorContext& context, CryptoResult* result) | |
727 { | |
728 if (!getUint32(raw, "modulusLength", modulusLength, context, result)) | |
729 return false; | |
730 | |
731 if (!getBigInteger(raw, "publicExponent", publicExponent, context, result)) | |
732 return false; | |
733 | |
734 return true; | |
735 } | |
736 | |
737 bool parseRsaKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAlgorith
mParams>& params, const ErrorContext& context, CryptoResult* result) | |
738 { | |
739 uint32_t modulusLength; | |
740 RefPtr<Uint8Array> publicExponent; | |
741 if (!parseRsaKeyGenParams(raw, modulusLength, publicExponent, context, resul
t)) | |
742 return false; | |
743 | |
744 params = adoptPtr(new blink::WebCryptoRsaKeyGenParams(modulusLength, static_
cast<const unsigned char*>(publicExponent->baseAddress()), publicExponent->byteL
ength())); | |
745 return true; | |
746 } | |
747 | |
748 // Defined by the WebCrypto spec as: | |
749 // | |
750 // dictionary RsaHashedKeyGenParams : RsaKeyGenParams { | 706 // dictionary RsaHashedKeyGenParams : RsaKeyGenParams { |
751 // AlgorithmIdentifier hash; | 707 // AlgorithmIdentifier hash; |
752 // }; | 708 // }; |
| 709 // |
| 710 // dictionary RsaKeyGenParams : Algorithm { |
| 711 // unsigned long modulusLength; |
| 712 // BigInteger publicExponent; |
| 713 // }; |
753 bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAl
gorithmParams>& params, const ErrorContext& context, CryptoResult* result) | 714 bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAl
gorithmParams>& params, const ErrorContext& context, CryptoResult* result) |
754 { | 715 { |
755 uint32_t modulusLength; | 716 uint32_t modulusLength; |
| 717 if (!getUint32(raw, "modulusLength", modulusLength, context, result)) |
| 718 return false; |
| 719 |
756 RefPtr<Uint8Array> publicExponent; | 720 RefPtr<Uint8Array> publicExponent; |
757 if (!parseRsaKeyGenParams(raw, modulusLength, publicExponent, context, resul
t)) | 721 if (!getBigInteger(raw, "publicExponent", publicExponent, context, result)) |
758 return false; | 722 return false; |
759 | 723 |
760 blink::WebCryptoAlgorithm hash; | 724 blink::WebCryptoAlgorithm hash; |
761 if (!parseHash(raw, hash, context, result)) | 725 if (!parseHash(raw, hash, context, result)) |
762 return false; | 726 return false; |
763 | 727 |
764 params = adoptPtr(new blink::WebCryptoRsaHashedKeyGenParams(hash, modulusLen
gth, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExp
onent->byteLength())); | 728 params = adoptPtr(new blink::WebCryptoRsaHashedKeyGenParams(hash, modulusLen
gth, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExp
onent->byteLength())); |
765 return true; | 729 return true; |
766 } | 730 } |
767 | 731 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 return parseHmacImportParams(raw, params, context, result); | 817 return parseHmacImportParams(raw, params, context, result); |
854 case blink::WebCryptoAlgorithmParamsTypeHmacKeyGenParams: | 818 case blink::WebCryptoAlgorithmParamsTypeHmacKeyGenParams: |
855 context.add("HmacKeyGenParams"); | 819 context.add("HmacKeyGenParams"); |
856 return parseHmacKeyGenParams(raw, params, context, result); | 820 return parseHmacKeyGenParams(raw, params, context, result); |
857 case blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams: | 821 case blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams: |
858 context.add("RsaHashedKeyGenParams"); | 822 context.add("RsaHashedKeyGenParams"); |
859 return parseRsaHashedKeyGenParams(raw, params, context, result); | 823 return parseRsaHashedKeyGenParams(raw, params, context, result); |
860 case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams: | 824 case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams: |
861 context.add("RsaHashedImportParams"); | 825 context.add("RsaHashedImportParams"); |
862 return parseRsaHashedImportParams(raw, params, context, result); | 826 return parseRsaHashedImportParams(raw, params, context, result); |
863 case blink::WebCryptoAlgorithmParamsTypeRsaKeyGenParams: | |
864 context.add("RsaKeyGenParams"); | |
865 return parseRsaKeyGenParams(raw, params, context, result); | |
866 case blink::WebCryptoAlgorithmParamsTypeAesCtrParams: | 827 case blink::WebCryptoAlgorithmParamsTypeAesCtrParams: |
867 context.add("AesCtrParams"); | 828 context.add("AesCtrParams"); |
868 return parseAesCtrParams(raw, params, context, result); | 829 return parseAesCtrParams(raw, params, context, result); |
869 case blink::WebCryptoAlgorithmParamsTypeAesGcmParams: | 830 case blink::WebCryptoAlgorithmParamsTypeAesGcmParams: |
870 context.add("AesGcmParams"); | 831 context.add("AesGcmParams"); |
871 return parseAesGcmParams(raw, params, context, result); | 832 return parseAesGcmParams(raw, params, context, result); |
872 case blink::WebCryptoAlgorithmParamsTypeRsaOaepParams: | 833 case blink::WebCryptoAlgorithmParamsTypeRsaOaepParams: |
873 context.add("RsaOaepParams"); | 834 context.add("RsaOaepParams"); |
874 return parseRsaOaepParams(raw, params, context, result); | 835 return parseRsaOaepParams(raw, params, context, result); |
875 break; | 836 break; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 { | 918 { |
958 return parseAlgorithm(raw, op, algorithm, ErrorContext(), result); | 919 return parseAlgorithm(raw, op, algorithm, ErrorContext(), result); |
959 } | 920 } |
960 | 921 |
961 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) | 922 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) |
962 { | 923 { |
963 return lookupAlgorithmInfo(id)->name; | 924 return lookupAlgorithmInfo(id)->name; |
964 } | 925 } |
965 | 926 |
966 } // namespace WebCore | 927 } // namespace WebCore |
OLD | NEW |