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

Side by Side Diff: content/renderer/webcrypto/webcrypto_util.cc

Issue 108653015: [webcrypto] Some fixes for HMAC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | « content/renderer/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/webcrypto/webcrypto_util.h" 5 #include "content/renderer/webcrypto/webcrypto_util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
10 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 10 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return CreateAesKeyGenAlgorithm(blink::WebCryptoAlgorithmIdAesCbc, 165 return CreateAesKeyGenAlgorithm(blink::WebCryptoAlgorithmIdAesCbc,
166 key_length_bits); 166 key_length_bits);
167 } 167 }
168 168
169 blink::WebCryptoAlgorithm CreateAesGcmKeyGenAlgorithm( 169 blink::WebCryptoAlgorithm CreateAesGcmKeyGenAlgorithm(
170 unsigned short key_length_bits) { 170 unsigned short key_length_bits) {
171 return CreateAesKeyGenAlgorithm(blink::WebCryptoAlgorithmIdAesGcm, 171 return CreateAesKeyGenAlgorithm(blink::WebCryptoAlgorithmIdAesGcm,
172 key_length_bits); 172 key_length_bits);
173 } 173 }
174 174
175 unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id) {
176 switch (hash_id) {
177 case blink::WebCryptoAlgorithmIdSha1:
178 case blink::WebCryptoAlgorithmIdSha224:
179 case blink::WebCryptoAlgorithmIdSha256:
180 return 64;
181 case blink::WebCryptoAlgorithmIdSha384:
182 case blink::WebCryptoAlgorithmIdSha512:
183 return 128;
184 default:
185 NOTREACHED();
186 return 0;
187 }
188 }
189
175 } // namespace webcrypto 190 } // namespace webcrypto
176 191
177 } // namespace content 192 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698