| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #if defined(USE_NSS) | 7 #if defined(USE_NSS) |
| 8 #include <nss.h> | 8 #include <nss.h> |
| 9 #include <pk11pub.h> | 9 #include <pk11pub.h> |
| 10 #elif defined(OS_MACOSX) | 10 #elif defined(OS_MACOSX) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 key[0] = DESSetKeyParity(raw[0]); | 78 key[0] = DESSetKeyParity(raw[0]); |
| 79 key[1] = DESSetKeyParity((raw[0] << 7) | (raw[1] >> 1)); | 79 key[1] = DESSetKeyParity((raw[0] << 7) | (raw[1] >> 1)); |
| 80 key[2] = DESSetKeyParity((raw[1] << 6) | (raw[2] >> 2)); | 80 key[2] = DESSetKeyParity((raw[1] << 6) | (raw[2] >> 2)); |
| 81 key[3] = DESSetKeyParity((raw[2] << 5) | (raw[3] >> 3)); | 81 key[3] = DESSetKeyParity((raw[2] << 5) | (raw[3] >> 3)); |
| 82 key[4] = DESSetKeyParity((raw[3] << 4) | (raw[4] >> 4)); | 82 key[4] = DESSetKeyParity((raw[3] << 4) | (raw[4] >> 4)); |
| 83 key[5] = DESSetKeyParity((raw[4] << 3) | (raw[5] >> 5)); | 83 key[5] = DESSetKeyParity((raw[4] << 3) | (raw[5] >> 5)); |
| 84 key[6] = DESSetKeyParity((raw[5] << 2) | (raw[6] >> 6)); | 84 key[6] = DESSetKeyParity((raw[5] << 2) | (raw[6] >> 6)); |
| 85 key[7] = DESSetKeyParity((raw[6] << 1)); | 85 key[7] = DESSetKeyParity((raw[6] << 1)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 #if defined(USE_NSS) | 88 #if defined(USE_OPENSSL) |
| 89 |
| 90 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) { |
| 91 // TODO(joth): When implementing consider splitting up this file by platform. |
| 92 NOTIMPLEMENTED(); |
| 93 } |
| 94 |
| 95 #elif defined(USE_NSS) |
| 89 | 96 |
| 90 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) { | 97 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) { |
| 91 CK_MECHANISM_TYPE cipher_mech = CKM_DES_ECB; | 98 CK_MECHANISM_TYPE cipher_mech = CKM_DES_ECB; |
| 92 PK11SlotInfo* slot = NULL; | 99 PK11SlotInfo* slot = NULL; |
| 93 PK11SymKey* symkey = NULL; | 100 PK11SymKey* symkey = NULL; |
| 94 PK11Context* ctxt = NULL; | 101 PK11Context* ctxt = NULL; |
| 95 SECItem key_item; | 102 SECItem key_item; |
| 96 SECItem* param = NULL; | 103 SECItem* param = NULL; |
| 97 SECStatus rv; | 104 SECStatus rv; |
| 98 unsigned int n; | 105 unsigned int n; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 done: | 218 done: |
| 212 if (hkey) | 219 if (hkey) |
| 213 CryptDestroyKey(hkey); | 220 CryptDestroyKey(hkey); |
| 214 if (provider) | 221 if (provider) |
| 215 CryptReleaseContext(provider, 0); | 222 CryptReleaseContext(provider, 0); |
| 216 } | 223 } |
| 217 | 224 |
| 218 #endif | 225 #endif |
| 219 | 226 |
| 220 } // namespace net | 227 } // namespace net |
| OLD | NEW |