summaryrefslogtreecommitdiffstats
path: root/content/renderer/webcrypto/webcrypto_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/renderer/webcrypto/webcrypto_util.cc')
-rw-r--r--content/renderer/webcrypto/webcrypto_util.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/content/renderer/webcrypto/webcrypto_util.cc b/content/renderer/webcrypto/webcrypto_util.cc
index 977c282..c5dff97 100644
--- a/content/renderer/webcrypto/webcrypto_util.cc
+++ b/content/renderer/webcrypto/webcrypto_util.cc
@@ -172,6 +172,21 @@ blink::WebCryptoAlgorithm CreateAesGcmKeyGenAlgorithm(
key_length_bits);
}
+unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id) {
+ switch (hash_id) {
+ case blink::WebCryptoAlgorithmIdSha1:
+ case blink::WebCryptoAlgorithmIdSha224:
+ case blink::WebCryptoAlgorithmIdSha256:
+ return 64;
+ case blink::WebCryptoAlgorithmIdSha384:
+ case blink::WebCryptoAlgorithmIdSha512:
+ return 128;
+ default:
+ NOTREACHED();
+ return 0;
+ }
+}
+
} // namespace webcrypto
} // namespace content