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

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

Issue 199105: Continue with the FreeBSD port - this version builds and links, though... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | « net/base/x509_certificate.h ('k') | net/net.gyp » ('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) 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(OS_LINUX) 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)
11 #include <CommonCrypto/CommonCryptor.h> 11 #include <CommonCrypto/CommonCryptor.h>
12 #elif defined(OS_WIN) 12 #elif defined(OS_WIN)
13 #include <windows.h> 13 #include <windows.h>
14 #include <wincrypt.h> 14 #include <wincrypt.h>
15 #endif 15 #endif
16 16
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #if defined(OS_LINUX) 18 #if defined(USE_NSS)
19 #include "base/nss_init.h" 19 #include "base/nss_init.h"
20 #endif 20 #endif
21 21
22 // The Mac and Windows (CryptoAPI) versions of DESEncrypt are our own code. 22 // The Mac and Windows (CryptoAPI) versions of DESEncrypt are our own code.
23 // DESSetKeyParity, DESMakeKey, and the Linux (NSS) version of DESEncrypt are 23 // DESSetKeyParity, DESMakeKey, and the Linux (NSS) version of DESEncrypt are
24 // based on mozilla/security/manager/ssl/src/nsNTLMAuthModule.cpp, 24 // based on mozilla/security/manager/ssl/src/nsNTLMAuthModule.cpp,
25 // CVS rev. 1.14. 25 // CVS rev. 1.14.
26 26
27 /* ***** BEGIN LICENSE BLOCK ***** 27 /* ***** BEGIN LICENSE BLOCK *****
28 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 28 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(OS_LINUX) 88 #if defined(USE_NSS)
89 89
90 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) { 90 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
91 CK_MECHANISM_TYPE cipher_mech = CKM_DES_ECB; 91 CK_MECHANISM_TYPE cipher_mech = CKM_DES_ECB;
92 PK11SlotInfo* slot = NULL; 92 PK11SlotInfo* slot = NULL;
93 PK11SymKey* symkey = NULL; 93 PK11SymKey* symkey = NULL;
94 PK11Context* ctxt = NULL; 94 PK11Context* ctxt = NULL;
95 SECItem key_item; 95 SECItem key_item;
96 SECItem* param = NULL; 96 SECItem* param = NULL;
97 SECStatus rv; 97 SECStatus rv;
98 unsigned int n; 98 unsigned int n;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 done: 211 done:
212 if (hkey) 212 if (hkey)
213 CryptDestroyKey(hkey); 213 CryptDestroyKey(hkey);
214 if (provider) 214 if (provider)
215 CryptReleaseContext(provider, 0); 215 CryptReleaseContext(provider, 0);
216 } 216 }
217 217
218 #endif 218 #endif
219 219
220 } // namespace net 220 } // namespace net
OLDNEW
« no previous file with comments | « net/base/x509_certificate.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698