OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/webcrypto/platform_crypto.h" | 5 #include "content/child/webcrypto/platform_crypto.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include <openssl/aes.h> | 8 #include <openssl/aes.h> |
9 #include <openssl/evp.h> | 9 #include <openssl/evp.h> |
10 #include <openssl/hmac.h> | 10 #include <openssl/hmac.h> |
(...skipping 18 matching lines...) Expand all Loading... |
29 namespace platform { | 29 namespace platform { |
30 | 30 |
31 class SymKey : public Key { | 31 class SymKey : public Key { |
32 public: | 32 public: |
33 explicit SymKey(const CryptoData& key_data) | 33 explicit SymKey(const CryptoData& key_data) |
34 : key_(key_data.bytes(), key_data.bytes() + key_data.byte_length()) {} | 34 : key_(key_data.bytes(), key_data.bytes() + key_data.byte_length()) {} |
35 | 35 |
36 virtual SymKey* AsSymKey() OVERRIDE { return this; } | 36 virtual SymKey* AsSymKey() OVERRIDE { return this; } |
37 virtual PublicKey* AsPublicKey() OVERRIDE { return NULL; } | 37 virtual PublicKey* AsPublicKey() OVERRIDE { return NULL; } |
38 virtual PrivateKey* AsPrivateKey() OVERRIDE { return NULL; } | 38 virtual PrivateKey* AsPrivateKey() OVERRIDE { return NULL; } |
39 virtual bool ThreadSafeSerializeForClone( | |
40 blink::WebVector<uint8>* key_data) OVERRIDE { | |
41 key_data->assign(Uint8VectorStart(key_), key_.size()); | |
42 return true; | |
43 } | |
44 | 39 |
45 const std::vector<unsigned char>& key() const { return key_; } | 40 const std::vector<unsigned char>& key() const { return key_; } |
46 | 41 |
47 private: | 42 private: |
48 const std::vector<unsigned char> key_; | 43 const std::vector<unsigned char> key_; |
49 | 44 |
50 DISALLOW_COPY_AND_ASSIGN(SymKey); | 45 DISALLOW_COPY_AND_ASSIGN(SymKey); |
51 }; | 46 }; |
52 | 47 |
53 namespace { | 48 namespace { |
(...skipping 27 matching lines...) Expand all Loading... |
81 } | 76 } |
82 } | 77 } |
83 | 78 |
84 // OpenSSL constants for EVP_CipherInit_ex(), do not change | 79 // OpenSSL constants for EVP_CipherInit_ex(), do not change |
85 enum CipherOperation { kDoDecrypt = 0, kDoEncrypt = 1 }; | 80 enum CipherOperation { kDoDecrypt = 0, kDoEncrypt = 1 }; |
86 | 81 |
87 Status AesCbcEncryptDecrypt(EncryptOrDecrypt mode, | 82 Status AesCbcEncryptDecrypt(EncryptOrDecrypt mode, |
88 SymKey* key, | 83 SymKey* key, |
89 const CryptoData& iv, | 84 const CryptoData& iv, |
90 const CryptoData& data, | 85 const CryptoData& data, |
91 std::vector<uint8>* buffer) { | 86 blink::WebArrayBuffer* buffer) { |
92 CipherOperation cipher_operation = | 87 CipherOperation cipher_operation = |
93 (mode == ENCRYPT) ? kDoEncrypt : kDoDecrypt; | 88 (mode == ENCRYPT) ? kDoEncrypt : kDoDecrypt; |
94 | 89 |
95 if (data.byte_length() >= INT_MAX - AES_BLOCK_SIZE) { | 90 if (data.byte_length() >= INT_MAX - AES_BLOCK_SIZE) { |
96 // TODO(padolph): Handle this by chunking the input fed into OpenSSL. Right | 91 // TODO(padolph): Handle this by chunking the input fed into OpenSSL. Right |
97 // now it doesn't make much difference since the one-shot API would end up | 92 // now it doesn't make much difference since the one-shot API would end up |
98 // blowing out the memory and crashing anyway. | 93 // blowing out the memory and crashing anyway. |
99 return Status::ErrorDataTooLarge(); | 94 return Status::ErrorDataTooLarge(); |
100 } | 95 } |
101 | 96 |
(...skipping 18 matching lines...) Expand all Loading... |
120 | 115 |
121 // According to the openssl docs, the amount of data written may be as large | 116 // According to the openssl docs, the amount of data written may be as large |
122 // as (data_size + cipher_block_size - 1), constrained to a multiple of | 117 // as (data_size + cipher_block_size - 1), constrained to a multiple of |
123 // cipher_block_size. | 118 // cipher_block_size. |
124 unsigned int output_max_len = data.byte_length() + AES_BLOCK_SIZE - 1; | 119 unsigned int output_max_len = data.byte_length() + AES_BLOCK_SIZE - 1; |
125 const unsigned remainder = output_max_len % AES_BLOCK_SIZE; | 120 const unsigned remainder = output_max_len % AES_BLOCK_SIZE; |
126 if (remainder != 0) | 121 if (remainder != 0) |
127 output_max_len += AES_BLOCK_SIZE - remainder; | 122 output_max_len += AES_BLOCK_SIZE - remainder; |
128 DCHECK_GT(output_max_len, data.byte_length()); | 123 DCHECK_GT(output_max_len, data.byte_length()); |
129 | 124 |
130 buffer->resize(output_max_len); | 125 *buffer = blink::WebArrayBuffer::create(output_max_len, 1); |
131 | 126 |
132 unsigned char* const buffer_data = Uint8VectorStart(buffer); | 127 unsigned char* const buffer_data = |
| 128 reinterpret_cast<unsigned char*>(buffer->data()); |
133 | 129 |
134 int output_len = 0; | 130 int output_len = 0; |
135 if (!EVP_CipherUpdate(context.get(), | 131 if (!EVP_CipherUpdate(context.get(), |
136 buffer_data, | 132 buffer_data, |
137 &output_len, | 133 &output_len, |
138 data.bytes(), | 134 data.bytes(), |
139 data.byte_length())) | 135 data.byte_length())) |
140 return Status::OperationError(); | 136 return Status::OperationError(); |
141 int final_output_chunk_len = 0; | 137 int final_output_chunk_len = 0; |
142 if (!EVP_CipherFinal_ex( | 138 if (!EVP_CipherFinal_ex( |
143 context.get(), buffer_data + output_len, &final_output_chunk_len)) { | 139 context.get(), buffer_data + output_len, &final_output_chunk_len)) { |
144 return Status::OperationError(); | 140 return Status::OperationError(); |
145 } | 141 } |
146 | 142 |
147 const unsigned int final_output_len = | 143 const unsigned int final_output_len = |
148 static_cast<unsigned int>(output_len) + | 144 static_cast<unsigned int>(output_len) + |
149 static_cast<unsigned int>(final_output_chunk_len); | 145 static_cast<unsigned int>(final_output_chunk_len); |
150 DCHECK_LE(final_output_len, output_max_len); | 146 DCHECK_LE(final_output_len, output_max_len); |
151 | 147 |
152 buffer->resize(final_output_len); | 148 ShrinkBuffer(buffer, final_output_len); |
153 | 149 |
154 return Status::Success(); | 150 return Status::Success(); |
155 } | 151 } |
156 | 152 |
157 } // namespace | 153 } // namespace |
158 | 154 |
159 class DigestorOpenSSL : public blink::WebCryptoDigestor { | 155 class DigestorOpenSSL : public blink::WebCryptoDigestor { |
160 public: | 156 public: |
161 explicit DigestorOpenSSL(blink::WebCryptoAlgorithmId algorithm_id) | 157 explicit DigestorOpenSSL(blink::WebCryptoAlgorithmId algorithm_id) |
162 : initialized_(false), | 158 : initialized_(false), |
(...skipping 18 matching lines...) Expand all Loading... |
181 | 177 |
182 virtual bool finish(unsigned char*& result_data, | 178 virtual bool finish(unsigned char*& result_data, |
183 unsigned int& result_data_size) { | 179 unsigned int& result_data_size) { |
184 Status error = FinishInternal(result_, &result_data_size); | 180 Status error = FinishInternal(result_, &result_data_size); |
185 if (!error.IsSuccess()) | 181 if (!error.IsSuccess()) |
186 return false; | 182 return false; |
187 result_data = result_; | 183 result_data = result_; |
188 return true; | 184 return true; |
189 } | 185 } |
190 | 186 |
191 Status FinishWithVectorAndStatus(std::vector<uint8>* result) { | 187 Status FinishWithWebArrayAndStatus(blink::WebArrayBuffer* result) { |
192 const int hash_expected_size = EVP_MD_CTX_size(digest_context_.get()); | 188 const int hash_expected_size = EVP_MD_CTX_size(digest_context_.get()); |
193 result->resize(hash_expected_size); | 189 *result = blink::WebArrayBuffer::create(hash_expected_size, 1); |
194 unsigned char* const hash_buffer = Uint8VectorStart(result); | 190 unsigned char* const hash_buffer = |
| 191 static_cast<unsigned char* const>(result->data()); |
195 unsigned int hash_buffer_size; // ignored | 192 unsigned int hash_buffer_size; // ignored |
196 return FinishInternal(hash_buffer, &hash_buffer_size); | 193 Status error = FinishInternal(hash_buffer, &hash_buffer_size); |
| 194 if (!error.IsSuccess()) |
| 195 result->reset(); |
| 196 return error; |
197 } | 197 } |
198 | 198 |
199 private: | 199 private: |
200 Status Init() { | 200 Status Init() { |
201 if (initialized_) | 201 if (initialized_) |
202 return Status::Success(); | 202 return Status::Success(); |
203 | 203 |
204 const EVP_MD* digest_algorithm = GetDigest(algorithm_id_); | 204 const EVP_MD* digest_algorithm = GetDigest(algorithm_id_); |
205 if (!digest_algorithm) | 205 if (!digest_algorithm) |
206 return Status::ErrorUnexpected(); | 206 return Status::ErrorUnexpected(); |
(...skipping 25 matching lines...) Expand all Loading... |
232 | 232 |
233 return Status::Success(); | 233 return Status::Success(); |
234 } | 234 } |
235 | 235 |
236 bool initialized_; | 236 bool initialized_; |
237 crypto::ScopedOpenSSL<EVP_MD_CTX, EVP_MD_CTX_destroy> digest_context_; | 237 crypto::ScopedOpenSSL<EVP_MD_CTX, EVP_MD_CTX_destroy> digest_context_; |
238 blink::WebCryptoAlgorithmId algorithm_id_; | 238 blink::WebCryptoAlgorithmId algorithm_id_; |
239 unsigned char result_[EVP_MAX_MD_SIZE]; | 239 unsigned char result_[EVP_MAX_MD_SIZE]; |
240 }; | 240 }; |
241 | 241 |
242 Status ExportKeyRaw(SymKey* key, std::vector<uint8>* buffer) { | 242 Status ExportKeyRaw(SymKey* key, blink::WebArrayBuffer* buffer) { |
243 *buffer = key->key(); | 243 *buffer = CreateArrayBuffer(Uint8VectorStart(key->key()), key->key().size()); |
244 return Status::Success(); | 244 return Status::Success(); |
245 } | 245 } |
246 | 246 |
247 void Init() { crypto::EnsureOpenSSLInit(); } | 247 void Init() { crypto::EnsureOpenSSLInit(); } |
248 | 248 |
249 Status EncryptDecryptAesCbc(EncryptOrDecrypt mode, | 249 Status EncryptDecryptAesCbc(EncryptOrDecrypt mode, |
250 SymKey* key, | 250 SymKey* key, |
251 const CryptoData& data, | 251 const CryptoData& data, |
252 const CryptoData& iv, | 252 const CryptoData& iv, |
253 std::vector<uint8>* buffer) { | 253 blink::WebArrayBuffer* buffer) { |
254 // TODO(eroman): inline the function here. | 254 // TODO(eroman): inline the function here. |
255 return AesCbcEncryptDecrypt(mode, key, iv, data, buffer); | 255 return AesCbcEncryptDecrypt(mode, key, iv, data, buffer); |
256 } | 256 } |
257 | 257 |
258 Status DigestSha(blink::WebCryptoAlgorithmId algorithm, | 258 Status DigestSha(blink::WebCryptoAlgorithmId algorithm, |
259 const CryptoData& data, | 259 const CryptoData& data, |
260 std::vector<uint8>* buffer) { | 260 blink::WebArrayBuffer* buffer) { |
261 DigestorOpenSSL digestor(algorithm); | 261 DigestorOpenSSL digestor(algorithm); |
262 Status error = digestor.ConsumeWithStatus(data.bytes(), data.byte_length()); | 262 Status error = digestor.ConsumeWithStatus(data.bytes(), data.byte_length()); |
263 if (!error.IsSuccess()) | 263 if (!error.IsSuccess()) |
264 return error; | 264 return error; |
265 return digestor.FinishWithVectorAndStatus(buffer); | 265 return digestor.FinishWithWebArrayAndStatus(buffer); |
266 } | 266 } |
267 | 267 |
268 scoped_ptr<blink::WebCryptoDigestor> CreateDigestor( | 268 scoped_ptr<blink::WebCryptoDigestor> CreateDigestor( |
269 blink::WebCryptoAlgorithmId algorithm_id) { | 269 blink::WebCryptoAlgorithmId algorithm_id) { |
270 return scoped_ptr<blink::WebCryptoDigestor>( | 270 return scoped_ptr<blink::WebCryptoDigestor>( |
271 new DigestorOpenSSL(algorithm_id)); | 271 new DigestorOpenSSL(algorithm_id)); |
272 } | 272 } |
273 | 273 |
274 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, | 274 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, |
275 bool extractable, | 275 bool extractable, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 extractable, | 328 extractable, |
329 key_algorithm, | 329 key_algorithm, |
330 usage_mask); | 330 usage_mask); |
331 | 331 |
332 return Status::Success(); | 332 return Status::Success(); |
333 } | 333 } |
334 | 334 |
335 Status SignHmac(SymKey* key, | 335 Status SignHmac(SymKey* key, |
336 const blink::WebCryptoAlgorithm& hash, | 336 const blink::WebCryptoAlgorithm& hash, |
337 const CryptoData& data, | 337 const CryptoData& data, |
338 std::vector<uint8>* buffer) { | 338 blink::WebArrayBuffer* buffer) { |
| 339 blink::WebArrayBuffer result; |
| 340 |
339 const EVP_MD* digest_algorithm = GetDigest(hash.id()); | 341 const EVP_MD* digest_algorithm = GetDigest(hash.id()); |
340 if (!digest_algorithm) | 342 if (!digest_algorithm) |
341 return Status::ErrorUnsupported(); | 343 return Status::ErrorUnsupported(); |
342 unsigned int hmac_expected_length = EVP_MD_size(digest_algorithm); | 344 unsigned int hmac_expected_length = EVP_MD_size(digest_algorithm); |
343 | 345 |
344 const std::vector<unsigned char>& raw_key = key->key(); | 346 const std::vector<unsigned char>& raw_key = key->key(); |
345 | 347 |
346 // OpenSSL wierdness here. | 348 // OpenSSL wierdness here. |
347 // First, HMAC() needs a void* for the key data, so make one up front as a | 349 // First, HMAC() needs a void* for the key data, so make one up front as a |
348 // cosmetic to avoid a cast. Second, OpenSSL does not like a NULL key, | 350 // cosmetic to avoid a cast. Second, OpenSSL does not like a NULL key, |
349 // which will result if the raw_key vector is empty; an entirely valid | 351 // which will result if the raw_key vector is empty; an entirely valid |
350 // case. Handle this specific case by pointing to an empty array. | 352 // case. Handle this specific case by pointing to an empty array. |
351 const unsigned char null_key[] = {}; | 353 const unsigned char null_key[] = {}; |
352 const void* const raw_key_voidp = raw_key.size() ? &raw_key[0] : null_key; | 354 const void* const raw_key_voidp = raw_key.size() ? &raw_key[0] : null_key; |
353 | 355 |
354 buffer->resize(hmac_expected_length); | 356 result = blink::WebArrayBuffer::create(hmac_expected_length, 1); |
355 crypto::ScopedOpenSSLSafeSizeBuffer<EVP_MAX_MD_SIZE> hmac_result( | 357 crypto::ScopedOpenSSLSafeSizeBuffer<EVP_MAX_MD_SIZE> hmac_result( |
356 Uint8VectorStart(buffer), hmac_expected_length); | 358 reinterpret_cast<unsigned char*>(result.data()), hmac_expected_length); |
357 | 359 |
358 crypto::OpenSSLErrStackTracer(FROM_HERE); | 360 crypto::OpenSSLErrStackTracer(FROM_HERE); |
359 | 361 |
360 unsigned int hmac_actual_length; | 362 unsigned int hmac_actual_length; |
361 unsigned char* const success = HMAC(digest_algorithm, | 363 unsigned char* const success = HMAC(digest_algorithm, |
362 raw_key_voidp, | 364 raw_key_voidp, |
363 raw_key.size(), | 365 raw_key.size(), |
364 data.bytes(), | 366 data.bytes(), |
365 data.byte_length(), | 367 data.byte_length(), |
366 hmac_result.safe_buffer(), | 368 hmac_result.safe_buffer(), |
367 &hmac_actual_length); | 369 &hmac_actual_length); |
368 if (!success || hmac_actual_length != hmac_expected_length) | 370 if (!success || hmac_actual_length != hmac_expected_length) |
369 return Status::OperationError(); | 371 return Status::OperationError(); |
370 | 372 |
| 373 *buffer = result; |
371 return Status::Success(); | 374 return Status::Success(); |
372 } | 375 } |
373 | 376 |
374 Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm, | 377 Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm, |
375 bool extractable, | 378 bool extractable, |
376 blink::WebCryptoKeyUsageMask usage_mask, | 379 blink::WebCryptoKeyUsageMask usage_mask, |
377 const CryptoData& modulus_data, | 380 const CryptoData& modulus_data, |
378 const CryptoData& exponent_data, | 381 const CryptoData& exponent_data, |
379 blink::WebCryptoKey* key) { | 382 blink::WebCryptoKey* key) { |
380 // TODO(padolph): Placeholder for OpenSSL implementation. | 383 // TODO(padolph): Placeholder for OpenSSL implementation. |
381 // Issue | 384 // Issue |
382 return Status::ErrorUnsupported(); | 385 return Status::ErrorUnsupported(); |
383 } | 386 } |
384 | 387 |
385 Status EncryptDecryptAesGcm(EncryptOrDecrypt mode, | 388 Status EncryptDecryptAesGcm(EncryptOrDecrypt mode, |
386 SymKey* key, | 389 SymKey* key, |
387 const CryptoData& data, | 390 const CryptoData& data, |
388 const CryptoData& iv, | 391 const CryptoData& iv, |
389 const CryptoData& additional_data, | 392 const CryptoData& additional_data, |
390 unsigned int tag_length_bits, | 393 unsigned int tag_length_bits, |
391 std::vector<uint8>* buffer) { | 394 blink::WebArrayBuffer* buffer) { |
392 // TODO(eroman): http://crbug.com/267888 | 395 // TODO(eroman): http://crbug.com/267888 |
393 return Status::ErrorUnsupported(); | 396 return Status::ErrorUnsupported(); |
394 } | 397 } |
395 | 398 |
396 // Guaranteed that key is valid. | 399 // Guaranteed that key is valid. |
397 Status EncryptRsaEsPkcs1v1_5(PublicKey* key, | 400 Status EncryptRsaEsPkcs1v1_5(PublicKey* key, |
398 const CryptoData& data, | 401 const CryptoData& data, |
399 std::vector<uint8>* buffer) { | 402 blink::WebArrayBuffer* buffer) { |
400 // TODO(eroman): http://crbug.com/267888 | 403 // TODO(eroman): http://crbug.com/267888 |
401 return Status::ErrorUnsupported(); | 404 return Status::ErrorUnsupported(); |
402 } | 405 } |
403 | 406 |
404 Status DecryptRsaEsPkcs1v1_5(PrivateKey* key, | 407 Status DecryptRsaEsPkcs1v1_5(PrivateKey* key, |
405 const CryptoData& data, | 408 const CryptoData& data, |
406 std::vector<uint8>* buffer) { | 409 blink::WebArrayBuffer* buffer) { |
407 // TODO(eroman): http://crbug.com/267888 | 410 // TODO(eroman): http://crbug.com/267888 |
408 return Status::ErrorUnsupported(); | 411 return Status::ErrorUnsupported(); |
409 } | 412 } |
410 | 413 |
411 Status SignRsaSsaPkcs1v1_5(PrivateKey* key, | 414 Status SignRsaSsaPkcs1v1_5(PrivateKey* key, |
412 const blink::WebCryptoAlgorithm& hash, | 415 const blink::WebCryptoAlgorithm& hash, |
413 const CryptoData& data, | 416 const CryptoData& data, |
414 std::vector<uint8>* buffer) { | 417 blink::WebArrayBuffer* buffer) { |
415 // TODO(eroman): http://crbug.com/267888 | 418 // TODO(eroman): http://crbug.com/267888 |
416 return Status::ErrorUnsupported(); | 419 return Status::ErrorUnsupported(); |
417 } | 420 } |
418 | 421 |
419 // Key is guaranteed to be an RSA SSA key. | 422 // Key is guaranteed to be an RSA SSA key. |
420 Status VerifyRsaSsaPkcs1v1_5(PublicKey* key, | 423 Status VerifyRsaSsaPkcs1v1_5(PublicKey* key, |
421 const blink::WebCryptoAlgorithm& hash, | 424 const blink::WebCryptoAlgorithm& hash, |
422 const CryptoData& signature, | 425 const CryptoData& signature, |
423 const CryptoData& data, | 426 const CryptoData& data, |
424 bool* signature_match) { | 427 bool* signature_match) { |
(...skipping 12 matching lines...) Expand all Loading... |
437 | 440 |
438 Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm, | 441 Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm, |
439 const CryptoData& key_data, | 442 const CryptoData& key_data, |
440 bool extractable, | 443 bool extractable, |
441 blink::WebCryptoKeyUsageMask usage_mask, | 444 blink::WebCryptoKeyUsageMask usage_mask, |
442 blink::WebCryptoKey* key) { | 445 blink::WebCryptoKey* key) { |
443 // TODO(eroman): http://crbug.com/267888 | 446 // TODO(eroman): http://crbug.com/267888 |
444 return Status::ErrorUnsupported(); | 447 return Status::ErrorUnsupported(); |
445 } | 448 } |
446 | 449 |
447 Status ExportKeySpki(PublicKey* key, std::vector<uint8>* buffer) { | 450 Status ExportKeySpki(PublicKey* key, blink::WebArrayBuffer* buffer) { |
448 // TODO(eroman): http://crbug.com/267888 | 451 // TODO(eroman): http://crbug.com/267888 |
449 return Status::ErrorUnsupported(); | 452 return Status::ErrorUnsupported(); |
450 } | 453 } |
451 | 454 |
452 Status ExportKeyPkcs8(PrivateKey* key, | 455 Status ExportKeyPkcs8(PrivateKey* key, |
453 const blink::WebCryptoKeyAlgorithm& key_algorithm, | 456 const blink::WebCryptoKeyAlgorithm& key_algorithm, |
454 std::vector<uint8>* buffer) { | 457 blink::WebArrayBuffer* buffer) { |
455 // TODO(eroman): http://crbug.com/267888 | 458 // TODO(eroman): http://crbug.com/267888 |
456 return Status::ErrorUnsupported(); | 459 return Status::ErrorUnsupported(); |
457 } | 460 } |
458 | 461 |
459 Status ExportRsaPublicKey(PublicKey* key, | 462 Status ExportRsaPublicKey(PublicKey* key, |
460 std::vector<uint8>* modulus, | 463 std::vector<uint8>* modulus, |
461 std::vector<uint8>* public_exponent) { | 464 std::vector<uint8>* public_exponent) { |
462 // TODO(eroman): http://crbug.com/267888 | 465 // TODO(eroman): http://crbug.com/267888 |
463 return Status::ErrorUnsupported(); | 466 return Status::ErrorUnsupported(); |
464 } | 467 } |
465 | 468 |
466 Status WrapSymKeyAesKw(SymKey* wrapping_key, | 469 Status WrapSymKeyAesKw(SymKey* wrapping_key, |
467 SymKey* key, | 470 SymKey* key, |
468 std::vector<uint8>* buffer) { | 471 blink::WebArrayBuffer* buffer) { |
469 // TODO(eroman): http://crbug.com/267888 | 472 // TODO(eroman): http://crbug.com/267888 |
470 return Status::ErrorUnsupported(); | 473 return Status::ErrorUnsupported(); |
471 } | 474 } |
472 | 475 |
473 Status UnwrapSymKeyAesKw(const CryptoData& wrapped_key_data, | 476 Status UnwrapSymKeyAesKw(const CryptoData& wrapped_key_data, |
474 SymKey* wrapping_key, | 477 SymKey* wrapping_key, |
475 const blink::WebCryptoAlgorithm& algorithm, | 478 const blink::WebCryptoAlgorithm& algorithm, |
476 bool extractable, | 479 bool extractable, |
477 blink::WebCryptoKeyUsageMask usage_mask, | 480 blink::WebCryptoKeyUsageMask usage_mask, |
478 blink::WebCryptoKey* key) { | 481 blink::WebCryptoKey* key) { |
479 // TODO(eroman): http://crbug.com/267888 | 482 // TODO(eroman): http://crbug.com/267888 |
480 return Status::ErrorUnsupported(); | 483 return Status::ErrorUnsupported(); |
481 } | 484 } |
482 | 485 |
483 Status DecryptAesKw(SymKey* key, | 486 Status DecryptAesKw(SymKey* key, |
484 const CryptoData& data, | 487 const CryptoData& data, |
485 std::vector<uint8>* buffer) { | 488 blink::WebArrayBuffer* buffer) { |
486 // TODO(eroman): http://crbug.com/267888 | 489 // TODO(eroman): http://crbug.com/267888 |
487 return Status::ErrorUnsupported(); | 490 return Status::ErrorUnsupported(); |
488 } | 491 } |
489 | 492 |
490 Status WrapSymKeyRsaEs(PublicKey* wrapping_key, | 493 Status WrapSymKeyRsaEs(PublicKey* wrapping_key, |
491 SymKey* key, | 494 SymKey* key, |
492 std::vector<uint8>* buffer) { | 495 blink::WebArrayBuffer* buffer) { |
493 // TODO(eroman): http://crbug.com/267888 | 496 // TODO(eroman): http://crbug.com/267888 |
494 return Status::ErrorUnsupported(); | 497 return Status::ErrorUnsupported(); |
495 } | 498 } |
496 | 499 |
497 Status UnwrapSymKeyRsaEs(const CryptoData& wrapped_key_data, | 500 Status UnwrapSymKeyRsaEs(const CryptoData& wrapped_key_data, |
498 PrivateKey* wrapping_key, | 501 PrivateKey* wrapping_key, |
499 const blink::WebCryptoAlgorithm& algorithm, | 502 const blink::WebCryptoAlgorithm& algorithm, |
500 bool extractable, | 503 bool extractable, |
501 blink::WebCryptoKeyUsageMask usage_mask, | 504 blink::WebCryptoKeyUsageMask usage_mask, |
502 blink::WebCryptoKey* key) { | 505 blink::WebCryptoKey* key) { |
503 // TODO(eroman): http://crbug.com/267888 | 506 // TODO(eroman): http://crbug.com/267888 |
504 return Status::ErrorUnsupported(); | 507 return Status::ErrorUnsupported(); |
505 } | 508 } |
506 | 509 |
507 bool ThreadSafeDeserializeKeyForClone( | |
508 const blink::WebCryptoKeyAlgorithm& algorithm, | |
509 blink::WebCryptoKeyType type, | |
510 bool extractable, | |
511 blink::WebCryptoKeyUsageMask usages, | |
512 const CryptoData& key_data, | |
513 blink::WebCryptoKey* key) { | |
514 // TODO(eroman): http://crbug.com/267888 | |
515 return false; | |
516 } | |
517 | |
518 } // namespace platform | 510 } // namespace platform |
519 | 511 |
520 } // namespace webcrypto | 512 } // namespace webcrypto |
521 | 513 |
522 } // namespace content | 514 } // namespace content |
OLD | NEW |