Chromium Code Reviews| Index: net/http/des.cc |
| diff --git a/net/http/des.cc b/net/http/des.cc |
| index 11d7a26ec7ec24496ed55d0b504d72148fc7b4ad..0eb1a615e6903ed425fc5b3310b8989c179efaec 100644 |
| --- a/net/http/des.cc |
| +++ b/net/http/des.cc |
| @@ -6,7 +6,10 @@ |
| #include "base/logging.h" |
| -#if defined(USE_NSS) |
| +#if defined(USE_OPENSSL) |
| +#include <openssl/des.h> |
| +#include "base/openssl_util.h" |
| +#elif defined(USE_NSS) |
| #include <nss.h> |
| #include <pk11pub.h> |
| #include "base/nss_util.h" |
| @@ -87,8 +90,14 @@ void DESMakeKey(const uint8* raw, uint8* key) { |
| #if defined(USE_OPENSSL) |
| void DESEncrypt(const uint8* key, const uint8* src, uint8* hash) { |
| - // TODO(joth): When implementing consider splitting up this file by platform. |
| - NOTIMPLEMENTED(); |
| + base::EnsureOpenSSLInit(); |
| + |
| + DES_key_schedule ks; |
| + DES_set_key_unchecked( |
| + reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(key)), &ks); |
| + |
| + DES_ecb_encrypt(reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(src)), |
| + reinterpret_cast<DES_cblock*>(hash), &ks, 1); // 1 = encrypt. |
|
bulach
2010/12/01 18:01:33
des.h has a DES_ENCRYPT
joth
2010/12/02 17:12:01
Done.
|
| } |
| #elif defined(USE_NSS) |