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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 }; | 62 }; |
63 | 63 |
64 // The order of this array is the same order that will appear in Key.usages. It | 64 // The order of this array is the same order that will appear in Key.usages. It |
65 // must be kept ordered as described by the Web Crypto spec. | 65 // must be kept ordered as described by the Web Crypto spec. |
66 const KeyUsageMapping keyUsageMappings[] = { | 66 const KeyUsageMapping keyUsageMappings[] = { |
67 { blink::WebCryptoKeyUsageEncrypt, "encrypt" }, | 67 { blink::WebCryptoKeyUsageEncrypt, "encrypt" }, |
68 { blink::WebCryptoKeyUsageDecrypt, "decrypt" }, | 68 { blink::WebCryptoKeyUsageDecrypt, "decrypt" }, |
69 { blink::WebCryptoKeyUsageSign, "sign" }, | 69 { blink::WebCryptoKeyUsageSign, "sign" }, |
70 { blink::WebCryptoKeyUsageVerify, "verify" }, | 70 { blink::WebCryptoKeyUsageVerify, "verify" }, |
71 { blink::WebCryptoKeyUsageDeriveKey, "deriveKey" }, | 71 { blink::WebCryptoKeyUsageDeriveKey, "deriveKey" }, |
| 72 { blink::WebCryptoKeyUsageDeriveBits, "deriveBits" }, |
72 { blink::WebCryptoKeyUsageWrapKey, "wrapKey" }, | 73 { blink::WebCryptoKeyUsageWrapKey, "wrapKey" }, |
73 { blink::WebCryptoKeyUsageUnwrapKey, "unwrapKey" }, | 74 { blink::WebCryptoKeyUsageUnwrapKey, "unwrapKey" }, |
74 }; | 75 }; |
75 | 76 |
76 COMPILE_ASSERT(blink::EndOfWebCryptoKeyUsage == (1 << 6) + 1, update_keyUsageMap
pings); | 77 COMPILE_ASSERT(blink::EndOfWebCryptoKeyUsage == (1 << 7) + 1, update_keyUsageMap
pings); |
77 | 78 |
78 const char* keyUsageToString(blink::WebCryptoKeyUsage usage) | 79 const char* keyUsageToString(blink::WebCryptoKeyUsage usage) |
79 { | 80 { |
80 for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyUsageMappings); ++i) { | 81 for (size_t i = 0; i < WTF_ARRAY_LENGTH(keyUsageMappings); ++i) { |
81 if (keyUsageMappings[i].value == usage) | 82 if (keyUsageMappings[i].value == usage) |
82 return keyUsageMappings[i].name; | 83 return keyUsageMappings[i].name; |
83 } | 84 } |
84 ASSERT_NOT_REACHED(); | 85 ASSERT_NOT_REACHED(); |
85 return 0; | 86 return 0; |
86 } | 87 } |
(...skipping 13 matching lines...) Expand all Loading... |
100 case Encrypt: | 101 case Encrypt: |
101 return blink::WebCryptoKeyUsageEncrypt; | 102 return blink::WebCryptoKeyUsageEncrypt; |
102 case Decrypt: | 103 case Decrypt: |
103 return blink::WebCryptoKeyUsageDecrypt; | 104 return blink::WebCryptoKeyUsageDecrypt; |
104 case Sign: | 105 case Sign: |
105 return blink::WebCryptoKeyUsageSign; | 106 return blink::WebCryptoKeyUsageSign; |
106 case Verify: | 107 case Verify: |
107 return blink::WebCryptoKeyUsageVerify; | 108 return blink::WebCryptoKeyUsageVerify; |
108 case DeriveKey: | 109 case DeriveKey: |
109 return blink::WebCryptoKeyUsageDeriveKey; | 110 return blink::WebCryptoKeyUsageDeriveKey; |
| 111 case DeriveBits: |
| 112 return blink::WebCryptoKeyUsageDeriveBits; |
110 case WrapKey: | 113 case WrapKey: |
111 return blink::WebCryptoKeyUsageWrapKey; | 114 return blink::WebCryptoKeyUsageWrapKey; |
112 case UnwrapKey: | 115 case UnwrapKey: |
113 return blink::WebCryptoKeyUsageUnwrapKey; | 116 return blink::WebCryptoKeyUsageUnwrapKey; |
114 case Digest: | 117 case Digest: |
115 case GenerateKey: | 118 case GenerateKey: |
116 case ImportKey: | 119 case ImportKey: |
117 break; | 120 break; |
118 } | 121 } |
119 | 122 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 220 } |
218 return true; | 221 return true; |
219 } | 222 } |
220 | 223 |
221 void Key::trace(Visitor* visitor) | 224 void Key::trace(Visitor* visitor) |
222 { | 225 { |
223 visitor->trace(m_algorithm); | 226 visitor->trace(m_algorithm); |
224 } | 227 } |
225 | 228 |
226 } // namespace WebCore | 229 } // namespace WebCore |
OLD | NEW |