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

Unified Diff: net/http/des.cc

Issue 5195001: Fixes the remaining net_unittests for OpenSSL, with the exceptions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clarify comment Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698