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

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

Issue 401153002: Switch to BoringSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase across DEPS change Created 6 years, 5 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/cert/x509_certificate_openssl.cc ('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) 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 key[6] = DESSetKeyParity((raw[5] << 2) | (raw[6] >> 6)); 86 key[6] = DESSetKeyParity((raw[5] << 2) | (raw[6] >> 6));
87 key[7] = DESSetKeyParity((raw[6] << 1)); 87 key[7] = DESSetKeyParity((raw[6] << 1));
88 } 88 }
89 89
90 #if defined(USE_OPENSSL) 90 #if defined(USE_OPENSSL)
91 91
92 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) { 92 void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) {
93 crypto::EnsureOpenSSLInit(); 93 crypto::EnsureOpenSSLInit();
94 94
95 DES_key_schedule ks; 95 DES_key_schedule ks;
96 DES_set_key_unchecked( 96 DES_set_key(
97 reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(key)), &ks); 97 reinterpret_cast<const DES_cblock*>(key), &ks);
98 98
99 DES_ecb_encrypt(reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(src)), 99 DES_ecb_encrypt(reinterpret_cast<const DES_cblock*>(src),
100 reinterpret_cast<DES_cblock*>(hash), &ks, DES_ENCRYPT); 100 reinterpret_cast<DES_cblock*>(hash), &ks, DES_ENCRYPT);
101 } 101 }
102 102
103 #elif defined(USE_NSS) 103 #elif defined(USE_NSS)
104 104
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;
(...skipping 101 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 | « net/cert/x509_certificate_openssl.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698