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

Side by Side Diff: net/http/des.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: Remove unused slot 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 | « crypto/symmetric_key_nss.cc ('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 (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 "net/http/des.h" 5 #include "net/http/des.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 #if defined(USE_OPENSSL) 9 #if defined(USE_OPENSSL)
10 #include <openssl/des.h> 10 #include <openssl/des.h>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 PK11SlotInfo* slot = NULL; 107 PK11SlotInfo* slot = NULL;
108 PK11SymKey* symkey = NULL; 108 PK11SymKey* symkey = NULL;
109 PK11Context* ctxt = NULL; 109 PK11Context* ctxt = NULL;
110 SECItem key_item; 110 SECItem key_item;
111 SECItem* param = NULL; 111 SECItem* param = NULL;
112 SECStatus rv; 112 SECStatus rv;
113 unsigned int n; 113 unsigned int n;
114 114
115 crypto::EnsureNSSInit(); 115 crypto::EnsureNSSInit();
116 116
117 slot = PK11_GetBestSlot(cipher_mech, NULL); 117 slot = PK11_GetInternalSlot();
118 if (!slot) 118 if (!slot)
119 goto done; 119 goto done;
120 120
121 key_item.data = const_cast<uint8*>(key); 121 key_item.data = const_cast<uint8*>(key);
122 key_item.len = 8; 122 key_item.len = 8;
123 symkey = PK11_ImportSymKey(slot, cipher_mech, 123 symkey = PK11_ImportSymKey(slot, cipher_mech,
124 PK11_OriginUnwrap, CKA_ENCRYPT, 124 PK11_OriginUnwrap, CKA_ENCRYPT,
125 &key_item, NULL); 125 &key_item, NULL);
126 if (!symkey) 126 if (!symkey)
127 goto done; 127 goto done;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Pass a 'Final' of FALSE, otherwise CryptEncrypt appends one additional 211 // Pass a 'Final' of FALSE, otherwise CryptEncrypt appends one additional
212 // block of padding to the data. 212 // block of padding to the data.
213 DWORD hash_len = 8; 213 DWORD hash_len = 8;
214 CryptEncrypt(key, 0, FALSE, 0, hash, &hash_len, 8); 214 CryptEncrypt(key, 0, FALSE, 0, hash, &hash_len, 8);
215 } 215 }
216 } 216 }
217 217
218 #endif 218 #endif
219 219
220 } // namespace net 220 } // namespace net
OLDNEW
« no previous file with comments | « crypto/symmetric_key_nss.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698