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 "config.h" | 5 #include "config.h" |
6 #include "bindings/modules/v8/ScriptValueSerializerForModules.h" | 6 #include "bindings/modules/v8/ScriptValueSerializerForModules.h" |
7 | 7 |
8 #include "bindings/core/v8/SerializationTag.h" | 8 #include "bindings/core/v8/SerializationTag.h" |
9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
10 #include "bindings/modules/v8/V8CryptoKey.h" | 10 #include "bindings/modules/v8/V8CryptoKey.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 Sha384Tag = 7, | 24 Sha384Tag = 7, |
25 Sha512Tag = 8, | 25 Sha512Tag = 8, |
26 AesGcmTag = 9, | 26 AesGcmTag = 9, |
27 RsaOaepTag = 10, | 27 RsaOaepTag = 10, |
28 AesCtrTag = 11, | 28 AesCtrTag = 11, |
29 AesKwTag = 12, | 29 AesKwTag = 12, |
30 RsaPssTag = 13, | 30 RsaPssTag = 13, |
31 EcdsaTag = 14, | 31 EcdsaTag = 14, |
32 EcdhTag = 15, | 32 EcdhTag = 15, |
33 HkdfTag = 16, | 33 HkdfTag = 16, |
| 34 Pbkdf2Tag = 17, |
34 // Maximum allowed value is 2^32-1 | 35 // Maximum allowed value is 2^32-1 |
35 }; | 36 }; |
36 | 37 |
37 enum NamedCurveTag { | 38 enum NamedCurveTag { |
38 P256Tag = 1, | 39 P256Tag = 1, |
39 P384Tag = 2, | 40 P384Tag = 2, |
40 P521Tag = 3, | 41 P521Tag = 3, |
41 }; | 42 }; |
42 | 43 |
43 enum CryptoKeyUsage { | 44 enum CryptoKeyUsage { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 case WebCryptoAlgorithmIdAesKw: | 221 case WebCryptoAlgorithmIdAesKw: |
221 return doWriteUint32(AesKwTag); | 222 return doWriteUint32(AesKwTag); |
222 case WebCryptoAlgorithmIdRsaPss: | 223 case WebCryptoAlgorithmIdRsaPss: |
223 return doWriteUint32(RsaPssTag); | 224 return doWriteUint32(RsaPssTag); |
224 case WebCryptoAlgorithmIdEcdsa: | 225 case WebCryptoAlgorithmIdEcdsa: |
225 return doWriteUint32(EcdsaTag); | 226 return doWriteUint32(EcdsaTag); |
226 case WebCryptoAlgorithmIdEcdh: | 227 case WebCryptoAlgorithmIdEcdh: |
227 return doWriteUint32(EcdhTag); | 228 return doWriteUint32(EcdhTag); |
228 case WebCryptoAlgorithmIdHkdf: | 229 case WebCryptoAlgorithmIdHkdf: |
229 return doWriteUint32(HkdfTag); | 230 return doWriteUint32(HkdfTag); |
| 231 case WebCryptoAlgorithmIdPbkdf2: |
| 232 return doWriteUint32(Pbkdf2Tag); |
230 } | 233 } |
231 ASSERT_NOT_REACHED(); | 234 ASSERT_NOT_REACHED(); |
232 } | 235 } |
233 | 236 |
234 void SerializedScriptValueWriterForModules::doWriteAsymmetricKeyType(WebCryptoKe
yType keyType) | 237 void SerializedScriptValueWriterForModules::doWriteAsymmetricKeyType(WebCryptoKe
yType keyType) |
235 { | 238 { |
236 switch (keyType) { | 239 switch (keyType) { |
237 case WebCryptoKeyTypePublic: | 240 case WebCryptoKeyTypePublic: |
238 doWriteUint32(PublicKeyType); | 241 doWriteUint32(PublicKeyType); |
239 break; | 242 break; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 return true; | 532 return true; |
530 case EcdsaTag: | 533 case EcdsaTag: |
531 id = WebCryptoAlgorithmIdEcdsa; | 534 id = WebCryptoAlgorithmIdEcdsa; |
532 return true; | 535 return true; |
533 case EcdhTag: | 536 case EcdhTag: |
534 id = WebCryptoAlgorithmIdEcdh; | 537 id = WebCryptoAlgorithmIdEcdh; |
535 return true; | 538 return true; |
536 case HkdfTag: | 539 case HkdfTag: |
537 id = WebCryptoAlgorithmIdHkdf; | 540 id = WebCryptoAlgorithmIdHkdf; |
538 return true; | 541 return true; |
| 542 case Pbkdf2Tag: |
| 543 id = WebCryptoAlgorithmIdPbkdf2; |
| 544 return true; |
539 } | 545 } |
540 | 546 |
541 return false; | 547 return false; |
542 } | 548 } |
543 | 549 |
544 bool SerializedScriptValueReaderForModules::doReadAsymmetricKeyType(WebCryptoKey
Type& type) | 550 bool SerializedScriptValueReaderForModules::doReadAsymmetricKeyType(WebCryptoKey
Type& type) |
545 { | 551 { |
546 uint32_t rawType; | 552 uint32_t rawType; |
547 if (!doReadUint32(&rawType)) | 553 if (!doReadUint32(&rawType)) |
548 return false; | 554 return false; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 : ScriptValueDeserializer(reader, messagePorts, arrayBufferContents) | 628 : ScriptValueDeserializer(reader, messagePorts, arrayBufferContents) |
623 { | 629 { |
624 } | 630 } |
625 | 631 |
626 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) | 632 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) |
627 { | 633 { |
628 return toSerializedScriptValueReaderForModules(reader()).read(value, *this); | 634 return toSerializedScriptValueReaderForModules(reader()).read(value, *this); |
629 } | 635 } |
630 | 636 |
631 } // namespace blink | 637 } // namespace blink |
OLD | NEW |