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

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

Issue 119413002: [webcrypto] Add key generation for AES-GCM and AES-KW for NSS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years 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
« no previous file with comments | « no previous file | content/renderer/webcrypto/webcrypto_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/webcrypto/webcrypto_impl_nss.cc
diff --git a/content/renderer/webcrypto/webcrypto_impl_nss.cc b/content/renderer/webcrypto/webcrypto_impl_nss.cc
index cf447adeb2d7b9f830292b9775aab5d531238688..fb9c275b70e650ac1d559583efce3e45420b3712 100644
--- a/content/renderer/webcrypto/webcrypto_impl_nss.cc
+++ b/content/renderer/webcrypto/webcrypto_impl_nss.cc
@@ -185,6 +185,8 @@ CK_MECHANISM_TYPE WebCryptoAlgorithmToGenMechanism(
const blink::WebCryptoAlgorithm& algorithm) {
switch (algorithm.id()) {
case blink::WebCryptoAlgorithmIdAesCbc:
+ case blink::WebCryptoAlgorithmIdAesGcm:
+ case blink::WebCryptoAlgorithmIdAesKw:
return CKM_AES_KEY_GEN;
case blink::WebCryptoAlgorithmIdHmac:
return WebCryptoHashToHMACMechanism(algorithm.hmacKeyParams()->hash());
@@ -644,10 +646,14 @@ bool WebCryptoImpl::GenerateKeyInternal(
}
switch (algorithm.id()) {
- case blink::WebCryptoAlgorithmIdAesCbc: {
+ case blink::WebCryptoAlgorithmIdAesCbc:
+ case blink::WebCryptoAlgorithmIdAesGcm:
+ case blink::WebCryptoAlgorithmIdAesKw: {
const blink::WebCryptoAesKeyGenParams* params =
algorithm.aesKeyGenParams();
DCHECK(params);
+ // Ensure the key length is a multiple of 8 bits. Let NSS verify further
+ // algorithm-specific length restrictions.
if (params->lengthBits() % 8)
return false;
keylen_bytes = params->lengthBits() / 8;
« no previous file with comments | « no previous file | content/renderer/webcrypto/webcrypto_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698