Implement AES CFB ciphers in the default provider
authorMatt Caswell <matt@openssl.org>
Mon, 8 Apr 2019 16:13:01 +0000 (17:13 +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 dd7bf9b..160c04b 100644 (file)
@@ -148,6 +148,15 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
         case NID_aes_256_ofb128:
         case NID_aes_192_ofb128:
         case NID_aes_128_ofb128:
+        case NID_aes_256_cfb128:
+        case NID_aes_192_cfb128:
+        case NID_aes_128_cfb128:
+        case NID_aes_256_cfb1:
+        case NID_aes_192_cfb1:
+        case NID_aes_128_cfb1:
+        case NID_aes_256_cfb8:
+        case NID_aes_192_cfb8:
+        case NID_aes_128_cfb8:
             break;
         default:
             goto legacy;
index 1f3a413..a7af6a6 100644 (file)
@@ -205,6 +205,19 @@ IMPLEMENT_new_ctx(ofb, OFB, 256)
 IMPLEMENT_new_ctx(ofb, OFB, 192)
 IMPLEMENT_new_ctx(ofb, OFB, 128)
 
+/* CFB */
+IMPLEMENT_new_params(cfb, CFB)
+IMPLEMENT_new_params(cfb1, CFB)
+IMPLEMENT_new_params(cfb8, CFB)
+IMPLEMENT_new_ctx(cfb, CFB, 256)
+IMPLEMENT_new_ctx(cfb, CFB, 192)
+IMPLEMENT_new_ctx(cfb, CFB, 128)
+IMPLEMENT_new_ctx(cfb1, CFB, 256)
+IMPLEMENT_new_ctx(cfb1, CFB, 192)
+IMPLEMENT_new_ctx(cfb1, CFB, 128)
+IMPLEMENT_new_ctx(cfb8, CFB, 256)
+IMPLEMENT_new_ctx(cfb8, CFB, 192)
+IMPLEMENT_new_ctx(cfb8, CFB, 128)
 
 static void aes_freectx(void *vctx)
 {
@@ -338,3 +351,14 @@ IMPLEMENT_block_funcs(cbc, 128, 16)
 IMPLEMENT_stream_funcs(ofb, 256, 16)
 IMPLEMENT_stream_funcs(ofb, 192, 16)
 IMPLEMENT_stream_funcs(ofb, 128, 16)
+
+/* CFB */
+IMPLEMENT_stream_funcs(cfb, 256, 16)
+IMPLEMENT_stream_funcs(cfb, 192, 16)
+IMPLEMENT_stream_funcs(cfb, 128, 16)
+IMPLEMENT_stream_funcs(cfb1, 256, 16)
+IMPLEMENT_stream_funcs(cfb1, 192, 16)
+IMPLEMENT_stream_funcs(cfb1, 128, 16)
+IMPLEMENT_stream_funcs(cfb8, 256, 16)
+IMPLEMENT_stream_funcs(cfb8, 192, 16)
+IMPLEMENT_stream_funcs(cfb8, 128, 16)
index 9bc9ba2..40d7eca 100644 (file)
@@ -20,3 +20,12 @@ extern const OSSL_DISPATCH aes128cbc_functions[];
 extern const OSSL_DISPATCH aes256ofb_functions[];
 extern const OSSL_DISPATCH aes192ofb_functions[];
 extern const OSSL_DISPATCH aes128ofb_functions[];
+extern const OSSL_DISPATCH aes256cfb_functions[];
+extern const OSSL_DISPATCH aes192cfb_functions[];
+extern const OSSL_DISPATCH aes128cfb_functions[];
+extern const OSSL_DISPATCH aes256cfb1_functions[];
+extern const OSSL_DISPATCH aes192cfb1_functions[];
+extern const OSSL_DISPATCH aes128cfb1_functions[];
+extern const OSSL_DISPATCH aes256cfb8_functions[];
+extern const OSSL_DISPATCH aes192cfb8_functions[];
+extern const OSSL_DISPATCH aes128cfb8_functions[];
index 24c10ad..54b3b8c 100644 (file)
@@ -65,6 +65,15 @@ static const OSSL_ALGORITHM deflt_ciphers[] = {
     { "AES-256-OFB", "default=yes", aes256ofb_functions },
     { "AES-192-OFB", "default=yes", aes192ofb_functions },
     { "AES-128-OFB", "default=yes", aes128ofb_functions },
+    { "AES-256-CFB", "default=yes", aes256cfb_functions },
+    { "AES-192-CFB", "default=yes", aes192cfb_functions },
+    { "AES-128-CFB", "default=yes", aes128cfb_functions },
+    { "AES-256-CFB1", "default=yes", aes256cfb1_functions },
+    { "AES-192-CFB1", "default=yes", aes192cfb1_functions },
+    { "AES-128-CFB1", "default=yes", aes128cfb1_functions },
+    { "AES-256-CFB8", "default=yes", aes256cfb8_functions },
+    { "AES-192-CFB8", "default=yes", aes192cfb8_functions },
+    { "AES-128-CFB8", "default=yes", aes128cfb8_functions },
     { NULL, NULL, NULL }
 };