]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
crypto: inside-secure - Move static cipher alg & mode settings to init
authorPascal van Leeuwen <pascalvanl@gmail.com>
Fri, 30 Aug 2019 07:40:52 +0000 (09:40 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 5 Sep 2019 04:36:55 +0000 (14:36 +1000)
ctx->alg and ctx->mode were set from safexcel_send_req through the
various safexcel_encrypt and _decrypt routines, but this makes little
sense as these are static per ciphersuite. So moved to _init instead,
in preparation of adding more ciphersuites.

Signed-off-by: Pascal van Leeuwen <pvanleeuwen@verimatrix.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/inside-secure/safexcel_cipher.c

index 8f0fecc0dafa09297c2ed6ae5074e67c11f42965..ba40166897f90354b8db307d323dd4cd2c6b2a41 100644 (file)
@@ -903,8 +903,7 @@ static int safexcel_aead_exit_inv(struct crypto_tfm *tfm)
 
 static int safexcel_queue_req(struct crypto_async_request *base,
                        struct safexcel_cipher_req *sreq,
-                       enum safexcel_cipher_direction dir, u32 mode,
-                       enum safexcel_cipher_alg alg)
+                       enum safexcel_cipher_direction dir)
 {
        struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(base->tfm);
        struct safexcel_crypto_priv *priv = ctx->priv;
@@ -912,8 +911,6 @@ static int safexcel_queue_req(struct crypto_async_request *base,
 
        sreq->needs_inv = false;
        sreq->direction = dir;
-       ctx->alg = alg;
-       ctx->mode = mode;
 
        if (ctx->base.ctxr) {
                if (priv->flags & EIP197_TRC_CACHE && ctx->base.needs_inv) {
@@ -941,18 +938,16 @@ static int safexcel_queue_req(struct crypto_async_request *base,
        return ret;
 }
 
-static int safexcel_ecb_aes_encrypt(struct skcipher_request *req)
+static int safexcel_encrypt(struct skcipher_request *req)
 {
        return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_ENCRYPT, CONTEXT_CONTROL_CRYPTO_MODE_ECB,
-                       SAFEXCEL_AES);
+                       SAFEXCEL_ENCRYPT);
 }
 
-static int safexcel_ecb_aes_decrypt(struct skcipher_request *req)
+static int safexcel_decrypt(struct skcipher_request *req)
 {
        return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_DECRYPT, CONTEXT_CONTROL_CRYPTO_MODE_ECB,
-                       SAFEXCEL_AES);
+                       SAFEXCEL_DECRYPT);
 }
 
 static int safexcel_skcipher_cra_init(struct crypto_tfm *tfm)
@@ -1026,12 +1021,22 @@ static void safexcel_aead_cra_exit(struct crypto_tfm *tfm)
        }
 }
 
+static int safexcel_skcipher_aes_ecb_cra_init(struct crypto_tfm *tfm)
+{
+       struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       safexcel_skcipher_cra_init(tfm);
+       ctx->alg  = SAFEXCEL_AES;
+       ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_ECB;
+       return 0;
+}
+
 struct safexcel_alg_template safexcel_alg_ecb_aes = {
        .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
        .alg.skcipher = {
                .setkey = safexcel_skcipher_aes_setkey,
-               .encrypt = safexcel_ecb_aes_encrypt,
-               .decrypt = safexcel_ecb_aes_decrypt,
+               .encrypt = safexcel_encrypt,
+               .decrypt = safexcel_decrypt,
                .min_keysize = AES_MIN_KEY_SIZE,
                .max_keysize = AES_MAX_KEY_SIZE,
                .base = {
@@ -1043,33 +1048,29 @@ struct safexcel_alg_template safexcel_alg_ecb_aes = {
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_ctxsize = sizeof(struct safexcel_cipher_ctx),
                        .cra_alignmask = 0,
-                       .cra_init = safexcel_skcipher_cra_init,
+                       .cra_init = safexcel_skcipher_aes_ecb_cra_init,
                        .cra_exit = safexcel_skcipher_cra_exit,
                        .cra_module = THIS_MODULE,
                },
        },
 };
 
-static int safexcel_cbc_aes_encrypt(struct skcipher_request *req)
+static int safexcel_skcipher_aes_cbc_cra_init(struct crypto_tfm *tfm)
 {
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_ENCRYPT, CONTEXT_CONTROL_CRYPTO_MODE_CBC,
-                       SAFEXCEL_AES);
-}
+       struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(tfm);
 
