| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 if (!baseKey->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDeriveBits,
result.get())) | 388 if (!baseKey->canBeUsedForAlgorithm(algorithm, WebCryptoKeyUsageDeriveBits,
result.get())) |
| 389 return promise; | 389 return promise; |
| 390 | 390 |
| 391 histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, baseKey
->key()); | 391 histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, baseKey
->key()); |
| 392 Platform::current()->crypto()->deriveBits(algorithm, baseKey->key(), lengthB
its, result->result()); | 392 Platform::current()->crypto()->deriveBits(algorithm, baseKey->key(), lengthB
its, result->result()); |
| 393 return promise; | 393 return promise; |
| 394 } | 394 } |
| 395 | 395 |
| 396 ScriptPromise SubtleCrypto::deriveKey(ScriptState* scriptState, const AlgorithmI
dentifier& rawAlgorithm, CryptoKey* baseKey, const AlgorithmIdentifier& rawDeriv
edKeyType, bool extractable, const Vector<String>& rawKeyUsages) | 396 ScriptPromise SubtleCrypto::deriveKey(ScriptState* scriptState, const AlgorithmI
dentifier& rawAlgorithm, CryptoKey* baseKey, const AlgorithmIdentifier& rawDeriv
edKeyType, bool extractable, const Vector<String>& rawKeyUsages) |
| 397 { | 397 { |
| 398 RefPtr<CryptoResultImpl> result = CryptoResultImpl::create(scriptState); | 398 RefPtrWillBeRawPtr<CryptoResultImpl> result = CryptoResultImpl::create(scrip
tState); |
| 399 ScriptPromise promise = result->promise(); | 399 ScriptPromise promise = result->promise(); |
| 400 | 400 |
| 401 if (!canAccessWebCrypto(scriptState, result.get())) | 401 if (!canAccessWebCrypto(scriptState, result.get())) |
| 402 return promise; | 402 return promise; |
| 403 | 403 |
| 404 WebCryptoKeyUsageMask keyUsages; | 404 WebCryptoKeyUsageMask keyUsages; |
| 405 if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get())) | 405 if (!CryptoKey::parseUsageMask(rawKeyUsages, keyUsages, result.get())) |
| 406 return promise; | 406 return promise; |
| 407 | 407 |
| 408 WebCryptoAlgorithm algorithm; | 408 WebCryptoAlgorithm algorithm; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 420 if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationGetKeyLength, keyLe
ngthAlgorithm, result.get())) | 420 if (!parseAlgorithm(rawDerivedKeyType, WebCryptoOperationGetKeyLength, keyLe
ngthAlgorithm, result.get())) |
| 421 return promise; | 421 return promise; |
| 422 | 422 |
| 423 histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, baseKey
->key()); | 423 histogramAlgorithmAndKey(scriptState->executionContext(), algorithm, baseKey
->key()); |
| 424 histogramAlgorithm(scriptState->executionContext(), importAlgorithm); | 424 histogramAlgorithm(scriptState->executionContext(), importAlgorithm); |
| 425 Platform::current()->crypto()->deriveKey(algorithm, baseKey->key(), importAl
gorithm, keyLengthAlgorithm, extractable, keyUsages, result->result()); | 425 Platform::current()->crypto()->deriveKey(algorithm, baseKey->key(), importAl
gorithm, keyLengthAlgorithm, extractable, keyUsages, result->result()); |
| 426 return promise; | 426 return promise; |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace blink | 429 } // namespace blink |
| OLD | NEW |