Chromium Code Reviews| Index: net/http/des.cc |
| diff --git a/net/http/des.cc b/net/http/des.cc |
| index 11d7a26ec7ec24496ed55d0b504d72148fc7b4ad..30706e9ae8a81eb1ea4dfcaa09a993d392e46d43 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); |
|
wtc
2010/12/01 22:50:05
Question: do you need to cast away the 'const' bef
joth
2010/12/02 17:12:01
unfortunately it seems so (sigh). The openssl api
|
| + |
| + DES_ecb_encrypt(reinterpret_cast<const_DES_cblock*>(const_cast<uint8*>(src)), |
| + reinterpret_cast<DES_cblock*>(hash), &ks, DES_ENCRYPT); |
| } |
| #elif defined(USE_NSS) |