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

Side by Side Diff: net/http/des.cc

Issue 36593002: crypto/nss_util: Get TPM slot id, do lookup by id instead of by name. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sandbox debugging crap Created 7 years, 1 month 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
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) { 105 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
106 CK_MECHANISM_TYPE cipher_mech = CKM_DES_ECB; 106 CK_MECHANISM_TYPE cipher_mech = CKM_DES_ECB;
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 LOG(ERROR) << "HIIIIIIIIIIIIIIIIIIIIIIIIIII";
115 crypto::EnsureNSSInit(); 116 crypto::EnsureNSSInit();
116 117
117 slot = PK11_GetInternalSlot(); 118 slot = PK11_GetInternalSlot();
118 if (!slot) 119 if (!slot)
119 goto done; 120 goto done;
120 121
121 key_item.data = const_cast<uint8*>(key); 122 key_item.data = const_cast<uint8*>(key);
122 key_item.len = 8; 123 key_item.len = 8;
123 symkey = PK11_ImportSymKey(slot, cipher_mech, 124 symkey = PK11_ImportSymKey(slot, cipher_mech,
124 PK11_OriginUnwrap, CKA_ENCRYPT, 125 PK11_OriginUnwrap, CKA_ENCRYPT,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Pass a 'Final' of FALSE, otherwise CryptEncrypt appends one additional 212 // Pass a 'Final' of FALSE, otherwise CryptEncrypt appends one additional
212 // block of padding to the data. 213 // block of padding to the data.
213 DWORD hash_len = 8; 214 DWORD hash_len = 8;
214 CryptEncrypt(key, 0, FALSE, 0, hash, &hash_len, 8); 215 CryptEncrypt(key, 0, FALSE, 0, hash, &hash_len, 8);
215 } 216 }
216 } 217 }
217 218
218 #endif 219 #endif
219 220
220 } // namespace net 221 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698