-static int safexcel_cbc_aes_decrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_DECRYPT, CONTEXT_CONTROL_CRYPTO_MODE_CBC,
-                       SAFEXCEL_AES);
+       safexcel_skcipher_cra_init(tfm);
+       ctx->alg  = SAFEXCEL_AES;
+       ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_CBC;
+       return 0;
 }
 
 struct safexcel_alg_template safexcel_alg_cbc_aes = {
        .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
        .alg.skcipher = {
                .setkey = safexcel_skcipher_aes_setkey,
-               .encrypt = safexcel_cbc_aes_encrypt,
-               .decrypt = safexcel_cbc_aes_decrypt,
+               .encrypt = safexcel_encrypt,
+               .decrypt = safexcel_decrypt,
                .min_keysize = AES_MIN_KEY_SIZE,
                .max_keysize = AES_MAX_KEY_SIZE,
                .ivsize = AES_BLOCK_SIZE,
@@ -1082,27 +1083,13 @@ struct safexcel_alg_template safexcel_alg_cbc_aes = {
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_ctxsize = sizeof(struct safexcel_cipher_ctx),
                        .cra_alignmask = 0,
-                       .cra_init = safexcel_skcipher_cra_init,
+                       .cra_init = safexcel_skcipher_aes_cbc_cra_init,
                        .cra_exit = safexcel_skcipher_cra_exit,
                        .cra_module = THIS_MODULE,
                },
        },
 };
 
-static int safexcel_ctr_aes_encrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_ENCRYPT, CONTEXT_CONTROL_CRYPTO_MODE_CTR_LOAD,
-                       SAFEXCEL_AES);
-}
-
-static int safexcel_ctr_aes_decrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_DECRYPT, CONTEXT_CONTROL_CRYPTO_MODE_CTR_LOAD,
-                       SAFEXCEL_AES);
-}
-
 static int safexcel_skcipher_aesctr_setkey(struct crypto_skcipher *ctfm,
                                           const u8 *key, unsigned int len)
 {
@@ -1141,12 +1128,22 @@ static int safexcel_skcipher_aesctr_setkey(struct crypto_skcipher *ctfm,
        return 0;
 }
 
+static int safexcel_skcipher_aes_ctr_cra_init(struct crypto_tfm *tfm)
+{
+       struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       safexcel_skcipher_cra_init(tfm);
+       ctx->alg  = SAFEXCEL_AES;
+       ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_CTR_LOAD;
+       return 0;
+}
+
 struct safexcel_alg_template safexcel_alg_ctr_aes = {
        .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
        .alg.skcipher = {
                .setkey = safexcel_skcipher_aesctr_setkey,
-               .encrypt = safexcel_ctr_aes_encrypt,
-               .decrypt = safexcel_ctr_aes_decrypt,
+               .encrypt = safexcel_encrypt,
+               .decrypt = safexcel_decrypt,
                /* Add nonce size */
                .min_keysize = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
                .max_keysize = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
@@ -1160,27 +1157,13 @@ struct safexcel_alg_template safexcel_alg_ctr_aes = {
                        .cra_blocksize = 1,
                        .cra_ctxsize = sizeof(struct safexcel_cipher_ctx),
                        .cra_alignmask = 0,
-                       .cra_init = safexcel_skcipher_cra_init,
+                       .cra_init = safexcel_skcipher_aes_ctr_cra_init,
                        .cra_exit = safexcel_skcipher_cra_exit,
                        .cra_module = THIS_MODULE,
                },
        },
 };
 
-static int safexcel_cbc_des_encrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_ENCRYPT, CONTEXT_CONTROL_CRYPTO_MODE_CBC,
-                       SAFEXCEL_DES);
-}
-
-static int safexcel_cbc_des_decrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_DECRYPT, CONTEXT_CONTROL_CRYPTO_MODE_CBC,
-                       SAFEXCEL_DES);
-}
-
 static int safexcel_des_setkey(struct crypto_skcipher *ctfm, const u8 *key,
                               unsigned int len)
 {
@@ -1202,12 +1185,22 @@ static int safexcel_des_setkey(struct crypto_skcipher *ctfm, const u8 *key,
        return 0;
 }
 
+static int safexcel_skcipher_des_cbc_cra_init(struct crypto_tfm *tfm)
+{
+       struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       safexcel_skcipher_cra_init(tfm);
+       ctx->alg  = SAFEXCEL_DES;
+       ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_CBC;
+       return 0;
+}
+
 struct safexcel_alg_template safexcel_alg_cbc_des = {
        .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
        .alg.skcipher = {
                .setkey = safexcel_des_setkey,
-               .encrypt = safexcel_cbc_des_encrypt,
-               .decrypt = safexcel_cbc_des_decrypt,
+               .encrypt = safexcel_encrypt,
+               .decrypt = safexcel_decrypt,
                .min_keysize = DES_KEY_SIZE,
                .max_keysize = DES_KEY_SIZE,
                .ivsize = DES_BLOCK_SIZE,
@@ -1220,33 +1213,29 @@ struct safexcel_alg_template safexcel_alg_cbc_des = {
                        .cra_blocksize = DES_BLOCK_SIZE,
                        .cra_ctxsize = sizeof(struct safexcel_cipher_ctx),
                        .cra_alignmask = 0,
-                       .cra_init = safexcel_skcipher_cra_init,
+                       .cra_init = safexcel_skcipher_des_cbc_cra_init,
                        .cra_exit = safexcel_skcipher_cra_exit,
                        .cra_module = THIS_MODULE,
                },
        },
 };
 
-static int safexcel_ecb_des_encrypt(struct skcipher_request *req)
+static int safexcel_skcipher_des_ecb_cra_init(struct crypto_tfm *tfm)
 {
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_ENCRYPT, CONTEXT_CONTROL_CRYPTO_MODE_ECB,
-                       SAFEXCEL_DES);
-}
+       struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(tfm);
 
