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

Side by Side Diff: content/child/webcrypto/platform_crypto_openssl.cc

Issue 233733004: [webcrypto] Make operations run on worker threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix argument ordering bug Created 6 years, 7 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 // 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
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 }
39 44
40 const std::vector<unsigned char>& key() const { return key_; } 45 const std::vector<unsigned char>& key() const { return key_; }
41 46
42 private: 47 private:
43 const std::vector<unsigned char> key_; 48 const std::vector<unsigned char> key_;
44 49
45 DISALLOW_COPY_AND_ASSIGN(SymKey); 50 DISALLOW_COPY_AND_ASSIGN(SymKey);
46 }; 51 };
47 52
48 namespace { 53 namespace {
(...skipping 27 matching lines...) Expand all
76 } 81 }
77 } 82 }
78 83
79 // OpenSSL constants for EVP_CipherInit_ex(), do not change 84 // OpenSSL constants for EVP_CipherInit_ex(), do not change
80 enum CipherOperation { kDoDecrypt = 0, kDoEncrypt = 1 }; 85 enum CipherOperation { kDoDecrypt = 0, kDoEncrypt = 1 };
81 86
82 Status AesCbcEncryptDecrypt(EncryptOrDecrypt mode, 87 Status AesCbcEncryptDecrypt(EncryptOrDecrypt mode,
83 SymKey* key, 88 SymKey* key,
84 const CryptoData& iv, 89 const CryptoData& iv,
85 const CryptoData& data, 90 const CryptoData& data,
86 blink::WebArrayBuffer* buffer) { 91 std::vector<uint8>* buffer) {
87 CipherOperation cipher_operation = 92 CipherOperation cipher_operation =
88 (mode == ENCRYPT) ? kDoEncrypt : kDoDecrypt; 93 (mode == ENCRYPT) ? kDoEncrypt : kDoDecrypt;
89 94
90 if (data.byte_length() >= INT_MAX - AES_BLOCK_SIZE) { 95 if (data.byte_length() >= INT_MAX - AES_BLOCK_SIZE) {
91 // TODO(padolph): Handle this by chunking the input fed into OpenSSL. Right 96 // TODO(padolph): Handle this by chunking the input fed into OpenSSL. Right
92 // now it doesn't make much difference since the one-shot API would end up 97 // now it doesn't make much difference since the one-shot API would end up
93 // blowing out the memory and crashing anyway. 98 // blowing out the memory and crashing anyway.
94 return Status::ErrorDataTooLarge(); 99 return Status::ErrorDataTooLarge();
95 } 100 }
96 101
(...skipping 18 matching lines...) Expand all
115 120
116 // According to the openssl docs, the amount of data written may be as large 121 // According to the openssl docs, the amount of data written may be as large
117 // as (data_size + cipher_block_size - 1), constrained to a multiple of 122 // as (data_size + cipher_block_size - 1), constrained to a multiple of
118 // cipher_block_size. 123 // cipher_block_size.
119 unsigned int output_max_len = data.byte_length() + AES_BLOCK_SIZE - 1; 124 unsigned int output_max_len = data.byte_length() + AES_BLOCK_SIZE - 1;
120 const unsigned remainder = output_max_len % AES_BLOCK_SIZE; 125 const unsigned remainder = output_max_len % AES_BLOCK_SIZE;
121 if (remainder != 0) 126 if (remainder != 0)
122 output_max_len += AES_BLOCK_SIZE - remainder; 127 output_max_len += AES_BLOCK_SIZE - remainder;
123 DCHECK_GT(output_max_len, data.byte_length()); 128 DCHECK_GT(output_max_len, data.byte_length());
124 129
125 *buffer = blink::WebArrayBuffer::create(output_max_len, 1); 130 buffer->resize(output_max_len);
126 131
127 unsigned char* const buffer_data = 132 unsigned char* const buffer_data = Uint8VectorStart(buffer);
128 reinterpret_cast<unsigned char*>(buffer->data());
129 133
130 int output_len = 0; 134 int output_len = 0;
131 if (!EVP_CipherUpdate(context.get(), 135 if (!EVP_CipherUpdate(context.get(),
132 buffer_data, 136 buffer_data,
133 &output_len, 137 &output_len,
134 data.bytes(), 138 data.bytes(),
135 data.byte_length())) 139 data.byte_length()))
136 return Status::OperationError(); 140 return Status::OperationError();
137 int final_output_chunk_len = 0; 141 int final_output_chunk_len = 0;
138 if (!EVP_CipherFinal_ex( 142 if (!EVP_CipherFinal_ex(
139 context.get(), buffer_data + output_len, &final_output_chunk_len)) { 143 context.get(), buffer_data + output_len, &final_output_chunk_len)) {
140 return Status::OperationError(); 144 return Status::OperationError();
141 } 145 }
142 146
143 const unsigned int final_output_len = 147 const unsigned int final_output_len =
144 static_cast<unsigned int>(output_len) + 148 static_cast<unsigned int>(output_len) +
145 static_cast<unsigned int>(final_output_chunk_len); 149 static_cast<unsigned int>(final_output_chunk_len);
146 DCHECK_LE(final_output_len, output_max_len); 150 DCHECK_LE(final_output_len, output_max_len);
147 151
148 ShrinkBuffer(buffer, final_output_len); 152 buffer->resize(final_output_len);
149 153
150 return Status::Success(); 154 return Status::Success();
151 } 155 }
152 156
153 } // namespace 157 } // namespace
154 158
155 class DigestorOpenSSL : public blink::WebCryptoDigestor { 159 class DigestorOpenSSL : public blink::WebCryptoDigestor {
156 public: 160 public:
157 explicit DigestorOpenSSL(blink::WebCryptoAlgorithmId algorithm_id) 161 explicit DigestorOpenSSL(blink::WebCryptoAlgorithmId algorithm_id)
158 : initialized_(false), 162 : initialized_(false),
(...skipping 18 matching lines...) Expand all
177 181
178 virtual bool finish(unsigned char*& result_data, 182 virtual bool finish(unsigned char*& result_data,
179 unsigned int& result_data_size) { 183 unsigned int& result_data_size) {
180 Status error = FinishInternal(result_, &result_data_size); 184 Status error = FinishInternal(result_, &result_data_size);
181 if (!error.IsSuccess()) 185 if (!error.IsSuccess())
182 return false; 186 return false;
183 result_data = result_; 187 result_data = result_;
184 return true; 188 return true;
185 } 189 }
186 190
187 Status FinishWithWebArrayAndStatus(blink::WebArrayBuffer* result) { 191 Status FinishWithVectorAndStatus(std::vector<uint8>* result) {
188 const int hash_expected_size = EVP_MD_CTX_size(digest_context_.get()); 192 const int hash_expected_size = EVP_MD_CTX_size(digest_context_.get());
189 *result = blink::WebArrayBuffer::create(hash_expected_size, 1); 193 result->resize(hash_expected_size);
190 unsigned char* const hash_buffer = 194 unsigned char* const hash_buffer = Uint8VectorStart(result);
191 static_cast<unsigned char* const>(result->data());
192 unsigned int hash_buffer_size; // ignored 195 unsigned int hash_buffer_size; // ignored
193 Status error = FinishInternal(hash_buffer, &hash_buffer_size); 196 return 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
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, blink::WebArrayBuffer* buffer) { 242 Status ExportKeyRaw(SymKey* key, std::vector<uint8>* buffer) {
243 *buffer = CreateArrayBuffer(Uint8VectorStart(key->key()), key->key().size()); 243 *buffer = key->key();
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 blink::WebArrayBuffer* buffer) { 253 std::vector<uint8>* 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 blink::WebArrayBuffer* buffer) { 260 std::vector<uint8>* 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.FinishWithWebArrayAndStatus(buffer); 265 return digestor.FinishWithVectorAndStatus(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
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 blink::WebArrayBuffer* buffer) { 338 std::vector<uint8>* buffer) {
339 blink::WebArrayBuffer result;
340
341 const EVP_MD* digest_algorithm = GetDigest(hash.id()); 339 const EVP_MD* digest_algorithm = GetDigest(hash.id());
342 if (!digest_algorithm) 340 if (!digest_algorithm)
343 return Status::ErrorUnsupported(); 341 return Status::ErrorUnsupported();
344 unsigned int hmac_expected_length = EVP_MD_size(digest_algorithm); 342 unsigned int hmac_expected_length = EVP_MD_size(digest_algorithm);
345 343
346 const std::vector<unsigned char>& raw_key = key->key(); 344 const std::vector<unsigned char>& raw_key = key->key();
347 345
348 // OpenSSL wierdness here. 346 // OpenSSL wierdness here.
349 // First, HMAC() needs a void* for the key data, so make one up front as a 347 // First, HMAC() needs a void* for the key data, so make one up front as a
350 // cosmetic to avoid a cast. Second, OpenSSL does not like a NULL key, 348 // cosmetic to avoid a cast. Second, OpenSSL does not like a NULL key,
351 // which will result if the raw_key vector is empty; an entirely valid 349 // which will result if the raw_key vector is empty; an entirely valid
352 // case. Handle this specific case by pointing to an empty array. 350 // case. Handle this specific case by pointing to an empty array.
353 const unsigned char null_key[] = {}; 351 const unsigned char null_key[] = {};
354 const void* const raw_key_voidp = raw_key.size() ? &raw_key[0] : null_key; 352 const void* const raw_key_voidp = raw_key.size() ? &raw_key[0] : null_key;
355 353
356 result = blink::WebArrayBuffer::create(hmac_expected_length, 1); 354 buffer->resize(hmac_expected_length);
357 crypto::ScopedOpenSSLSafeSizeBuffer<EVP_MAX_MD_SIZE> hmac_result( 355 crypto::ScopedOpenSSLSafeSizeBuffer<EVP_MAX_MD_SIZE> hmac_result(
358 reinterpret_cast<unsigned char*>(result.data()), hmac_expected_length); 356 Uint8VectorStart(buffer), hmac_expected_length);
359 357
360 crypto::OpenSSLErrStackTracer(FROM_HERE); 358 crypto::OpenSSLErrStackTracer(FROM_HERE);
361 359
362 unsigned int hmac_actual_length; 360 unsigned int hmac_actual_length;
363 unsigned char* const success = HMAC(digest_algorithm, 361 unsigned char* const success = HMAC(digest_algorithm,
364 raw_key_voidp, 362 raw_key_voidp,
365 raw_key.size(), 363 raw_key.size(),
366 data.bytes(), 364 data.bytes(),
367 data.byte_length(), 365 data.byte_length(),
368 hmac_result.safe_buffer(), 366 hmac_result.safe_buffer(),
369 &hmac_actual_length); 367 &hmac_actual_length);
370 if (!success || hmac_actual_length != hmac_expected_length) 368 if (!success || hmac_actual_length != hmac_expected_length)
371 return Status::OperationError(); 369 return Status::OperationError();
372 370
373 *buffer = result;
374 return Status::Success(); 371 return Status::Success();
375 } 372 }
376 373
377 Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm, 374 Status ImportRsaPublicKey(const blink::WebCryptoAlgorithm& algorithm,
378 bool extractable, 375 bool extractable,
379 blink::WebCryptoKeyUsageMask usage_mask, 376 blink::WebCryptoKeyUsageMask usage_mask,
380 const CryptoData& modulus_data, 377 const CryptoData& modulus_data,
381 const CryptoData& exponent_data, 378 const CryptoData& exponent_data,
382 blink::WebCryptoKey* key) { 379 blink::WebCryptoKey* key) {
383 // TODO(padolph): Placeholder for OpenSSL implementation. 380 // TODO(padolph): Placeholder for OpenSSL implementation.
384 // Issue 381 // Issue
385 return Status::ErrorUnsupported(); 382 return Status::ErrorUnsupported();
386 } 383 }
387 384
388 Status EncryptDecryptAesGcm(EncryptOrDecrypt mode, 385 Status EncryptDecryptAesGcm(EncryptOrDecrypt mode,
389 SymKey* key, 386 SymKey* key,
390 const CryptoData& data, 387 const CryptoData& data,
391 const CryptoData& iv, 388 const CryptoData& iv,
392 const CryptoData& additional_data, 389 const CryptoData& additional_data,
393 unsigned int tag_length_bits, 390 unsigned int tag_length_bits,
394 blink::WebArrayBuffer* buffer) { 391 std::vector<uint8>* buffer) {
395 // TODO(eroman): http://crbug.com/267888 392 // TODO(eroman): http://crbug.com/267888
396 return Status::ErrorUnsupported(); 393 return Status::ErrorUnsupported();
397 } 394 }
398 395
399 // Guaranteed that key is valid. 396 // Guaranteed that key is valid.
400 Status EncryptRsaEsPkcs1v1_5(PublicKey* key, 397 Status EncryptRsaEsPkcs1v1_5(PublicKey* key,
401 const CryptoData& data, 398 const CryptoData& data,
402 blink::WebArrayBuffer* buffer) { 399 std::vector<uint8>* buffer) {
403 // TODO(eroman): http://crbug.com/267888 400 // TODO(eroman): http://crbug.com/267888
404 return Status::ErrorUnsupported(); 401 return Status::ErrorUnsupported();
405 } 402 }
406 403
407 Status DecryptRsaEsPkcs1v1_5(PrivateKey* key, 404 Status DecryptRsaEsPkcs1v1_5(PrivateKey* key,
408 const CryptoData& data, 405 const CryptoData& data,
409 blink::WebArrayBuffer* buffer) { 406 std::vector<uint8>* buffer) {
410 // TODO(eroman): http://crbug.com/267888 407 // TODO(eroman): http://crbug.com/267888
411 return Status::ErrorUnsupported(); 408 return Status::ErrorUnsupported();
412 } 409 }
413 410
414 Status SignRsaSsaPkcs1v1_5(PrivateKey* key, 411 Status SignRsaSsaPkcs1v1_5(PrivateKey* key,
415 const blink::WebCryptoAlgorithm& hash, 412 const blink::WebCryptoAlgorithm& hash,
416 const CryptoData& data, 413 const CryptoData& data,
417 blink::WebArrayBuffer* buffer) { 414 std::vector<uint8>* buffer) {
418 // TODO(eroman): http://crbug.com/267888 415 // TODO(eroman): http://crbug.com/267888
419 return Status::ErrorUnsupported(); 416 return Status::ErrorUnsupported();
420 } 417 }
421 418
422 // Key is guaranteed to be an RSA SSA key. 419 // Key is guaranteed to be an RSA SSA key.
423 Status VerifyRsaSsaPkcs1v1_5(PublicKey* key, 420 Status VerifyRsaSsaPkcs1v1_5(PublicKey* key,
424 const blink::WebCryptoAlgorithm& hash, 421 const blink::WebCryptoAlgorithm& hash,
425 const CryptoData& signature, 422 const CryptoData& signature,
426 const CryptoData& data, 423 const CryptoData& data,
427 bool* signature_match) { 424 bool* signature_match) {
(...skipping 12 matching lines...) Expand all
440 437
441 Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm, 438 Status ImportKeyPkcs8(const blink::WebCryptoAlgorithm& algorithm,
442 const CryptoData& key_data, 439 const CryptoData& key_data,
443 bool extractable, 440 bool extractable,
444 blink::WebCryptoKeyUsageMask usage_mask, 441 blink::WebCryptoKeyUsageMask usage_mask,
445 blink::WebCryptoKey* key) { 442 blink::WebCryptoKey* key) {
446 // TODO(eroman): http://crbug.com/267888 443 // TODO(eroman): http://crbug.com/267888
447 return Status::ErrorUnsupported(); 444 return Status::ErrorUnsupported();
448 } 445 }
449 446
450 Status ExportKeySpki(PublicKey* key, blink::WebArrayBuffer* buffer) { 447 Status ExportKeySpki(PublicKey* key, std::vector<uint8>* buffer) {
451 // TODO(eroman): http://crbug.com/267888 448 // TODO(eroman): http://crbug.com/267888
452 return Status::ErrorUnsupported(); 449 return Status::ErrorUnsupported();
453 } 450 }
454 451
455 Status ExportKeyPkcs8(PrivateKey* key, 452 Status ExportKeyPkcs8(PrivateKey* key,
456 const blink::WebCryptoKeyAlgorithm& key_algorithm, 453 const blink::WebCryptoKeyAlgorithm& key_algorithm,
457 blink::WebArrayBuffer* buffer) { 454 std::vector<uint8>* buffer) {
458 // TODO(eroman): http://crbug.com/267888 455 // TODO(eroman): http://crbug.com/267888
459 return Status::ErrorUnsupported(); 456 return Status::ErrorUnsupported();
460 } 457 }
461 458
462 Status ExportRsaPublicKey(PublicKey* key, 459 Status ExportRsaPublicKey(PublicKey* key,
463 std::vector<uint8>* modulus, 460 std::vector<uint8>* modulus,
464 std::vector<uint8>* public_exponent) { 461 std::vector<uint8>* public_exponent) {
465 // TODO(eroman): http://crbug.com/267888 462 // TODO(eroman): http://crbug.com/267888
466 return Status::ErrorUnsupported(); 463 return Status::ErrorUnsupported();
467 } 464 }
468 465
469 Status WrapSymKeyAesKw(SymKey* wrapping_key, 466 Status WrapSymKeyAesKw(SymKey* wrapping_key,
470 SymKey* key, 467 SymKey* key,
471 blink::WebArrayBuffer* buffer) { 468 std::vector<uint8>* buffer) {
472 // TODO(eroman): http://crbug.com/267888 469 // TODO(eroman): http://crbug.com/267888
473 return Status::ErrorUnsupported(); 470 return Status::ErrorUnsupported();
474 } 471 }
475 472
476 Status UnwrapSymKeyAesKw(const CryptoData& wrapped_key_data, 473 Status UnwrapSymKeyAesKw(const CryptoData& wrapped_key_data,
477 SymKey* wrapping_key, 474 SymKey* wrapping_key,
478 const blink::WebCryptoAlgorithm& algorithm, 475 const blink::WebCryptoAlgorithm& algorithm,
479 bool extractable, 476 bool extractable,
480 blink::WebCryptoKeyUsageMask usage_mask, 477 blink::WebCryptoKeyUsageMask usage_mask,
481 blink::WebCryptoKey* key) { 478 blink::WebCryptoKey* key) {
482 // TODO(eroman): http://crbug.com/267888 479 // TODO(eroman): http://crbug.com/267888
483 return Status::ErrorUnsupported(); 480 return Status::ErrorUnsupported();
484 } 481 }
485 482
486 Status DecryptAesKw(SymKey* key, 483 Status DecryptAesKw(SymKey* key,
487 const CryptoData& data, 484 const CryptoData& data,
488 blink::WebArrayBuffer* buffer) { 485 std::vector<uint8>* buffer) {
489 // TODO(eroman): http://crbug.com/267888 486 // TODO(eroman): http://crbug.com/267888
490 return Status::ErrorUnsupported(); 487 return Status::ErrorUnsupported();
491 } 488 }
492 489
493 Status WrapSymKeyRsaEs(PublicKey* wrapping_key, 490 Status WrapSymKeyRsaEs(PublicKey* wrapping_key,
494 SymKey* key, 491 SymKey* key,
495 blink::WebArrayBuffer* buffer) { 492 std::vector<uint8>* buffer) {
496 // TODO(eroman): http://crbug.com/267888 493 // TODO(eroman): http://crbug.com/267888
497 return Status::ErrorUnsupported(); 494 return Status::ErrorUnsupported();
498 } 495 }
499 496
500 Status UnwrapSymKeyRsaEs(const CryptoData& wrapped_key_data, 497 Status UnwrapSymKeyRsaEs(const CryptoData& wrapped_key_data,
501 PrivateKey* wrapping_key, 498 PrivateKey* wrapping_key,
502 const blink::WebCryptoAlgorithm& algorithm, 499 const blink::WebCryptoAlgorithm& algorithm,
503 bool extractable, 500 bool extractable,
504 blink::WebCryptoKeyUsageMask usage_mask, 501 blink::WebCryptoKeyUsageMask usage_mask,
505 blink::WebCryptoKey* key) { 502 blink::WebCryptoKey* key) {
506 // TODO(eroman): http://crbug.com/267888 503 // TODO(eroman): http://crbug.com/267888
507 return Status::ErrorUnsupported(); 504 return Status::ErrorUnsupported();
508 } 505 }
509 506
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
510 } // namespace platform 518 } // namespace platform
511 519
512 } // namespace webcrypto 520 } // namespace webcrypto
513 521
514 } // namespace content 522 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698