Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: Source/modules/crypto/NormalizeAlgorithm.cpp

Issue 111603004: [webcrypto] Add AES-KW to the list of registered algorithms. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/crypto/generateKey-expected.txt ('k') | public/platform/WebCryptoAlgorithm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « LayoutTests/crypto/generateKey-expected.txt ('k') | public/platform/WebCryptoAlgorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698