-static int safexcel_ecb_des_decrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_DECRYPT, CONTEXT_CONTROL_CRYPTO_MODE_ECB,
-                       SAFEXCEL_DES);
+       safexcel_skcipher_cra_init(tfm);
+       ctx->alg  = SAFEXCEL_DES;
+       ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_ECB;
+       return 0;
 }
 
 struct safexcel_alg_template safexcel_alg_ecb_des = {
        .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
        .alg.skcipher = {
                .setkey = safexcel_des_setkey,
-               .encrypt = safexcel_ecb_des_encrypt,
-               .decrypt = safexcel_ecb_des_decrypt,
+               .encrypt = safexcel_encrypt,
+               .decrypt = safexcel_decrypt,
                .min_keysize = DES_KEY_SIZE,
                .max_keysize = DES_KEY_SIZE,
                .base = {
@@ -1258,27 +1247,13 @@ struct safexcel_alg_template safexcel_alg_ecb_des = {
                        .cra_blocksize = DES_BLOCK_SIZE,
                        .cra_ctxsize = sizeof(struct safexcel_cipher_ctx),
                        .cra_alignmask = 0,
-                       .cra_init = safexcel_skcipher_cra_init,
+                       .cra_init = safexcel_skcipher_des_ecb_cra_init,
                        .cra_exit = safexcel_skcipher_cra_exit,
                        .cra_module = THIS_MODULE,
                },
        },
 };
 
-static int safexcel_cbc_des3_ede_encrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_ENCRYPT, CONTEXT_CONTROL_CRYPTO_MODE_CBC,
-                       SAFEXCEL_3DES);
-}
-
-static int safexcel_cbc_des3_ede_decrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_DECRYPT, CONTEXT_CONTROL_CRYPTO_MODE_CBC,
-                       SAFEXCEL_3DES);
-}
-
 static int safexcel_des3_ede_setkey(struct crypto_skcipher *ctfm,
                                   const u8 *key, unsigned int len)
 {
@@ -1302,12 +1277,22 @@ static int safexcel_des3_ede_setkey(struct crypto_skcipher *ctfm,
        return 0;
 }
 
+static int safexcel_skcipher_des3_cbc_cra_init(struct crypto_tfm *tfm)
+{
+       struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(tfm);
+
+       safexcel_skcipher_cra_init(tfm);
+       ctx->alg  = SAFEXCEL_3DES;
+       ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_CBC;
+       return 0;
+}
+
 struct safexcel_alg_template safexcel_alg_cbc_des3_ede = {
        .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
        .alg.skcipher = {
                .setkey = safexcel_des3_ede_setkey,
-               .encrypt = safexcel_cbc_des3_ede_encrypt,
-               .decrypt = safexcel_cbc_des3_ede_decrypt,
+               .encrypt = safexcel_encrypt,
+               .decrypt = safexcel_decrypt,
                .min_keysize = DES3_EDE_KEY_SIZE,
                .max_keysize = DES3_EDE_KEY_SIZE,
                .ivsize = DES3_EDE_BLOCK_SIZE,
@@ -1320,33 +1305,29 @@ struct safexcel_alg_template safexcel_alg_cbc_des3_ede = {
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_ctxsize = sizeof(struct safexcel_cipher_ctx),
                        .cra_alignmask = 0,
-                       .cra_init = safexcel_skcipher_cra_init,
+                       .cra_init = safexcel_skcipher_des3_cbc_cra_init,
                        .cra_exit = safexcel_skcipher_cra_exit,
                        .cra_module = THIS_MODULE,
                },
        },
 };
 
-static int safexcel_ecb_des3_ede_encrypt(struct skcipher_request *req)
+static int safexcel_skcipher_des3_ecb_cra_init(struct crypto_tfm *tfm)
 {
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_ENCRYPT, CONTEXT_CONTROL_CRYPTO_MODE_ECB,
-                       SAFEXCEL_3DES);
-}
+       struct safexcel_cipher_ctx *ctx = crypto_tfm_ctx(tfm);
 
