Chromium Code Reviews| 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/ntlm/des.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "crypto/openssl_util.h" | 8 #include "crypto/openssl_util.h" |
| 9 #include "third_party/boringssl/src/include/openssl/des.h" | 9 #include "third_party/boringssl/src/include/openssl/des.h" |
| 10 | 10 |
| 11 // The iOS version of DESEncrypt is our own code. | 11 // The iOS version of DESEncrypt is our own code. |
| 12 // DESSetKeyParity and DESMakeKey are based on | 12 // DESSetKeyParity and DESMakeKey are based on |
| 13 // mozilla/security/manager/ssl/src/nsNTLMAuthModule.cpp, CVS rev. 1.14. | 13 // mozilla/security/manager/ssl/src/nsNTLMAuthModule.cpp, CVS rev. 1.14. |
| 14 | 14 |
| 15 /* ***** BEGIN LICENSE BLOCK ***** | 15 /* ***** BEGIN LICENSE BLOCK ***** |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 41 * of those above. If you wish to allow use of your version of this file only | 41 * of those above. If you wish to allow use of your version of this file only |
| 42 * under the terms of either the GPL or the LGPL, and not to allow others to | 42 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 43 * use your version of this file under the terms of the MPL, indicate your | 43 * use your version of this file under the terms of the MPL, indicate your |
| 44 * decision by deleting the provisions above and replace them with the notice | 44 * decision by deleting the provisions above and replace them with the notice |
| 45 * and other provisions required by the GPL or the LGPL. If you do not delete | 45 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 46 * the provisions above, a recipient may use your version of this file under | 46 * the provisions above, a recipient may use your version of this file under |
| 47 * the terms of any one of the MPL, the GPL or the LGPL. | 47 * the terms of any one of the MPL, the GPL or the LGPL. |
| 48 * | 48 * |
| 49 * ***** END LICENSE BLOCK ***** */ | 49 * ***** END LICENSE BLOCK ***** */ |
| 50 | 50 |
| 51 /* clang-format off */ | |
|
Ryan Sleevi
2017/07/13 17:39:54
I would move this to line 14
zentaro
2017/07/13 18:20:31
Done.
| |
| 52 | |
| 51 // Set odd parity bit (in least significant bit position). | 53 // Set odd parity bit (in least significant bit position). |
| 52 static uint8_t DESSetKeyParity(uint8_t x) { | 54 static uint8_t DESSetKeyParity(uint8_t x) { |
| 53 if ((((x >> 7) ^ (x >> 6) ^ (x >> 5) ^ | 55 if ((((x >> 7) ^ (x >> 6) ^ (x >> 5) ^ |
| 54 (x >> 4) ^ (x >> 3) ^ (x >> 2) ^ | 56 (x >> 4) ^ (x >> 3) ^ (x >> 2) ^ |
| 55 (x >> 1)) & 0x01) == 0) { | 57 (x >> 1)) & 0x01) == 0) { |
| 56 x |= 0x01; | 58 x |= 0x01; |
| 57 } else { | 59 } else { |
| 58 x &= 0xfe; | 60 x &= 0xfe; |
| 59 } | 61 } |
| 60 return x; | 62 return x; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 78 | 80 |
| 79 DES_key_schedule ks; | 81 DES_key_schedule ks; |
| 80 DES_set_key( | 82 DES_set_key( |
| 81 reinterpret_cast<const DES_cblock*>(key), &ks); | 83 reinterpret_cast<const DES_cblock*>(key), &ks); |
| 82 | 84 |
| 83 DES_ecb_encrypt(reinterpret_cast<const DES_cblock*>(src), | 85 DES_ecb_encrypt(reinterpret_cast<const DES_cblock*>(src), |
| 84 reinterpret_cast<DES_cblock*>(hash), &ks, DES_ENCRYPT); | 86 reinterpret_cast<DES_cblock*>(hash), &ks, DES_ENCRYPT); |
| 85 } | 87 } |
| 86 | 88 |
| 87 } // namespace net | 89 } // namespace net |
| OLD | NEW |