]> git.kaiwu.me - njs.git/commitdiff
WebCrypto: added missed support for AES-* keys of size 192.
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 30 Dec 2022 04:46:21 +0000 (20:46 -0800)
committerDmitry Volyntsev <xeioex@nginx.com>
Fri, 30 Dec 2022 04:46:21 +0000 (20:46 -0800)
external/njs_webcrypto_module.c
test/webcrypto/aes.t.js

index 886dcb7c1d05abe707b56bb52d5bf1eb68e98a37..bedc0c224a52db845775b73adb0746d8b6e03a34 100644 (file)
@@ -663,6 +663,10 @@ njs_cipher_aes_gcm(njs_vm_t *vm, njs_str_t *data, njs_webcrypto_key_t *key,
         cipher = EVP_aes_128_gcm();
         break;
 
+    case 24:
+        cipher = EVP_aes_192_gcm();
+        break;
+
     case 32:
         cipher = EVP_aes_256_gcm();
         break;
@@ -961,6 +965,10 @@ njs_cipher_aes_ctr(njs_vm_t *vm, njs_str_t *data, njs_webcrypto_key_t *key,
         cipher = EVP_aes_128_ctr();
         break;
 
+    case 24:
+        cipher = EVP_aes_192_ctr();
+        break;
+
     case 32:
         cipher = EVP_aes_256_ctr();
         break;
@@ -1162,6 +1170,10 @@ njs_cipher_aes_cbc(njs_vm_t *vm, njs_str_t *data, njs_webcrypto_key_t *key,
         cipher = EVP_aes_128_cbc();
         break;
 
+    case 24:
+        cipher = EVP_aes_192_cbc();
+        break;
+
     case 32:
         cipher = EVP_aes_256_cbc();
         break;
index 03acd6d774bbb4c0dd3ad612b7744083fafa38d5..1f5c136f84637bf1d53725d7b11231c0838a0b73 100644 (file)
@@ -66,6 +66,7 @@ let aes_tsuite = {
         { name: "AES-GCM", data: "aabbcc", tagLength: 112 },
         { name: "AES-GCM", data: "aabbcc", tagLength: 113, exception: "TypeError: AES-GCM Invalid tagLength" },
         { name: "AES-GCM", data: "aabbcc", key: "aabbcc", exception: "TypeError: Invalid key length" },
+        { name: "AES-GCM", data: "aabbcc", key: "001122330011223300112233001122330011223300112233" },
         { name: "AES-GCM", data: "aabbccdd".repeat(4096) },
 
         { name: "AES-CTR", data: "aa" },
@@ -84,6 +85,7 @@ let aes_tsuite = {
         { name: "AES-CTR", data: "aabbccdd".repeat(4096), counter: "ffffffffffffffffffffffffffffffff", length: 11 },
         { name: "AES-CTR", data: "aabbccdd".repeat(4096), length: 20 },
         { name: "AES-CTR", data: "aabbccdd".repeat(4096), length: 24 },
+        { name: "AES-CTR", data: "aabbcc", key: "001122330011223300112233001122330011223300112233" },
         { name: "AES-CTR", data: "aabbccdd", length: 129,
           exception: "TypeError: AES-CTR algorithm.length must be between 1 and 128" },
         { name: "AES-CTR", data: "aabbcc", key: "aabbcc", exception: "TypeError: Invalid key length" },
@@ -92,6 +94,7 @@ let aes_tsuite = {
         { name: "AES-CBC", data: "aabbccdd".repeat(4) },
         { name: "AES-CBC", data: "aabbccdd".repeat(4096) },
         { name: "AES-CBC", data: "aabbccdd".repeat(5), iv: "ffffffffffffffffffffffffffffffff" },
+        { name: "AES-CBC", data: "aabbcc", key: "001122330011223300112233001122330011223300112233" },
         { name: "AES-CBC", data: "aabbcc", key: "aabbcc", exception: "TypeError: Invalid key length" },
 ]};