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

Side by Side Diff: crypto/symmetric_key_win.cc

Issue 1469783002: Cleanup: Correctly spell success(ful). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format media Created 5 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
« no previous file with comments | « courgette/courgette.h ('k') | gin/converter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "crypto/symmetric_key.h" 5 #include "crypto/symmetric_key.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 // TODO(wtc): replace scoped_array by std::vector. 9 // TODO(wtc): replace scoped_array by std::vector.
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 20 matching lines...) Expand all
31 case 128: 31 case 128:
32 return CALG_AES_128; 32 return CALG_AES_128;
33 case 192: 33 case 192:
34 return CALG_AES_192; 34 return CALG_AES_192;
35 case 256: 35 case 256:
36 return CALG_AES_256; 36 return CALG_AES_256;
37 default: 37 default:
38 NOTREACHED(); 38 NOTREACHED();
39 return 0; 39 return 0;
40 } 40 }
41 }; 41 }
42 42
43 // Imports a raw/plaintext key of |key_size| stored in |*key_data| into a new 43 // Imports a raw/plaintext key of |key_size| stored in |*key_data| into a new
44 // key created for the specified |provider|. |alg| contains the algorithm of 44 // key created for the specified |provider|. |alg| contains the algorithm of
45 // the key being imported. 45 // the key being imported.
46 // If |key_data| is intended to be used as an HMAC key, then |alg| should be 46 // If |key_data| is intended to be used as an HMAC key, then |alg| should be
47 // CALG_HMAC. 47 // CALG_HMAC.
48 // If successful, returns true and stores the imported key in |*key|. 48 // If successful, returns true and stores the imported key in |*key|.
49 // TODO(wtc): use this function in hmac_win.cc. 49 // TODO(wtc): use this function in hmac_win.cc.
50 bool ImportRawKey(HCRYPTPROV provider, 50 bool ImportRawKey(HCRYPTPROV provider,
51 ALG_ID alg, 51 ALG_ID alg,
(...skipping 24 matching lines...) Expand all
76 // RSA Enhanced Provider, as the approved means of using arbitrary HMAC 76 // RSA Enhanced Provider, as the approved means of using arbitrary HMAC
77 // key material. 77 // key material.
78 key_header->hdr.aiKeyAlg = CALG_RC2; 78 key_header->hdr.aiKeyAlg = CALG_RC2;
79 flags |= CRYPT_IPSEC_HMAC_KEY; 79 flags |= CRYPT_IPSEC_HMAC_KEY;
80 } 80 }
81 81
82 BOOL ok = 82 BOOL ok =
83 CryptImportKey(provider, actual_key, actual_size, 0, flags, &unsafe_key); 83 CryptImportKey(provider, actual_key, actual_size, 0, flags, &unsafe_key);
84 84
85 // Clean up the temporary copy of key, regardless of whether it was imported 85 // Clean up the temporary copy of key, regardless of whether it was imported
86 // sucessfully or not. 86 // successfully or not.
87 SecureZeroMemory(actual_key, actual_size); 87 SecureZeroMemory(actual_key, actual_size);
88 88
89 if (!ok) 89 if (!ok)
90 return false; 90 return false;
91 91
92 key->reset(unsafe_key); 92 key->reset(unsafe_key);
93 return true; 93 return true;
94 } 94 }
95 95
96 // Attempts to generate a random AES key of |key_size_in_bits|. Returns true 96 // Attempts to generate a random AES key of |key_size_in_bits|. Returns true
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 HCRYPTKEY key, 527 HCRYPTKEY key,
528 const void* key_data, size_t key_size_in_bytes) 528 const void* key_data, size_t key_size_in_bytes)
529 : provider_(provider), key_(key) { 529 : provider_(provider), key_(key) {
530 if (key_data) { 530 if (key_data) {
531 raw_key_.assign(reinterpret_cast<const char*>(key_data), 531 raw_key_.assign(reinterpret_cast<const char*>(key_data),
532 key_size_in_bytes); 532 key_size_in_bytes);
533 } 533 }
534 } 534 }
535 535
536 } // namespace crypto 536 } // namespace crypto
OLDNEW
« no previous file with comments | « courgette/courgette.h ('k') | gin/converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698