aboutsummaryrefslogtreecommitdiff
path: root/providers
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-04-08 17:19:59 +0100
committerMatt Caswell <matt@openssl.org>2019-04-19 09:31:54 +0100
commit819a7ae9fc7721f675757c0925821f91b20dfc8f (patch)
tree74581c672aae6ae1a1aeb7e9403625de5edf893c /providers
parent75dd6d64f1f3afd6fda024d8d91bc2a216bbfcf9 (diff)
downloadopenssl-819a7ae9fc7721f675757c0925821f91b20dfc8f.zip
openssl-819a7ae9fc7721f675757c0925821f91b20dfc8f.tar.gz
openssl-819a7ae9fc7721f675757c0925821f91b20dfc8f.tar.bz2
Implement AES CTR ciphers in the default provider
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/8700)
Diffstat (limited to 'providers')
-rw-r--r--providers/common/ciphers/aes.c11
-rw-r--r--providers/common/include/internal/provider_algs.h3
-rw-r--r--providers/default/defltprov.c3
3 files changed, 17 insertions, 0 deletions
diff --git a/providers/common/ciphers/aes.c b/providers/common/ciphers/aes.c
index a7af6a6..285fea6 100644
--- a/providers/common/ciphers/aes.c
+++ b/providers/common/ciphers/aes.c
@@ -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)
diff --git a/providers/common/include/internal/provider_algs.h b/providers/common/include/internal/provider_algs.h
index 40d7eca..dd9211b 100644
--- a/providers/common/include/internal/provider_algs.h
+++ b/providers/common/include/internal/provider_algs.h
@@ -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[];
diff --git a/providers/default/defltprov.c b/providers/default/defltprov.c
index 54b3b8c..cba2dcc 100644
--- a/providers/default/defltprov.c
+++ b/providers/default/defltprov.c
@@ -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 }
};