| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const AlgorithmNameMapping algorithmNameMappings[] = { | 65 const AlgorithmNameMapping algorithmNameMappings[] = { |
| 66 {"HMAC", 4, blink::WebCryptoAlgorithmIdHmac}, | 66 {"HMAC", 4, blink::WebCryptoAlgorithmIdHmac}, |
| 67 {"SHA-1", 5, blink::WebCryptoAlgorithmIdSha1}, | 67 {"SHA-1", 5, blink::WebCryptoAlgorithmIdSha1}, |
| 68 {"AES-KW", 6, blink::WebCryptoAlgorithmIdAesKw}, | 68 {"AES-KW", 6, blink::WebCryptoAlgorithmIdAesKw}, |
| 69 {"SHA-512", 7, blink::WebCryptoAlgorithmIdSha512}, | 69 {"SHA-512", 7, blink::WebCryptoAlgorithmIdSha512}, |
| 70 {"SHA-384", 7, blink::WebCryptoAlgorithmIdSha384}, | 70 {"SHA-384", 7, blink::WebCryptoAlgorithmIdSha384}, |
| 71 {"SHA-256", 7, blink::WebCryptoAlgorithmIdSha256}, | 71 {"SHA-256", 7, blink::WebCryptoAlgorithmIdSha256}, |
| 72 {"AES-CBC", 7, blink::WebCryptoAlgorithmIdAesCbc}, | 72 {"AES-CBC", 7, blink::WebCryptoAlgorithmIdAesCbc}, |
| 73 {"AES-GCM", 7, blink::WebCryptoAlgorithmIdAesGcm}, | 73 {"AES-GCM", 7, blink::WebCryptoAlgorithmIdAesGcm}, |
| 74 {"AES-CTR", 7, blink::WebCryptoAlgorithmIdAesCtr}, | 74 {"AES-CTR", 7, blink::WebCryptoAlgorithmIdAesCtr}, |
| 75 {"RSAES-PKCS1-V1_5", 16, blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5}, | |
| 76 {"RSASSA-PKCS1-V1_5", 17, blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5}, | 75 {"RSASSA-PKCS1-V1_5", 17, blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5}, |
| 77 }; | 76 }; |
| 78 | 77 |
| 79 typedef char ParamsTypeOrUndefined; | 78 typedef char ParamsTypeOrUndefined; |
| 80 const ParamsTypeOrUndefined Undefined = -1; | 79 const ParamsTypeOrUndefined Undefined = -1; |
| 81 | 80 |
| 82 struct AlgorithmInfo { | 81 struct AlgorithmInfo { |
| 83 // The canonical (case-sensitive) name for the algorithm. | 82 // The canonical (case-sensitive) name for the algorithm. |
| 84 const char* name; | 83 const char* name; |
| 85 | 84 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 blink::WebCryptoAlgorithmParamsTypeNone, // Verify | 125 blink::WebCryptoAlgorithmParamsTypeNone, // Verify |
| 127 Undefined, // Digest | 126 Undefined, // Digest |
| 128 blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, // Generat
eKey | 127 blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams, // Generat
eKey |
| 129 blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams, // ImportK
ey | 128 blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams, // ImportK
ey |
| 130 Undefined, // DeriveKey | 129 Undefined, // DeriveKey |
| 131 Undefined, // DeriveBits | 130 Undefined, // DeriveBits |
| 132 Undefined, // WrapKey | 131 Undefined, // WrapKey |
| 133 Undefined // UnwrapKey | 132 Undefined // UnwrapKey |
| 134 } | 133 } |
| 135 }, { // Index 3 | 134 }, { // Index 3 |
| 136 "RSAES-PKCS1-v1_5", { | |
| 137 blink::WebCryptoAlgorithmParamsTypeNone, // Encrypt | |
| 138 blink::WebCryptoAlgorithmParamsTypeNone, // Decrypt | |
| 139 Undefined, // Sign | |
| 140 Undefined, // Verify | |
| 141 Undefined, // Digest | |
| 142 blink::WebCryptoAlgorithmParamsTypeRsaKeyGenParams, // GenerateKey | |
| 143 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey | |
| 144 Undefined, // DeriveKey | |
| 145 Undefined, // DeriveBits | |
| 146 blink::WebCryptoAlgorithmParamsTypeNone, // WrapKey | |
| 147 blink::WebCryptoAlgorithmParamsTypeNone // UnwrapKey | |
| 148 } | |
| 149 }, { // Index 4 | |
| 150 "SHA-1", { | 135 "SHA-1", { |
| 151 Undefined, // Encrypt | 136 Undefined, // Encrypt |
| 152 Undefined, // Decrypt | 137 Undefined, // Decrypt |
| 153 Undefined, // Sign | 138 Undefined, // Sign |
| 154 Undefined, // Verify | 139 Undefined, // Verify |
| 155 blink::WebCryptoAlgorithmParamsTypeNone, // Digest | 140 blink::WebCryptoAlgorithmParamsTypeNone, // Digest |
| 156 Undefined, // GenerateKey | 141 Undefined, // GenerateKey |
| 157 Undefined, // ImportKey | 142 Undefined, // ImportKey |
| 158 Undefined, // DeriveKey | 143 Undefined, // DeriveKey |
| 159 Undefined, // DeriveBits | 144 Undefined, // DeriveBits |
| 160 Undefined, // WrapKey | 145 Undefined, // WrapKey |
| 161 Undefined // UnwrapKey | 146 Undefined // UnwrapKey |
| 162 } | 147 } |
| 163 }, { // Index 5 | 148 }, { // Index 4 |
| 164 "SHA-256", { | 149 "SHA-256", { |
| 165 Undefined, // Encrypt | 150 Undefined, // Encrypt |
| 166 Undefined, // Decrypt | 151 Undefined, // Decrypt |
| 167 Undefined, // Sign | 152 Undefined, // Sign |
| 168 Undefined, // Verify | 153 Undefined, // Verify |
| 169 blink::WebCryptoAlgorithmParamsTypeNone, // Digest | 154 blink::WebCryptoAlgorithmParamsTypeNone, // Digest |
| 170 Undefined, // GenerateKey | 155 Undefined, // GenerateKey |
| 171 Undefined, // ImportKey | 156 Undefined, // ImportKey |
| 172 Undefined, // DeriveKey | 157 Undefined, // DeriveKey |
| 173 Undefined, // DeriveBits | 158 Undefined, // DeriveBits |
| 174 Undefined, // WrapKey | 159 Undefined, // WrapKey |
| 175 Undefined // UnwrapKey | 160 Undefined // UnwrapKey |
| 176 } | 161 } |
| 177 }, { // Index 6 | 162 }, { // Index 5 |
| 178 "SHA-384", { | 163 "SHA-384", { |
| 179 Undefined, // Encrypt | 164 Undefined, // Encrypt |
| 180 Undefined, // Decrypt | 165 Undefined, // Decrypt |
| 181 Undefined, // Sign | 166 Undefined, // Sign |
| 182 Undefined, // Verify | 167 Undefined, // Verify |
| 183 blink::WebCryptoAlgorithmParamsTypeNone, // Digest | 168 blink::WebCryptoAlgorithmParamsTypeNone, // Digest |
| 184 Undefined, // GenerateKey | 169 Undefined, // GenerateKey |
| 185 Undefined, // ImportKey | 170 Undefined, // ImportKey |
| 186 Undefined, // DeriveKey | 171 Undefined, // DeriveKey |
| 187 Undefined, // DeriveBits | 172 Undefined, // DeriveBits |
| 188 Undefined, // WrapKey | 173 Undefined, // WrapKey |
| 189 Undefined // UnwrapKey | 174 Undefined // UnwrapKey |
| 190 } | 175 } |
| 191 }, { // Index 7 | 176 }, { // Index 6 |
| 192 "SHA-512", { | 177 "SHA-512", { |
| 193 Undefined, // Encrypt | 178 Undefined, // Encrypt |
| 194 Undefined, // Decrypt | 179 Undefined, // Decrypt |
| 195 Undefined, // Sign | 180 Undefined, // Sign |
| 196 Undefined, // Verify | 181 Undefined, // Verify |
| 197 blink::WebCryptoAlgorithmParamsTypeNone, // Digest | 182 blink::WebCryptoAlgorithmParamsTypeNone, // Digest |
| 198 Undefined, // GenerateKey | 183 Undefined, // GenerateKey |
| 199 Undefined, // ImportKey | 184 Undefined, // ImportKey |
| 200 Undefined, // DeriveKey | 185 Undefined, // DeriveKey |
| 201 Undefined, // DeriveBits | 186 Undefined, // DeriveBits |
| 202 Undefined, // WrapKey | 187 Undefined, // WrapKey |
| 203 Undefined // UnwrapKey | 188 Undefined // UnwrapKey |
| 204 } | 189 } |
| 205 }, { // Index 8 | 190 }, { // Index 7 |
| 206 "AES-GCM", { | 191 "AES-GCM", { |
| 207 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Encrypt | 192 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Encrypt |
| 208 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Decrypt | 193 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // Decrypt |
| 209 Undefined, // Sign | 194 Undefined, // Sign |
| 210 Undefined, // Verify | 195 Undefined, // Verify |
| 211 Undefined, // Digest | 196 Undefined, // Digest |
| 212 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey | 197 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey |
| 213 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey | 198 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey |
| 214 Undefined, // DeriveKey | 199 Undefined, // DeriveKey |
| 215 Undefined, // DeriveBits | 200 Undefined, // DeriveBits |
| 216 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // WrapKey | 201 blink::WebCryptoAlgorithmParamsTypeAesGcmParams, // WrapKey |
| 217 blink::WebCryptoAlgorithmParamsTypeAesGcmParams // UnwrapKey | 202 blink::WebCryptoAlgorithmParamsTypeAesGcmParams // UnwrapKey |
| 218 } | 203 } |
| 219 }, { // Index 9 | 204 }, { // Index 8 |
| 220 "RSA-OAEP", { | 205 "RSA-OAEP", { |
| 221 // FIXME: | 206 // FIXME: |
| 222 Undefined, // Encrypt | 207 Undefined, // Encrypt |
| 223 Undefined, // Decrypt | 208 Undefined, // Decrypt |
| 224 Undefined, // Sign | 209 Undefined, // Sign |
| 225 Undefined, // Verify | 210 Undefined, // Verify |
| 226 Undefined, // Digest | 211 Undefined, // Digest |
| 227 Undefined, // GenerateKey | 212 Undefined, // GenerateKey |
| 228 Undefined, // ImportKey | 213 Undefined, // ImportKey |
| 229 Undefined, // DeriveKey | 214 Undefined, // DeriveKey |
| 230 Undefined, // DeriveBits | 215 Undefined, // DeriveBits |
| 231 Undefined, // WrapKey | 216 Undefined, // WrapKey |
| 232 Undefined // UnwrapKey | 217 Undefined // UnwrapKey |
| 233 } | 218 } |
| 234 }, { // Index 10 | 219 }, { // Index 9 |
| 235 "AES-CTR", { | 220 "AES-CTR", { |
| 236 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Encrypt | 221 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Encrypt |
| 237 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Decrypt | 222 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // Decrypt |
| 238 Undefined, // Sign | 223 Undefined, // Sign |
| 239 Undefined, // Verify | 224 Undefined, // Verify |
| 240 Undefined, // Digest | 225 Undefined, // Digest |
| 241 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey | 226 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey |
| 242 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey | 227 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey |
| 243 Undefined, // DeriveKey | 228 Undefined, // DeriveKey |
| 244 Undefined, // DeriveBits | 229 Undefined, // DeriveBits |
| 245 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // WrapKey | 230 blink::WebCryptoAlgorithmParamsTypeAesCtrParams, // WrapKey |
| 246 blink::WebCryptoAlgorithmParamsTypeAesCtrParams // UnwrapKey | 231 blink::WebCryptoAlgorithmParamsTypeAesCtrParams // UnwrapKey |
| 247 } | 232 } |
| 248 }, { // Index 11 | 233 }, { // Index 10 |
| 249 "AES-KW", { | 234 "AES-KW", { |
| 250 Undefined, // Encrypt | 235 Undefined, // Encrypt |
| 251 Undefined, // Decrypt | 236 Undefined, // Decrypt |
| 252 Undefined, // Sign | 237 Undefined, // Sign |
| 253 Undefined, // Verify | 238 Undefined, // Verify |
| 254 Undefined, // Digest | 239 Undefined, // Digest |
| 255 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey | 240 blink::WebCryptoAlgorithmParamsTypeAesKeyGenParams, // GenerateKey |
| 256 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey | 241 blink::WebCryptoAlgorithmParamsTypeNone, // ImportKey |
| 257 Undefined, // DeriveKey | 242 Undefined, // DeriveKey |
| 258 Undefined, // DeriveBits | 243 Undefined, // DeriveBits |
| 259 blink::WebCryptoAlgorithmParamsTypeNone, // WrapKey | 244 blink::WebCryptoAlgorithmParamsTypeNone, // WrapKey |
| 260 blink::WebCryptoAlgorithmParamsTypeNone // UnwrapKey | 245 blink::WebCryptoAlgorithmParamsTypeNone // UnwrapKey |
| 261 } | 246 } |
| 262 }, | 247 }, |
| 263 }; | 248 }; |
| 264 | 249 |
| 265 // Initializing the algorithmIdToInfo table above depends on knowing the enum | 250 // Initializing the algorithmIdToInfo table above depends on knowing the enum |
| 266 // values for algorithm IDs. If those ever change, the table will need to be | 251 // values for algorithm IDs. If those ever change, the table will need to be |
| 267 // updated. | 252 // updated. |
| 268 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCbc == 0, AesCbc_idDoesntMatch); | 253 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCbc == 0, AesCbc_idDoesntMatch); |
| 269 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdHmac == 1, Hmac_idDoesntMatch); | 254 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdHmac == 1, Hmac_idDoesntMatch); |
| 270 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 == 2, RsaSsaPkcs1v1_5_
idDoesntMatch); | 255 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 == 2, RsaSsaPkcs1v1_5_
idDoesntMatch); |
| 271 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5 == 3, RsaEsPkcs1v1_5_id
DoesntMatch); | 256 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha1 == 3, Sha1_idDoesntMatch); |
| 272 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha1 == 4, Sha1_idDoesntMatch); | 257 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha256 == 4, Sha256_idDoesntMatch); |
| 273 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha256 == 5, Sha256_idDoesntMatch); | 258 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha384 == 5, Sha384_idDoesntMatch); |
| 274 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha384 == 6, Sha384_idDoesntMatch); | 259 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha512 == 6, Sha512_idDoesntMatch); |
| 275 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdSha512 == 7, Sha512_idDoesntMatch); | 260 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesGcm == 7, AesGcm_idDoesntMatch); |
| 276 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesGcm == 8, AesGcm_idDoesntMatch); | 261 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaOaep == 8, RsaOaep_idDoesntMatch); |
| 277 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdRsaOaep == 9, RsaOaep_idDoesntMatch); | 262 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCtr == 9, AesCtr_idDoesntMatch); |
| 278 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesCtr == 10, AesCtr_idDoesntMatch); | 263 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesKw == 10, AesKw_idDoesntMatch); |
| 279 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdAesKw == 11, AesKw_idDoesntMatch); | 264 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdLast == 10, Last_idDoesntMatch); |
| 280 COMPILE_ASSERT(blink::WebCryptoAlgorithmIdLast == 11, Last_idDoesntMatch); | |
| 281 COMPILE_ASSERT(10 == LastAlgorithmOperation, UpdateParamsMapping); | 265 COMPILE_ASSERT(10 == LastAlgorithmOperation, UpdateParamsMapping); |
| 282 | 266 |
| 283 #if ASSERT_ENABLED | 267 #if ASSERT_ENABLED |
| 284 | 268 |
| 285 // Essentially std::is_sorted() (however that function is new to C++11). | 269 // Essentially std::is_sorted() (however that function is new to C++11). |
| 286 template <typename Iterator> | 270 template <typename Iterator> |
| 287 bool isSorted(Iterator begin, Iterator end) | 271 bool isSorted(Iterator begin, Iterator end) |
| 288 { | 272 { |
| 289 if (begin == end) | 273 if (begin == end) |
| 290 return true; | 274 return true; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 blink::WebCryptoAlgorithm hash; | 696 blink::WebCryptoAlgorithm hash; |
| 713 if (!parseHash(raw, hash, context, result)) | 697 if (!parseHash(raw, hash, context, result)) |
| 714 return false; | 698 return false; |
| 715 | 699 |
| 716 params = adoptPtr(new blink::WebCryptoRsaHashedImportParams(hash)); | 700 params = adoptPtr(new blink::WebCryptoRsaHashedImportParams(hash)); |
| 717 return true; | 701 return true; |
| 718 } | 702 } |
| 719 | 703 |
| 720 // Defined by the WebCrypto spec as: | 704 // Defined by the WebCrypto spec as: |
| 721 // | 705 // |
| 722 // dictionary RsaKeyGenParams : Algorithm { | |
| 723 // unsigned long modulusLength; | |
| 724 // BigInteger publicExponent; | |
| 725 // }; | |
| 726 bool parseRsaKeyGenParams(const Dictionary& raw, uint32_t& modulusLength, RefPtr
<Uint8Array>& publicExponent, const ErrorContext& context, CryptoResult* result) | |
| 727 { | |
| 728 if (!getUint32(raw, "modulusLength", modulusLength, context, result)) | |
| 729 return false; | |
| 730 | |
| 731 if (!getBigInteger(raw, "publicExponent", publicExponent, context, result)) | |
| 732 return false; | |
| 733 | |
| 734 return true; | |
| 735 } | |
| 736 | |
| 737 bool parseRsaKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAlgorith
mParams>& params, const ErrorContext& context, CryptoResult* result) | |
| 738 { | |
| 739 uint32_t modulusLength; | |
| 740 RefPtr<Uint8Array> publicExponent; | |
| 741 if (!parseRsaKeyGenParams(raw, modulusLength, publicExponent, context, resul
t)) | |
| 742 return false; | |
| 743 | |
| 744 params = adoptPtr(new blink::WebCryptoRsaKeyGenParams(modulusLength, static_
cast<const unsigned char*>(publicExponent->baseAddress()), publicExponent->byteL
ength())); | |
| 745 return true; | |
| 746 } | |
| 747 | |
| 748 // Defined by the WebCrypto spec as: | |
| 749 // | |
| 750 // dictionary RsaHashedKeyGenParams : RsaKeyGenParams { | 706 // dictionary RsaHashedKeyGenParams : RsaKeyGenParams { |
| 751 // AlgorithmIdentifier hash; | 707 // AlgorithmIdentifier hash; |
| 752 // }; | 708 // }; |
| 709 // |
| 710 // dictionary RsaKeyGenParams : Algorithm { |
| 711 // unsigned long modulusLength; |
| 712 // BigInteger publicExponent; |
| 713 // }; |
| 753 bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAl
gorithmParams>& params, const ErrorContext& context, CryptoResult* result) | 714 bool parseRsaHashedKeyGenParams(const Dictionary& raw, OwnPtr<blink::WebCryptoAl
gorithmParams>& params, const ErrorContext& context, CryptoResult* result) |
| 754 { | 715 { |
| 755 uint32_t modulusLength; | 716 uint32_t modulusLength; |
| 717 if (!getUint32(raw, "modulusLength", modulusLength, context, result)) |
| 718 return false; |
| 719 |
| 756 RefPtr<Uint8Array> publicExponent; | 720 RefPtr<Uint8Array> publicExponent; |
| 757 if (!parseRsaKeyGenParams(raw, modulusLength, publicExponent, context, resul
t)) | 721 if (!getBigInteger(raw, "publicExponent", publicExponent, context, result)) |
| 758 return false; | 722 return false; |
| 759 | 723 |
| 760 blink::WebCryptoAlgorithm hash; | 724 blink::WebCryptoAlgorithm hash; |
| 761 if (!parseHash(raw, hash, context, result)) | 725 if (!parseHash(raw, hash, context, result)) |
| 762 return false; | 726 return false; |
| 763 | 727 |
| 764 params = adoptPtr(new blink::WebCryptoRsaHashedKeyGenParams(hash, modulusLen
gth, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExp
onent->byteLength())); | 728 params = adoptPtr(new blink::WebCryptoRsaHashedKeyGenParams(hash, modulusLen
gth, static_cast<const unsigned char*>(publicExponent->baseAddress()), publicExp
onent->byteLength())); |
| 765 return true; | 729 return true; |
| 766 } | 730 } |
| 767 | 731 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 return parseHmacImportParams(raw, params, context, result); | 798 return parseHmacImportParams(raw, params, context, result); |
| 835 case blink::WebCryptoAlgorithmParamsTypeHmacKeyGenParams: | 799 case blink::WebCryptoAlgorithmParamsTypeHmacKeyGenParams: |
| 836 context.add("HmacKeyGenParams"); | 800 context.add("HmacKeyGenParams"); |
| 837 return parseHmacKeyGenParams(raw, params, context, result); | 801 return parseHmacKeyGenParams(raw, params, context, result); |
| 838 case blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams: | 802 case blink::WebCryptoAlgorithmParamsTypeRsaHashedKeyGenParams: |
| 839 context.add("RsaHashedKeyGenParams"); | 803 context.add("RsaHashedKeyGenParams"); |
| 840 return parseRsaHashedKeyGenParams(raw, params, context, result); | 804 return parseRsaHashedKeyGenParams(raw, params, context, result); |
| 841 case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams: | 805 case blink::WebCryptoAlgorithmParamsTypeRsaHashedImportParams: |
| 842 context.add("RsaHashedImportParams"); | 806 context.add("RsaHashedImportParams"); |
| 843 return parseRsaHashedImportParams(raw, params, context, result); | 807 return parseRsaHashedImportParams(raw, params, context, result); |
| 844 case blink::WebCryptoAlgorithmParamsTypeRsaKeyGenParams: | |
| 845 context.add("RsaKeyGenParams"); | |
| 846 return parseRsaKeyGenParams(raw, params, context, result); | |
| 847 case blink::WebCryptoAlgorithmParamsTypeAesCtrParams: | 808 case blink::WebCryptoAlgorithmParamsTypeAesCtrParams: |
| 848 context.add("AesCtrParams"); | 809 context.add("AesCtrParams"); |
| 849 return parseAesCtrParams(raw, params, context, result); | 810 return parseAesCtrParams(raw, params, context, result); |
| 850 case blink::WebCryptoAlgorithmParamsTypeAesGcmParams: | 811 case blink::WebCryptoAlgorithmParamsTypeAesGcmParams: |
| 851 context.add("AesGcmParams"); | 812 context.add("AesGcmParams"); |
| 852 return parseAesGcmParams(raw, params, context, result); | 813 return parseAesGcmParams(raw, params, context, result); |
| 853 case blink::WebCryptoAlgorithmParamsTypeRsaOaepParams: | 814 case blink::WebCryptoAlgorithmParamsTypeRsaOaepParams: |
| 854 // TODO | 815 // TODO |
| 855 notImplemented(); | 816 notImplemented(); |
| 856 break; | 817 break; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 { | 899 { |
| 939 return parseAlgorithm(raw, op, algorithm, ErrorContext(), result); | 900 return parseAlgorithm(raw, op, algorithm, ErrorContext(), result); |
| 940 } | 901 } |
| 941 | 902 |
| 942 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) | 903 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) |
| 943 { | 904 { |
| 944 return lookupAlgorithmInfo(id)->name; | 905 return lookupAlgorithmInfo(id)->name; |
| 945 } | 906 } |
| 946 | 907 |
| 947 } // namespace WebCore | 908 } // namespace WebCore |
| OLD | NEW |