| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 RsaSsaPkcs1v1_5Tag = 3, | 268 RsaSsaPkcs1v1_5Tag = 3, |
| 269 // ID 4 was used by RsaEs, while still behind experimental flag. | 269 // ID 4 was used by RsaEs, while still behind experimental flag. |
| 270 Sha1Tag = 5, | 270 Sha1Tag = 5, |
| 271 Sha256Tag = 6, | 271 Sha256Tag = 6, |
| 272 Sha384Tag = 7, | 272 Sha384Tag = 7, |
| 273 Sha512Tag = 8, | 273 Sha512Tag = 8, |
| 274 AesGcmTag = 9, | 274 AesGcmTag = 9, |
| 275 RsaOaepTag = 10, | 275 RsaOaepTag = 10, |
| 276 AesCtrTag = 11, | 276 AesCtrTag = 11, |
| 277 AesKwTag = 12, | 277 AesKwTag = 12, |
| 278 RsaPssTag = 13, |
| 278 // Maximum allowed value is 2^32-1 | 279 // Maximum allowed value is 2^32-1 |
| 279 }; | 280 }; |
| 280 | 281 |
| 281 enum CryptoKeyUsage { | 282 enum CryptoKeyUsage { |
| 282 // Extractability is not a "usage" in the WebCryptoKeyUsages sense, however | 283 // Extractability is not a "usage" in the WebCryptoKeyUsages sense, however |
| 283 // it fits conveniently into this bitfield. | 284 // it fits conveniently into this bitfield. |
| 284 ExtractableUsage = 1 << 0, | 285 ExtractableUsage = 1 << 0, |
| 285 | 286 |
| 286 EncryptUsage = 1 << 1, | 287 EncryptUsage = 1 << 1, |
| 287 DecryptUsage = 1 << 2, | 288 DecryptUsage = 1 << 2, |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 case blink::WebCryptoAlgorithmIdSha512: | 773 case blink::WebCryptoAlgorithmIdSha512: |
| 773 return doWriteUint32(Sha512Tag); | 774 return doWriteUint32(Sha512Tag); |
| 774 case blink::WebCryptoAlgorithmIdAesGcm: | 775 case blink::WebCryptoAlgorithmIdAesGcm: |
| 775 return doWriteUint32(AesGcmTag); | 776 return doWriteUint32(AesGcmTag); |
| 776 case blink::WebCryptoAlgorithmIdRsaOaep: | 777 case blink::WebCryptoAlgorithmIdRsaOaep: |
| 777 return doWriteUint32(RsaOaepTag); | 778 return doWriteUint32(RsaOaepTag); |
| 778 case blink::WebCryptoAlgorithmIdAesCtr: | 779 case blink::WebCryptoAlgorithmIdAesCtr: |
| 779 return doWriteUint32(AesCtrTag); | 780 return doWriteUint32(AesCtrTag); |
| 780 case blink::WebCryptoAlgorithmIdAesKw: | 781 case blink::WebCryptoAlgorithmIdAesKw: |
| 781 return doWriteUint32(AesKwTag); | 782 return doWriteUint32(AesKwTag); |
| 783 case blink::WebCryptoAlgorithmIdRsaPss: |
| 784 return doWriteUint32(RsaPssTag); |
| 782 } | 785 } |
| 783 ASSERT_NOT_REACHED(); | 786 ASSERT_NOT_REACHED(); |
| 784 } | 787 } |
| 785 | 788 |
| 786 void doWriteKeyUsages(const blink::WebCryptoKeyUsageMask usages, bool extrac
table) | 789 void doWriteKeyUsages(const blink::WebCryptoKeyUsageMask usages, bool extrac
table) |
| 787 { | 790 { |
| 788 // Reminder to update this when adding new key usages. | 791 // Reminder to update this when adding new key usages. |
| 789 COMPILE_ASSERT(blink::EndOfWebCryptoKeyUsage == (1 << 7) + 1, UpdateMe); | 792 COMPILE_ASSERT(blink::EndOfWebCryptoKeyUsage == (1 << 7) + 1, UpdateMe); |
| 790 | 793 |
| 791 uint32_t value = 0; | 794 uint32_t value = 0; |
| (...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2495 return true; | 2498 return true; |
| 2496 case RsaOaepTag: | 2499 case RsaOaepTag: |
| 2497 id = blink::WebCryptoAlgorithmIdRsaOaep; | 2500 id = blink::WebCryptoAlgorithmIdRsaOaep; |
| 2498 return true; | 2501 return true; |
| 2499 case AesCtrTag: | 2502 case AesCtrTag: |
| 2500 id = blink::WebCryptoAlgorithmIdAesCtr; | 2503 id = blink::WebCryptoAlgorithmIdAesCtr; |
| 2501 return true; | 2504 return true; |
| 2502 case AesKwTag: | 2505 case AesKwTag: |
| 2503 id = blink::WebCryptoAlgorithmIdAesKw; | 2506 id = blink::WebCryptoAlgorithmIdAesKw; |
| 2504 return true; | 2507 return true; |
| 2508 case RsaPssTag: |
| 2509 id = blink::WebCryptoAlgorithmIdRsaPss; |
| 2510 return true; |
| 2505 } | 2511 } |
| 2506 | 2512 |
| 2507 return false; | 2513 return false; |
| 2508 } | 2514 } |
| 2509 | 2515 |
| 2510 bool doReadKeyUsages(blink::WebCryptoKeyUsageMask& usages, bool& extractable
) | 2516 bool doReadKeyUsages(blink::WebCryptoKeyUsageMask& usages, bool& extractable
) |
| 2511 { | 2517 { |
| 2512 // Reminder to update this when adding new key usages. | 2518 // Reminder to update this when adding new key usages. |
| 2513 COMPILE_ASSERT(blink::EndOfWebCryptoKeyUsage == (1 << 7) + 1, UpdateMe); | 2519 COMPILE_ASSERT(blink::EndOfWebCryptoKeyUsage == (1 << 7) + 1, UpdateMe); |
| 2514 const uint32_t allPossibleUsages = ExtractableUsage | EncryptUsage | Dec
ryptUsage | SignUsage | VerifyUsage | DeriveKeyUsage | WrapKeyUsage | UnwrapKeyU
sage | DeriveBitsUsage; | 2520 const uint32_t allPossibleUsages = ExtractableUsage | EncryptUsage | Dec
ryptUsage | SignUsage | VerifyUsage | DeriveKeyUsage | WrapKeyUsage | UnwrapKeyU
sage | DeriveBitsUsage; |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3063 // If the allocated memory was not registered before, then this class is lik
ely | 3069 // If the allocated memory was not registered before, then this class is lik
ely |
| 3064 // used in a context other then Worker's onmessage environment and the prese
nce of | 3070 // used in a context other then Worker's onmessage environment and the prese
nce of |
| 3065 // current v8 context is not guaranteed. Avoid calling v8 then. | 3071 // current v8 context is not guaranteed. Avoid calling v8 then. |
| 3066 if (m_externallyAllocatedMemory) { | 3072 if (m_externallyAllocatedMemory) { |
| 3067 ASSERT(v8::Isolate::GetCurrent()); | 3073 ASSERT(v8::Isolate::GetCurrent()); |
| 3068 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 3074 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
| 3069 } | 3075 } |
| 3070 } | 3076 } |
| 3071 | 3077 |
| 3072 } // namespace blink | 3078 } // namespace blink |
| OLD | NEW |