]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Implement AES CTR ciphers in the default provider
authorMatt Caswell <matt@openssl.org>
Mon, 8 Apr 2019 16:19:59 +0000 (17:19 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 19 Apr 2019 08:31:54 +0000 (09:31 +0100)
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8700)

crypto/evp/evp_enc.c
providers/common/ciphers/aes.c
providers/common/include/internal/provider_algs.h
providers/default/defltprov.c

index 160c04b57cfc1382bb699a569e2296705bff5207..31e590bd95f8203d8291c04a5d0f0921fe684962 100644 (file)
@@ -157,6 +157,9 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
         case NID_aes_256_cfb8:
         case NID_aes_192_cfb8:
         case NID_aes_128_cfb8:
+        case NID_aes_256_ctr:
+        case NID_aes_192_ctr:
+        case NID_aes_128_ctr:
             break;
         default:
             goto legacy;
index a7af6a6773bb0939b23379835f064493d47768e6..285fea6ea9c0925ccb53ba616e6a3f6b5b814c2d 100644 (file)
@@ -219,6 +219,12 @@ IMPLEMENT_new_ctx(cfb8, CFB, 256)
 IMPLEMENT_new_ctx(cfb8, CFB, 192)
 IMPLEMENT_new_ctx(cfb8, CFB, 128)
 
+/* CTR */
+IMPLEMENT_new_params(ctr, CTR)
+IMPLEMENT_new_ctx(ctr, CTR, 256)
+IMPLEMENT_new_ctx(ctr, CTR, 192)
+IMPLEMENT_new_ctx(ctr, CTR, 128)
+
 static void aes_freectx(void *vctx)
 {
     PROV_AES_KEY *ctx = (PROV_AES_KEY *)vctx;
@@ -362,3 +368,8 @@ IMPLEMENT_stream_funcs(cfb1, 128, 16)
 IMPLEMENT_stream_funcs(cfb8, 256, 16)
 IMPLEMENT_stream_funcs(cfb8, 192, 16)
 IMPLEMENT_stream_funcs(cfb8, 128, 16)
+
+/* CTR */
+IMPLEMENT_stream_funcs(ctr, 256, 16)
+IMPLEMENT_stream_funcs(ctr, 192, 16)
+IMPLEMENT_stream_funcs(ctr, 128, 16)
index 40d7eca3045b1ff64804799524da14a6408d0594..dd9211bbbcf9f9656371fac84625bbbb06316ebe 100644 (file)
@@ -29,3 +29,6 @@ extern const OSSL_DISPATCH aes128cfb1_functions[];
 extern const OSSL_DISPATCH aes256cfb8_functions[];
 extern const OSSL_DISPATCH aes192cfb8_functions[];
 extern const OSSL_DISPATCH aes128cfb8_functions[];
+extern const OSSL_DISPATCH aes256ctr_functions[];
+extern const OSSL_DISPATCH aes192ctr_functions[];
+extern const OSSL_DISPATCH aes128ctr_functions[];
index 54b3b8c9addf454a7e81982c00b8eb9c21acff42..cba2dccf03517c7ca5a3e23dfccaa33c280bbcf3 100644 (file)
@@ -74,6 +74,9 @@ static const OSSL_ALGORITHM deflt_ciphers[] = {
     { "AES-256-CFB8", "default=yes", aes256cfb8_functions },
     { "AES-192-CFB8", "default=yes", aes192cfb8_functions },
     { "AES-128-CFB8", "default=yes", aes128cfb8_functions },
+    { "AES-256-CTR", "default=yes", aes256ctr_functions },
+    { "AES-192-CTR", "default=yes", aes192ctr_functions },
+    { "AES-128-CTR", "default=yes", aes128ctr_functions },
     { NULL, NULL, NULL }
 };