diff options
author | Kristian Monsen <kristianm@google.com> | 2011-03-03 18:28:14 +0000 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2011-03-03 18:39:53 +0000 |
commit | fac8ff3b63c4430422aed85bda94d0bfb168c224 (patch) | |
tree | 2f49ec46ec93b2edb46c9b382d85bf6d0af5371b /net/http | |
parent | e00741fe4b5b3d04d95b48b19d56c94fc9bc0237 (diff) | |
download | external_chromium-fac8ff3b63c4430422aed85bda94d0bfb168c224.zip external_chromium-fac8ff3b63c4430422aed85bda94d0bfb168c224.tar.gz external_chromium-fac8ff3b63c4430422aed85bda94d0bfb168c224.tar.bz2 |
Updating the des code, mostly just proper casts
Change-Id: I9fd913e6d41f35ce0df0080d5deae14ac04e1d42
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/des.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/http/des.cc b/net/http/des.cc index 5d87f31..21a8455 100644 --- a/net/http/des.cc +++ b/net/http/des.cc @@ -11,6 +11,9 @@ #include <pk11pub.h> #include "base/nss_util.h" #elif defined(USE_OPENSSL) +#ifndef ANDROID +#include "base/openssl_util.h" +#endif #include <openssl/des.h> #elif defined(OS_MACOSX) #include <CommonCrypto/CommonCryptor.h> @@ -89,14 +92,16 @@ void DESMakeKey(const uint8* raw, uint8* key) { #if defined(USE_OPENSSL) void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) { - DES_cblock des_key; - DES_key_schedule schedule; +#ifndef ANDROID + base::EnsureOpenSSLInit(); - memcpy(des_key, key, 8); - DES_set_odd_parity(&des_key); - DES_set_key_checked(&des_key, &schedule); +#endif + DES_key_schedule ks; + DES_set_key_unchecked( + reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(key)), &ks); - DES_ecb_encrypt((C_Block *)src, (C_Block *)hash, &schedule, DES_ENCRYPT); + DES_ecb_encrypt(reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(src)), + reinterpret_cast<DES_cblock*>(hash), &ks, DES_ENCRYPT); } #elif defined(USE_NSS) |