OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |