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

Unified Diff: content/child/webcrypto/openssl/util_openssl.cc

Issue 379383002: Refactor WebCrypto code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto master Created 6 years, 5 months 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: content/child/webcrypto/openssl/util_openssl.cc
diff --git a/content/child/webcrypto/crypto_data.cc b/content/child/webcrypto/openssl/util_openssl.cc
similarity index 27%
copy from content/child/webcrypto/crypto_data.cc
copy to content/child/webcrypto/openssl/util_openssl.cc
index 29736418ae5b1de0716b530b631da8604453237e..110057e884e1181f42a4cf76ab4d3453fd1cbf53 100644
--- a/content/child/webcrypto/crypto_data.cc
+++ b/content/child/webcrypto/openssl/util_openssl.cc
@@ -2,27 +2,46 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "content/child/webcrypto/openssl/util_openssl.h"
+
+#include <openssl/evp.h>
+
#include "content/child/webcrypto/crypto_data.h"
+#include "content/child/webcrypto/platform_crypto.h"
+#include "crypto/openssl_util.h"
namespace content {
namespace webcrypto {
-CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) {}
-
-CryptoData::CryptoData(const unsigned char* bytes, unsigned int byte_length)
- : bytes_(bytes), byte_length_(byte_length) {}
-
-CryptoData::CryptoData(const std::vector<unsigned char>& bytes)
- : bytes_(bytes.size() ? &bytes[0] : NULL), byte_length_(bytes.size()) {}
-
-CryptoData::CryptoData(const std::string& bytes)
- : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data())
- : NULL),
- byte_length_(bytes.size()) {}
-
-CryptoData::CryptoData(const blink::WebVector<unsigned char>& bytes)
- : bytes_(bytes.data()), byte_length_(bytes.size()) {}
+void PlatformInit() {
+ crypto::EnsureOpenSSLInit();
+}
+
+const EVP_MD* GetDigest(blink::WebCryptoAlgorithmId id) {
+ switch (id) {
+ case blink::WebCryptoAlgorithmIdSha1:
+ return EVP_sha1();
+ case blink::WebCryptoAlgorithmIdSha256:
+ return EVP_sha256();
+ case blink::WebCryptoAlgorithmIdSha384:
+ return EVP_sha384();
+ case blink::WebCryptoAlgorithmIdSha512:
+ return EVP_sha512();
+ default:
+ return NULL;
+ }
+}
+
+AlgorithmImplementation* CreatePlatformRsaOaepImplementation() {
+ // TODO(eroman):
+ return NULL;
+}
+
+AlgorithmImplementation* CreatePlatformRsaSsaImplementation() {
+ // TODO(eroman):
+ return NULL;
+}
} // namespace webcrypto

Powered by Google App Engine
This is Rietveld 408576698