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

Unified Diff: content/renderer/webcrypto/webcrypto_util.cc

Issue 155623005: Refactor to share more code between OpenSSL and NSS implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for openssl Created 6 years, 10 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/renderer/webcrypto/webcrypto_util.cc
diff --git a/content/renderer/webcrypto/webcrypto_util.cc b/content/renderer/webcrypto/webcrypto_util.cc
index 3124afa7dfdf2594f575ba43149d29a155896d17..c74eebf63bb09858ffb109781ad845079061407a 100644
--- a/content/renderer/webcrypto/webcrypto_util.cc
+++ b/content/renderer/webcrypto/webcrypto_util.cc
@@ -107,6 +107,10 @@ Status Status::ErrorUnexpectedKeyType() {
return Status("The key is not of the expected type");
}
+Status Status::ErrorKeyAlgorithmMismatch() {
+ return Status("The key's algorithm doesn't match that of operation");
+}
+
Status Status::ErrorIncorrectSizeAesCbcIv() {
return Status("The \"iv\" has an unexpected length -- must be 16 bytes");
}
@@ -326,6 +330,14 @@ unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id) {
}
}
+bool IsAlgorithmAsymmetric(const blink::WebCryptoAlgorithm& algorithm) {
+ // TODO(padolph): include all other asymmetric algorithms once they are
+ // defined, e.g. EC and DH.
+ return (algorithm.id() == blink::WebCryptoAlgorithmIdRsaEsPkcs1v1_5 ||
+ algorithm.id() == blink::WebCryptoAlgorithmIdRsaSsaPkcs1v1_5 ||
+ algorithm.id() == blink::WebCryptoAlgorithmIdRsaOaep);
+}
+
} // namespace webcrypto
} // namespace content
« content/renderer/webcrypto/webcrypto_util.h ('K') | « content/renderer/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698