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

Unified Diff: content/child/webcrypto/shared_crypto.cc

Issue 211943002: [webcrypto] Minor cleanup/consolidation of JWK source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes for eroman Created 6 years, 9 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/shared_crypto.cc
diff --git a/content/child/webcrypto/shared_crypto.cc b/content/child/webcrypto/shared_crypto.cc
index af2beaca2a672fbbca28886ed65115dfb49e5112..92aa342b321eb3f78adeed61e5a47dff2e5bda21 100644
--- a/content/child/webcrypto/shared_crypto.cc
+++ b/content/child/webcrypto/shared_crypto.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "content/child/webcrypto/crypto_data.h"
+#include "content/child/webcrypto/jwk.h"
#include "content/child/webcrypto/platform_crypto.h"
#include "content/child/webcrypto/status.h"
#include "content/child/webcrypto/webcrypto_util.h"
@@ -483,6 +484,21 @@ Status WrapKeyExportAndEncrypt(
wrapping_algorithm, wrapping_key, CryptoData(exported_data), buffer);
}
+// Returns the internal block size for SHA-*
+unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id) {
+ switch (hash_id) {
+ case blink::WebCryptoAlgorithmIdSha1:
+ case blink::WebCryptoAlgorithmIdSha256:
+ return 64;
+ case blink::WebCryptoAlgorithmIdSha384:
+ case blink::WebCryptoAlgorithmIdSha512:
+ return 128;
+ default:
+ NOTREACHED();
+ return 0;
+ }
+}
+
} // namespace
void Init() { platform::Init(); }

Powered by Google App Engine
This is Rietveld 408576698