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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 {"AES-CBC", blink::WebCryptoAlgorithmIdAesCbc}, | 70 {"AES-CBC", blink::WebCryptoAlgorithmIdAesCbc}, |
71 {"AES-CTR", blink::WebCryptoAlgorithmIdAesCtr}, | 71 {"AES-CTR", blink::WebCryptoAlgorithmIdAesCtr}, |
72 {"HMAC", blink::WebCryptoAlgorithmIdHmac}, | 72 {"HMAC", blink::WebCryptoAlgorithmIdHmac}, |
73 {"RSASSA-PKCS1-v1_5", blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5}, | 73 {"RSASSA-PKCS1-v1_5", blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5}, |
74 {"RSAES-PKCS1-v1_5", blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5}, | 74 {"RSAES-PKCS1-v1_5", blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5}, |
75 {"SHA-1", blink::WebCryptoAlgorithmIdSha1}, | 75 {"SHA-1", blink::WebCryptoAlgorithmIdSha1}, |
76 {"SHA-224", blink::WebCryptoAlgorithmIdSha224}, | 76 {"SHA-224", blink::WebCryptoAlgorithmIdSha224}, |
77 {"SHA-256", blink::WebCryptoAlgorithmIdSha256}, | 77 {"SHA-256", blink::WebCryptoAlgorithmIdSha256}, |
78 {"SHA-384", blink::WebCryptoAlgorithmIdSha384}, | 78 {"SHA-384", blink::WebCryptoAlgorithmIdSha384}, |
79 {"SHA-512", blink::WebCryptoAlgorithmIdSha512}, | 79 {"SHA-512", blink::WebCryptoAlgorithmIdSha512}, |
| 80 {"AES-KW", blink::WebCryptoAlgorithmIdAesKw}, |
80 }; | 81 }; |
81 | 82 |
82 // What operations each algorithm supports, and what parameters it expects. | 83 // What operations each algorithm supports, and what parameters it expects. |
83 const OperationParamsMapping operationParamsMappings[] = { | 84 const OperationParamsMapping operationParamsMappings[] = { |
84 // AES-CBC | 85 // AES-CBC |
85 {blink::WebCryptoAlgorithmIdAesCbc, Decrypt, blink::WebCryptoAlgorithmParams
TypeAesCbcParams}, | 86 {blink::WebCryptoAlgorithmIdAesCbc, Decrypt, blink::WebCryptoAlgorithmParams
TypeAesCbcParams}, |
86 {blink::WebCryptoAlgorithmIdAesCbc, Encrypt, blink::WebCryptoAlgorithmParams
TypeAesCbcParams}, | 87 {blink::WebCryptoAlgorithmIdAesCbc, Encrypt, blink::WebCryptoAlgorithmParams
TypeAesCbcParams}, |
87 {blink::WebCryptoAlgorithmIdAesCbc, GenerateKey, blink::WebCryptoAlgorithmPa
ramsTypeAesKeyGenParams}, | 88 {blink::WebCryptoAlgorithmIdAesCbc, GenerateKey, blink::WebCryptoAlgorithmPa
ramsTypeAesKeyGenParams}, |
88 {blink::WebCryptoAlgorithmIdAesCbc, ImportKey, blink::WebCryptoAlgorithmPara
msTypeNone}, | 89 {blink::WebCryptoAlgorithmIdAesCbc, ImportKey, blink::WebCryptoAlgorithmPara
msTypeNone}, |
89 {blink::WebCryptoAlgorithmIdAesCbc, UnwrapKey, blink::WebCryptoAlgorithmPara
msTypeAesCbcParams}, | 90 {blink::WebCryptoAlgorithmIdAesCbc, UnwrapKey, blink::WebCryptoAlgorithmPara
msTypeAesCbcParams}, |
(...skipping 26 matching lines...) Expand all Loading... |
116 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, ImportKey, blink::WebCryptoAlgor
ithmParamsTypeNone}, | 117 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, ImportKey, blink::WebCryptoAlgor
ithmParamsTypeNone}, |
117 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, WrapKey, blink::WebCryptoAlgorit
hmParamsTypeNone}, | 118 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, WrapKey, blink::WebCryptoAlgorit
hmParamsTypeNone}, |
118 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, UnwrapKey, blink::WebCryptoAlgor
ithmParamsTypeNone}, | 119 {blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5, UnwrapKey, blink::WebCryptoAlgor
ithmParamsTypeNone}, |
119 | 120 |
120 // SHA-* | 121 // SHA-* |
121 {blink::WebCryptoAlgorithmIdSha1, Digest, blink::WebCryptoAlgorithmParamsTyp
eNone}, | 122 {blink::WebCryptoAlgorithmIdSha1, Digest, blink::WebCryptoAlgorithmParamsTyp
eNone}, |
122 {blink::WebCryptoAlgorithmIdSha224, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, | 123 {blink::WebCryptoAlgorithmIdSha224, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
123 {blink::WebCryptoAlgorithmIdSha256, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, | 124 {blink::WebCryptoAlgorithmIdSha256, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
124 {blink::WebCryptoAlgorithmIdSha384, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, | 125 {blink::WebCryptoAlgorithmIdSha384, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
125 {blink::WebCryptoAlgorithmIdSha512, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, | 126 {blink::WebCryptoAlgorithmIdSha512, Digest, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
| 127 |
| 128 // AES-KW |
| 129 {blink::WebCryptoAlgorithmIdAesKw, GenerateKey, blink::WebCryptoAlgorithmPar
amsTypeAesKeyGenParams}, |
| 130 {blink::WebCryptoAlgorithmIdAesKw, ImportKey, blink::WebCryptoAlgorithmParam
sTypeNone}, |
| 131 {blink::WebCryptoAlgorithmIdAesKw, UnwrapKey, blink::WebCryptoAlgorithmParam
sTypeNone}, |
| 132 {blink::WebCryptoAlgorithmIdAesKw, WrapKey, blink::WebCryptoAlgorithmParamsT
ypeNone}, |
126 }; | 133 }; |
127 | 134 |
128 // This structure describes an algorithm and its supported operations. | 135 // This structure describes an algorithm and its supported operations. |
129 struct AlgorithmInfo { | 136 struct AlgorithmInfo { |
130 AlgorithmInfo() | 137 AlgorithmInfo() |
131 : algorithmName(0) | 138 : algorithmName(0) |
132 { | 139 { |
133 for (size_t i = 0; i < WTF_ARRAY_LENGTH(paramsForOperation); ++i) | 140 for (size_t i = 0; i < WTF_ARRAY_LENGTH(paramsForOperation); ++i) |
134 paramsForOperation[i] = UnsupportedOp; | 141 paramsForOperation[i] = UnsupportedOp; |
135 } | 142 } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 { | 550 { |
544 return normalizeAlgorithm(raw, op, algorithm, ExceptionContext(op), exceptio
nState); | 551 return normalizeAlgorithm(raw, op, algorithm, ExceptionContext(op), exceptio
nState); |
545 } | 552 } |
546 | 553 |
547 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) | 554 const char* algorithmIdToName(blink::WebCryptoAlgorithmId id) |
548 { | 555 { |
549 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName; | 556 return AlgorithmRegistry::instance().lookupAlgorithmById(id)->algorithmName; |
550 } | 557 } |
551 | 558 |
552 } // namespace WebCore | 559 } // namespace WebCore |
OLD | NEW |