-static int safexcel_ecb_des3_ede_decrypt(struct skcipher_request *req)
-{
-       return safexcel_queue_req(&req->base, skcipher_request_ctx(req),
-                       SAFEXCEL_DECRYPT, CONTEXT_CONTROL_CRYPTO_MODE_ECB,
-                       SAFEXCEL_3DES);
+       safexcel_skcipher_cra_init(tfm);
+       ctx->alg  = SAFEXCEL_3DES;
+       ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_ECB;
+       return 0;
 }
 
 struct safexcel_alg_template safexcel_alg_ecb_des3_ede = {
        .type = SAFEXCEL_ALG_TYPE_SKCIPHER,
        .alg.skcipher = {
                .setkey = safexcel_des3_ede_setkey,
-               .encrypt = safexcel_ecb_des3_ede_encrypt,
-               .decrypt = safexcel_ecb_des3_ede_decrypt,
+               .encrypt = safexcel_encrypt,
+               .decrypt = safexcel_decrypt,
                .min_keysize = DES3_EDE_KEY_SIZE,
                .max_keysize = DES3_EDE_KEY_SIZE,
                .base = {
@@ -1358,27 +1339,25 @@ struct safexcel_alg_template safexcel_alg_ecb_des3_ede = {
                        .cra_blocksize = DES3_EDE_BLOCK_SIZE,
                        .cra_ctxsize = sizeof(struct safexcel_cipher_ctx),
                        .cra_alignmask = 0,
-                       .cra_init = safexcel_skcipher_cra_init,
+                       .cra_init = safexcel_skcipher_des3_ecb_cra_init,
                        .cra_exit = safexcel_skcipher_cra_exit,
                        .cra_module = THIS_MODULE,
                },
        },
 };
 
-static int safexcel_aead_encrypt_aes(struct aead_request *req)
+static int safexcel_aead_encrypt(struct aead_request *req)
 {
        struct safexcel_cipher_req *creq = aead_request_ctx(req);
 
-       return safexcel_queue_req(&req->base, creq, SAFEXCEL_ENCRYPT,
-                       CONTEXT_CONTROL_CRYPTO_MODE_CBC, SAFEXCEL_AES);
+       return safexcel_queue_req(&req->base, creq, SAFEXCEL_ENCRYPT);
 }
 
-static int safexcel_aead_decrypt_aes(struct aead_request *req)
+static int safexcel_aead_decrypt(struct aead_request *req)
 {
        struct safexcel_cipher_req *creq = aead_request_ctx(req);
 
-       return safexcel_queue_req(&req->base, creq, SAFEXCEL_DECRYPT,
-                       CONTEXT_CONTROL_CRYPTO_MODE_CBC, SAFEXCEL_AES);
+       return safexcel_queue_req(&req->base, creq, SAFEXCEL_DECRYPT);
 }
 
 static int safexcel_aead_cra_init(struct crypto_tfm *tfm)
@@ -1394,6 +1373,7 @@ static int safexcel_aead_cra_init(struct crypto_tfm *tfm)
        ctx->priv = tmpl->priv;
 
        ctx->alg  = SAFEXCEL_AES; /* default */
+       ctx->mode = CONTEXT_CONTROL_CRYPTO_MODE_CBC; /* default */
        ctx->aead = true;
        ctx->base.send = safexcel_aead_send;
        ctx->base.handle_result = safexcel_aead_handle_result;
@@ -1414,8 +1394,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = AES_BLOCK_SIZE,
                .maxauthsize = SHA1_DIGEST_SIZE,
                .base = {
@@ -1448,8 +1428,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_cbc_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = AES_BLOCK_SIZE,
                .maxauthsize = SHA256_DIGEST_SIZE,
                .base = {
@@ -1482,8 +1462,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_cbc_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = AES_BLOCK_SIZE,
                .maxauthsize = SHA224_DIGEST_SIZE,
                .base = {
@@ -1516,8 +1496,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_cbc_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = AES_BLOCK_SIZE,
                .maxauthsize = SHA512_DIGEST_SIZE,
                .base = {
@@ -1550,8 +1530,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_cbc_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = AES_BLOCK_SIZE,
                .maxauthsize = SHA384_DIGEST_SIZE,
                .base = {
@@ -1579,28 +1559,12 @@ static int safexcel_aead_sha1_des3_cra_init(struct crypto_tfm *tfm)
        return 0;
 }
 
-static int safexcel_aead_encrypt_3des(struct aead_request *req)
-{
-       struct safexcel_cipher_req *creq = aead_request_ctx(req);
-
-       return safexcel_queue_req(&req->base, creq, SAFEXCEL_ENCRYPT,
-                       CONTEXT_CONTROL_CRYPTO_MODE_CBC, SAFEXCEL_3DES);
-}
-
-static int safexcel_aead_decrypt_3des(struct aead_request *req)
-{
-       struct safexcel_cipher_req *creq = aead_request_ctx(req);
-
-       return safexcel_queue_req(&req->base, creq, SAFEXCEL_DECRYPT,
-                       CONTEXT_CONTROL_CRYPTO_MODE_CBC, SAFEXCEL_3DES);
-}
-
 struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_cbc_des3_ede = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_3des,
-               .decrypt = safexcel_aead_decrypt_3des,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = DES3_EDE_BLOCK_SIZE,
                .maxauthsize = SHA1_DIGEST_SIZE,
                .base = {
@@ -1632,8 +1596,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha1_ctr_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = CTR_RFC3686_IV_SIZE,
                .maxauthsize = SHA1_DIGEST_SIZE,
                .base = {
@@ -1665,8 +1629,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha256_ctr_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = CTR_RFC3686_IV_SIZE,
                .maxauthsize = SHA256_DIGEST_SIZE,
                .base = {
@@ -1698,8 +1662,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha224_ctr_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = CTR_RFC3686_IV_SIZE,
                .maxauthsize = SHA224_DIGEST_SIZE,
                .base = {
@@ -1731,8 +1695,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha512_ctr_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = CTR_RFC3686_IV_SIZE,
                .maxauthsize = SHA512_DIGEST_SIZE,
                .base = {
@@ -1764,8 +1728,8 @@ struct safexcel_alg_template safexcel_alg_authenc_hmac_sha384_ctr_aes = {
        .type = SAFEXCEL_ALG_TYPE_AEAD,
        .alg.aead = {
                .setkey = safexcel_aead_setkey,
-               .encrypt = safexcel_aead_encrypt_aes,
-               .decrypt = safexcel_aead_decrypt_aes,
+               .encrypt = safexcel_aead_encrypt,
+               .decrypt = safexcel_aead_decrypt,
                .ivsize = CTR_RFC3686_IV_SIZE,
                .maxauthsize = SHA384_DIGEST_SIZE,
                .base = {