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

Side by Side Diff: crypto/encryptor_nss.cc

Issue 11186004: Use the NSS internal key slot for all temporary key operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months 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 | « no previous file | crypto/openpgp_symmetric_encryption.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/encryptor.h" 5 #include "crypto/encryptor.h"
6 6
7 #include <cryptohi.h> 7 #include <cryptohi.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const base::StringPiece& iv) { 46 const base::StringPiece& iv) {
47 DCHECK(key); 47 DCHECK(key);
48 DCHECK(CBC == mode || CTR == mode) << "Unsupported mode of operation"; 48 DCHECK(CBC == mode || CTR == mode) << "Unsupported mode of operation";
49 49
50 key_ = key; 50 key_ = key;
51 mode_ = mode; 51 mode_ = mode;
52 52
53 if (mode == CBC && iv.size() != AES_BLOCK_SIZE) 53 if (mode == CBC && iv.size() != AES_BLOCK_SIZE)
54 return false; 54 return false;
55 55
56 slot_.reset(PK11_GetBestSlot(GetMechanism(mode), NULL)); 56 slot_.reset(PK11_GetInternalSlot());
Ryan Sleevi 2012/10/16 19:25:09 wtc: It's not immediately clear to me why we even
wtc 2012/10/16 21:26:57 We should remove the unused slot_ member. I guess
57 if (!slot_.get()) 57 if (!slot_.get())
58 return false; 58 return false;
59 59
60 switch (mode) { 60 switch (mode) {
61 case CBC: 61 case CBC:
62 SECItem iv_item; 62 SECItem iv_item;
63 iv_item.type = siBuffer; 63 iv_item.type = siBuffer;
64 iv_item.data = reinterpret_cast<unsigned char*>( 64 iv_item.data = reinterpret_cast<unsigned char*>(
65 const_cast<char *>(iv.data())); 65 const_cast<char *>(iv.data()));
66 iv_item.len = iv.size(); 66 iv_item.len = iv.size();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 // Use |output_data| to mask |input|. 189 // Use |output_data| to mask |input|.
190 MaskMessage( 190 MaskMessage(
191 reinterpret_cast<uint8*>(const_cast<char*>(input.data())), 191 reinterpret_cast<uint8*>(const_cast<char*>(input.data())),
192 input.length(), output_data, output_data); 192 input.length(), output_data, output_data);
193 output->resize(input.length()); 193 output->resize(input.length());
194 return true; 194 return true;
195 } 195 }
196 196
197 } // namespace crypto 197 } // namespace crypto
OLDNEW
« no previous file with comments | « no previous file | crypto/openpgp_symmetric_encryption.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698