aboutsummaryrefslogtreecommitdiff
path: root/drivers/crypto/amcc/crypto4xx_core.c
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-08-13 16:14:13 -0500
committerDavid Barksdale <amatus@amatus.name>2014-08-13 16:14:13 -0500
commitace6c6d243016e272050787c14e27a83ecd94a25 (patch)
treec837edb1ca98b2552fbc7edba47aeb63f98ca1f0 /drivers/crypto/amcc/crypto4xx_core.c
parent1b6e1688bd215cd7c9cb75650fa815a1ec6567e1 (diff)
Diffstat (limited to 'drivers/crypto/amcc/crypto4xx_core.c')
-rw-r--r--drivers/crypto/amcc/crypto4xx_core.c2899
1 files changed, 2857 insertions, 42 deletions
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 46e899ac924..8c00e30e9e6 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -28,17 +28,40 @@
#include <linux/platform_device.h>
#include <linux/init.h>
#include <linux/of_platform.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/highmem.h>
#include <asm/dcr.h>
#include <asm/dcr-regs.h>
#include <asm/cacheflush.h>
+#include <crypto/internal/hash.h>
+#include <crypto/algapi.h>
+#include <asm/ppc4xx_ocm.h>
+#include <crypto/internal/hash.h>
+#include <crypto/algapi.h>
#include <crypto/aes.h>
+#include <crypto/des.h>
#include <crypto/sha.h>
+#include <crypto/ctr.h>
#include "crypto4xx_reg_def.h"
#include "crypto4xx_core.h"
#include "crypto4xx_sa.h"
#define PPC4XX_SEC_VERSION_STR "0.5"
-
+void my_dump_Data(const u_char* dptr, u_int size)
+{
+ int i;
+ for (i = 0; i < size; i++) {
+ printk("0x%02x, ", dptr[i]);
+ if ((i+1) % 8 == 0)
+ printk(" ");
+ if ((i+1) % 16 == 0)
+ printk("\n");
+ }
+ printk("\n");
+}
+static struct proc_dir_entry *proc_crypto4xx = NULL;
+struct proc_dir_entry *entry;
/**
* PPC4xx Crypto Engine Initialization Routine
*/
@@ -72,16 +95,24 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
writel(pe_dma_cfg.w, dev->ce_base + CRYPTO4XX_PE_DMA_CFG);
writel(dev->pdr_pa, dev->ce_base + CRYPTO4XX_PDR_BASE);
writel(dev->pdr_pa, dev->ce_base + CRYPTO4XX_RDR_BASE);
- writel(PPC4XX_PRNG_CTRL_AUTO_EN, dev->ce_base + CRYPTO4XX_PRNG_CTRL);
get_random_bytes(&rand_num, sizeof(rand_num));
writel(rand_num, dev->ce_base + CRYPTO4XX_PRNG_SEED_L);
get_random_bytes(&rand_num, sizeof(rand_num));
writel(rand_num, dev->ce_base + CRYPTO4XX_PRNG_SEED_H);
+ writel(PPC4XX_PRNG_CTRL_AUTO_EN, dev->ce_base + CRYPTO4XX_PRNG_CTRL);
+
ring_size.w = 0;
ring_size.bf.ring_offset = PPC4XX_PD_SIZE;
ring_size.bf.ring_size = PPC4XX_NUM_PD;
writel(ring_size.w, dev->ce_base + CRYPTO4XX_RING_SIZE);
ring_ctrl.w = 0;
+
+ if (dev->core_dev->revb_ver == 1) {
+#ifdef CONFIG_SEC_HW_POLL
+ ring_ctrl.bf.ring_retry_divisor = CONFIG_SEC_HW_POLL_RETRY_FREQ;
+ ring_ctrl.bf.ring_poll_divisor = CONFIG_SEC_HW_RING_POLL_FREQ;
+#endif
+ }
writel(ring_ctrl.w, dev->ce_base + CRYPTO4XX_RING_CTRL);
writel(PPC4XX_DC_3DES_EN, dev->ce_base + CRYPTO4XX_DEVICE_CTRL);
writel(dev->gdr_pa, dev->ce_base + CRYPTO4XX_GATH_RING_BASE);
@@ -95,11 +126,19 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
io_threshold.bf.output_threshold = PPC4XX_OUTPUT_THRESHOLD;
io_threshold.bf.input_threshold = PPC4XX_INPUT_THRESHOLD;
writel(io_threshold.w, dev->ce_base + CRYPTO4XX_IO_THRESHOLD);
+
+#ifdef CONFIG_SEC_PD_OCM
+ writel((dev->pdr_ocm_addr >> 32), dev->ce_base + CRYPTO4XX_PDR_BASE_UADDR);
+ writel((dev->pdr_ocm_addr >> 32), dev->ce_base + CRYPTO4XX_RDR_BASE_UADDR);
+#else
writel(0, dev->ce_base + CRYPTO4XX_PDR_BASE_UADDR);
writel(0, dev->ce_base + CRYPTO4XX_RDR_BASE_UADDR);
+#endif
writel(0, dev->ce_base + CRYPTO4XX_PKT_SRC_UADDR);
writel(0, dev->ce_base + CRYPTO4XX_PKT_DEST_UADDR);
+
writel(0, dev->ce_base + CRYPTO4XX_SA_UADDR);
+
writel(0, dev->ce_base + CRYPTO4XX_GATH_RING_BASE_UADDR);
writel(0, dev->ce_base + CRYPTO4XX_SCAT_RING_BASE_UADDR);
/* un reset pe,sg and pdr */
@@ -112,13 +151,108 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
/*clear all pending interrupt*/
writel(PPC4XX_INTERRUPT_CLR, dev->ce_base + CRYPTO4XX_INT_CLR);
writel(PPC4XX_INT_DESCR_CNT, dev->ce_base + CRYPTO4XX_INT_DESCR_CNT);
- writel(PPC4XX_INT_DESCR_CNT, dev->ce_base + CRYPTO4XX_INT_DESCR_CNT);
- writel(PPC4XX_INT_CFG, dev->ce_base + CRYPTO4XX_INT_CFG);
- writel(PPC4XX_PD_DONE_INT, dev->ce_base + CRYPTO4XX_INT_EN);
+
+ if (dev->core_dev->revb_ver == 1) {
+ writel(PPC4XX_INT_TIMEOUT_CNT_REVB << 10,
+ dev->ce_base + CRYPTO4XX_INT_TIMEOUT_CNT);
+ /* For RevB, 460EX and 460ExR Rev B */
+ writel(PPC4XX_PD_DONE_INT | PPC4XX_TMO_ERR_INT,
+ dev->ce_base + CRYPTO4XX_INT_EN);
+ } else
+ writel(PPC4XX_PD_DONE_INT, dev->ce_base + CRYPTO4XX_INT_EN);
+}
+
+void crypto4xx_dump_regs(struct crypto4xx_core_device* core_dev)
+{
+ u32 reg_dump;
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_CTRL_STAT);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_PD_CTRL_STAT = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_SOURCE);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_Source_REG = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_DEST);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_Des_REG= 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_SA);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_SA_REG= 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_PE_DMA_CFG);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_PE_DMA_CFG = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_RING_SIZE);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_RING_SIZE = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_RING_CTRL);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_RING_CTRL = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_IO_THRESHOLD);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_IO_THRESHOLD = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_PE_DMA_STAT);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_PE_DMA_STAT= 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_PDR_BASE);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_PDR_BASE = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_STATE_PTR);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_STATE_PTR = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_SA_CMD_0);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_SA_CMD_0 = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_SA_CMD_1);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_SA_CMD_1 = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_SPI);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_SPI = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_SEQ_NUM0);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_SEQ_NUM_0 = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_SEQ_NUM1);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_SEQ_NUM_1 = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_STATE_IV + 0);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_STATE_IV + 0 = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_STATE_IV + 4);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_STATE_IV + 4 = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base +CRYPTO4XX_STATE_IV + 8);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_STATE_IV + 8 = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_STATE_IV + 12);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_STATE_IV + 12 = 0x%08x\n", reg_dump);
+
+ reg_dump = readl(core_dev->dev->ce_base + CRYPTO4XX_STATE_HASH_BYTE_CNT_0);
+ printk("crypto4xx_dump_regs: CRYPTO4XX_STATE_HASH_BYTE_CNT_0 = 0x%08x\n", reg_dump);
+
}
int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size)
{
+#ifdef CONFIG_SEC_SA_OCM
+ ctx->sa_out = ocm_alloc(&ctx->sa_out_ocm_addr, size * 4, 4,
+ OCM_NON_CACHED, "sec_sa_out");
+ ctx->sa_out_dma_addr = (u32)ctx->sa_out_ocm_addr;
+ printk("OCM Allocation done for SA Out %llx\n", (unsigned long long)ctx->sa_out_ocm_addr);
+ if (ctx->sa_out == NULL)
+ return -ENOMEM;
+ ctx->sa_in = ocm_alloc(&ctx->sa_in_ocm_addr, size * 4, 4,
+ OCM_NON_CACHED, "sec_sa_in");
+ if (ctx->sa_in == NULL) {
+ ocm_free(ctx->sa_out);
+ return -ENOMEM;
+ }
+ ctx->sa_in_dma_addr = (u32)ctx->sa_in_ocm_addr;
+ //printk("OCM Allocation done for SA In %llx\n", (unsigned long long)ctx->sa_in_ocm_addr);
+ memset(ctx->sa_in, 0, size * 4);
+ memset(ctx->sa_out, 0, size * 4);
+ ctx->sa_len = size;
+ return 0;
+#endif
ctx->sa_in = dma_alloc_coherent(ctx->dev->core_dev->device, size * 4,
&ctx->sa_in_dma_addr, GFP_ATOMIC);
if (ctx->sa_in == NULL)
@@ -142,6 +276,14 @@ int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size)
void crypto4xx_free_sa(struct crypto4xx_ctx *ctx)
{
+#ifdef CONFIG_SEC_SA_OCM
+ ocm_free(ctx->sa_out);
+ ocm_free(ctx->sa_in);
+ ctx->sa_in_dma_addr = 0;
+ ctx->sa_out_dma_addr = 0;
+ ctx->sa_len = 0;
+ return;
+#endif
if (ctx->sa_in != NULL)
dma_free_coherent(ctx->dev->core_dev->device, ctx->sa_len * 4,
ctx->sa_in, ctx->sa_in_dma_addr);
@@ -151,16 +293,28 @@ void crypto4xx_free_sa(struct crypto4xx_ctx *ctx)
ctx->sa_in_dma_addr = 0;
ctx->sa_out_dma_addr = 0;
+ ctx->sa_in = NULL;
+ ctx->sa_out = NULL;
ctx->sa_len = 0;
}
u32 crypto4xx_alloc_state_record(struct crypto4xx_ctx *ctx)
{
+#ifdef CONFIG_SEC_SA_OCM
+ ctx->state_record = ocm_alloc(&ctx->state_record_ocm_addr,
+ sizeof(struct sa_state_record), 4,
+ OCM_NON_CACHED, "sec_state_record");
+ if (ctx->state_record == NULL)
+ return -ENOMEM;
+ ctx->state_record_dma_addr = (u32)ctx->state_record_ocm_addr;
+#else
ctx->state_record = dma_alloc_coherent(ctx->dev->core_dev->device,
sizeof(struct sa_state_record),
&ctx->state_record_dma_addr, GFP_ATOMIC);
- if (!ctx->state_record_dma_addr)
+
+ if (!ctx->state_record_dma_addr || !ctx->state_record)
return -ENOMEM;
+#endif
memset(ctx->state_record, 0, sizeof(struct sa_state_record));
return 0;
@@ -168,14 +322,82 @@ u32 crypto4xx_alloc_state_record(struct crypto4xx_ctx *ctx)
void crypto4xx_free_state_record(struct crypto4xx_ctx *ctx)
{
+#ifdef CONFIG_SEC_SA_OCM
+ if (ctx->state_record != NULL)
+ ocm_free(ctx->state_record);
+#else
if (ctx->state_record != NULL)
dma_free_coherent(ctx->dev->core_dev->device,
sizeof(struct sa_state_record),
ctx->state_record,
ctx->state_record_dma_addr);
+#endif
+ ctx->state_record = NULL;
ctx->state_record_dma_addr = 0;
}
+u32 crypto4xx_alloc_arc4_state_record(struct crypto4xx_ctx *ctx)
+{
+#ifdef CONFIG_SEC_SA_OCM
+ ctx->arc4_state_record = ocm_alloc(&ctx->arc4_state_ocm_addr,
+ sizeof(struct arc4_sr), 4,
+ OCM_NON_CACHED, "sec_state_arc4_record");
+ if (ctx->arc4_state_record == NULL)
+ return -ENOMEM;
+ ctx->arc4_state_record_dma_addr = (u32)ctx->arc4_state_ocm_addr;
+#else
+ ctx->arc4_state_record = dma_alloc_coherent(ctx->dev->core_dev->device,
+ sizeof(struct arc4_sr),
+ /* &dma_addr */ &ctx->arc4_state_record_dma_addr,
+ GFP_ATOMIC);
+
+ if (!ctx->arc4_state_record_dma_addr)
+ return -ENOMEM;
+#endif
+ memset(ctx->arc4_state_record, 0, sizeof(struct arc4_sr));
+
+ return 0;
+}
+
+void crypto4xx_free_arc4_state_record(struct crypto4xx_ctx *ctx)
+{
+
+ if (ctx->arc4_state_record != NULL) {
+#ifdef CONFIG_SEC_SA_OCM
+ ocm_free(ctx->arc4_state_record);
+
+#else
+ dma_free_coherent(ctx->dev->core_dev->device,
+ sizeof(struct arc4_sr),
+ ctx->arc4_state_record,
+ ctx->arc4_state_record_dma_addr);
+#endif
+ }
+ ctx->arc4_state_record = NULL;
+ ctx->arc4_state_record_dma_addr = 0;
+}
+
+int datalen_check;
+static int crypto4xx_device_read_procmem(char *buffer, char **start, off_t offset,
+ int count, int *eof, void *data)
+{
+ struct crypto4xx_core_device *core_dev = (struct crypto4xx_core_device *)data;
+ int len = 0;
+ u32 ring_ctrl_val;
+
+ ring_ctrl_val = readl(core_dev->dev->ce_base + CRYPTO4XX_RING_CTRL);
+
+ len += sprintf(buffer + len, "ring_ctrl_val = 0x%08x\n", ring_ctrl_val);
+ len += sprintf(buffer + len,
+ "Crypto4xx Controller on AMCC PPC 460EX Canyonlands Board\n");
+ len += sprintf(buffer + len,
+ "%u packets received for packetsize = %d\n", core_dev->dev->pkt_cnt,
+ datalen_check);
+ len += sprintf(buffer + len,
+ "%lld interrupts received\n", core_dev->irq_cnt);
+ *eof = 1;
+ return len;
+}
/**
* alloc memory for the gather ring
* no need to alloc buf for the ring
@@ -185,20 +407,37 @@ static u32 crypto4xx_build_pdr(struct crypto4xx_device *dev)
{
int i;
struct pd_uinfo *pd_uinfo;
+
+#ifdef CONFIG_SEC_PD_OCM
+ int pd_size;
+ pd_size = sizeof(struct ce_pd) * PPC4XX_NUM_PD;
+ dev->pdr = ocm_alloc(&dev->pdr_ocm_addr, pd_size, 4,
+ OCM_NON_CACHED, "sec_pd");
+ dev->pdr_pa = (u32)dev->pdr_ocm_addr;
+ printk(KERN_INFO "Security OCM Allocation done for packet Descriptor: %llx,\n"
+ "Virtual OCM Address: %p, OCM Allocation size: %d\n",
+ (unsigned long long)dev->pdr_ocm_addr, dev->pdr, pd_size);
+ if (dev->pdr == NULL) {
+ printk("PD Allocation failed on OCM\n");
+ return -ENOMEM;
+ }
+#else
dev->pdr = dma_alloc_coherent(dev->core_dev->device,
sizeof(struct ce_pd) * PPC4XX_NUM_PD,
&dev->pdr_pa, GFP_ATOMIC);
if (!dev->pdr)
return -ENOMEM;
-
+#endif
dev->pdr_uinfo = kzalloc(sizeof(struct pd_uinfo) * PPC4XX_NUM_PD,
GFP_KERNEL);
if (!dev->pdr_uinfo) {
+#ifndef CONFIG_SEC_PD_OCM
dma_free_coherent(dev->core_dev->device,
sizeof(struct ce_pd) * PPC4XX_NUM_PD,
dev->pdr,
dev->pdr_pa);
return -ENOMEM;
+#endif
}
memset(dev->pdr, 0, sizeof(struct ce_pd) * PPC4XX_NUM_PD);
dev->shadow_sa_pool = dma_alloc_coherent(dev->core_dev->device,
@@ -233,10 +472,14 @@ static u32 crypto4xx_build_pdr(struct crypto4xx_device *dev)
static void crypto4xx_destroy_pdr(struct crypto4xx_device *dev)
{
+#ifndef CONFIG_SEC_PD_OCM
if (dev->pdr != NULL)
dma_free_coherent(dev->core_dev->device,
sizeof(struct ce_pd) * PPC4XX_NUM_PD,
dev->pdr, dev->pdr_pa);
+#else
+ ocm_free(dev->pdr);
+#endif
if (dev->shadow_sa_pool)
dma_free_coherent(dev->core_dev->device, 256 * PPC4XX_NUM_PD,
dev->shadow_sa_pool, dev->shadow_sa_pool_pa);
@@ -245,6 +488,7 @@ static void crypto4xx_destroy_pdr(struct crypto4xx_device *dev)
sizeof(struct sa_state_record) * PPC4XX_NUM_PD,
dev->shadow_sr_pool, dev->shadow_sr_pool_pa);
+ dev->pkt_cnt = 0;
kfree(dev->pdr_uinfo);
}
@@ -526,7 +770,7 @@ static u32 crypto4xx_fill_one_page(struct crypto4xx_device *dev,
(*idx)++;
return 0;
- }
+ }
}
static void crypto4xx_copy_pkt_to_dst(struct crypto4xx_device *dev,
@@ -589,9 +833,25 @@ static u32 crypto4xx_copy_digest_to_dst(struct pd_uinfo *pd_uinfo,
struct sa_state_record *state_record =
(struct sa_state_record *) pd_uinfo->sr_va;
- if (sa->sa_command_0.bf.hash_alg == SA_HASH_ALG_SHA1) {
- memcpy((void *) pd_uinfo->dest_va, state_record->save_digest,
- SA_HASH_ALG_SHA1_DIGEST_SIZE);
+ switch (sa->sa_command_0.bf.hash_alg) {
+ case SA_HASH_ALG_KASUMI_f9:
+ crypto4xx_memcpy_le((void *)pd_uinfo->dest_va,
+ (u8 *)state_record->save_digest, 8);
+ break;
+ case SA_HASH_ALG_AES_XCBC_MAC_128:
+ crypto4xx_memcpy_le((void *)pd_uinfo->dest_va,
+ (u8 *) state_record->save_digest, 16);
+ break;
+ case SA_HASH_ALG_MD5:
+ crypto4xx_memcpy_le((void *)pd_uinfo->dest_va,
+ (u8 *) state_record->save_digest,
+ SA_HASH_ALG_MD5_DIGEST_SIZE);
+ break;
+ default:
+ memcpy((void *)pd_uinfo->dest_va,
+ state_record->save_digest,
+ crypto4xx_sa_hash_tbl[1][sa->sa_command_0.bf.hash_alg]);
+ break;
}
return 0;
@@ -616,6 +876,57 @@ static void crypto4xx_ret_sg_desc(struct crypto4xx_device *dev,
}
}
+void crypto4xx_append_icv_to_end(struct crypto4xx_device *dev,
+ struct scatterlist *dst,
+ struct sa_state_record *sr,
+ u32 offset,
+ u32 len)
+{
+ struct scatterlist *sg;
+ int i = 0;
+ u32 cp_len;
+ dma_addr_t addr;
+
+ sg = &dst[i];
+ while (len) {
+ while (sg->length < offset) {
+ offset -= sg->length;
+ i++;
+ sg = &sg[i];
+ }
+ /* at here, icv could be in this sg,
+ * or icv could be in the next sg
+ */
+ if (sg->length > offset) {
+ /* icv should be in middle of this sg */
+ addr = dma_map_page(dev->core_dev->device, sg_page(sg),
+ sg->offset,
+ sg->length, DMA_TO_DEVICE);
+ cp_len = (sg->length-offset >= len) ? len :
+ sg->length-offset;
+ len -= cp_len;
+ crypto4xx_memcpy_le((u32 *)(phys_to_virt(addr)
+ + offset),
+ (u8 *)sr->save_digest, cp_len);
+ } else {
+ /* start from begin of next sg*/
+ i++;
+ sg = &sg[i];
+ offset = 0;
+ addr = dma_map_page(dev->core_dev->device, sg_page(sg),
+ sg->offset,
+ sg->length, DMA_FROM_DEVICE);
+ cp_len = (sg->length >= len) ? len : sg->length;
+ len -= cp_len;
+ crypto4xx_memcpy_le((u32 *) (phys_to_virt(addr)
+ + offset),
+ (u8 *) sr->save_digest, cp_len);
+ }
+ i++;
+ sg = &sg[i];
+ }
+}
+
static u32 crypto4xx_ablkcipher_done(struct crypto4xx_device *dev,
struct pd_uinfo *pd_uinfo,
struct ce_pd *pd)
@@ -637,6 +948,11 @@ static u32 crypto4xx_ablkcipher_done(struct crypto4xx_device *dev,
dst->offset, dst->length, DMA_FROM_DEVICE);
}
crypto4xx_ret_sg_desc(dev, pd_uinfo);
+
+ if (pd->pd_ctl.bf.status & 0xff) {
+ printk("ablkcipher return err status = 0x%08x\n",
+ pd->pd_ctl.bf.status & 0xff);
+ }
if (ablk_req->base.complete != NULL)
ablk_req->base.complete(&ablk_req->base, 0);
@@ -644,7 +960,8 @@ static u32 crypto4xx_ablkcipher_done(struct crypto4xx_device *dev,
}
static u32 crypto4xx_ahash_done(struct crypto4xx_device *dev,
- struct pd_uinfo *pd_uinfo)
+ struct pd_uinfo *pd_uinfo,
+ struct ce_pd *pd)
{
struct crypto4xx_ctx *ctx;
struct ahash_request *ahash_req;
@@ -656,24 +973,101 @@ static u32 crypto4xx_ahash_done(struct crypto4xx_device *dev,
crypto_tfm_ctx(ahash_req->base.tfm));
crypto4xx_ret_sg_desc(dev, pd_uinfo);
/* call user provided callback function x */
+ if (pd->pd_ctl.bf.status & 0xff) {
+ printk("ahash return err status = 0x%08x\n",
+ pd->pd_ctl.bf.status & 0xff);
+ }
if (ahash_req->base.complete != NULL)
ahash_req->base.complete(&ahash_req->base, 0);
return 0;
}
-static u32 crypto4xx_pd_done(struct crypto4xx_device *dev, u32 idx)
+static u32 crypto4xx_aead_done(struct crypto4xx_device *dev,
+ struct pd_uinfo *pd_uinfo,
+ struct ce_pd *pd)
+{
+ struct aead_request *aead_req;
+ struct crypto4xx_ctx *ctx;
+ struct scatterlist *dst;
+ dma_addr_t addr;
+ struct crypto_aead *aead;
+
+ aead_req = container_of(pd_uinfo->async_req,
+ struct aead_request, base);
+ aead = crypto_aead_reqtfm(aead_req);
+ ctx = crypto_tfm_ctx(aead_req->base.tfm);
+
+ if (pd_uinfo->using_sd) {
+ crypto4xx_copy_pkt_to_dst(dev, pd, pd_uinfo,
+ pd->pd_ctl_len.bf.pkt_len,
+ aead_req->dst);
+ } else {
+ dst = pd_uinfo->dest_va;
+ addr = dma_map_page(dev->core_dev->device, sg_page(dst),
+ dst->offset,
+ dst->length, DMA_FROM_DEVICE);
+ }
+
+ if (ctx->append_icv != 0) {
+ dst = pd_uinfo->dest_va;
+ crypto4xx_append_icv_to_end(dev, dst,
+ (struct sa_state_record *)
+ pd_uinfo->sr_va,
+ aead_req->cryptlen,
+ crypto_aead_authsize(aead));
+ }
+ crypto4xx_ret_sg_desc(dev, pd_uinfo);
+ /* call user provided callback function x */
+
+ if (pd->pd_ctl.bf.status & 0xff) {
+ if (pd->pd_ctl.bf.status & 1)
+ printk("authentication error\n");
+ if (pd->pd_ctl.bf.status & 2)
+ printk("pad fail error\n");
+ if (pd->pd_ctl.bf.status & 4)
+ printk("seqnum fail\n");
+ if (pd->pd_ctl.bf.status & 8)
+ printk("error _notify\n");
+ printk("aead return err status = 0x%08x\n",
+ pd->pd_ctl.bf.status & 0xff);
+ printk("pd pad_ctl = 0x%08x\n", pd->pd_ctl.bf.pd_pad_ctl);
+ }
+
+#if 0
+ void * saddr;
+ dst = pd_uinfo->dest_va;
+ printk("dumping aead_done length = %d\n", dst->length);
+ saddr = kmap_atomic(sg_page(dst), KM_SOFTIRQ1);
+ print_hex_dump(KERN_CONT, "", DUMP_PREFIX_OFFSET,
+ 16, 1,
+ (void*)saddr+dst->offset, dst->length, false);
+ kunmap_atomic(saddr, KM_SOFTIRQ1);
+#endif
+ if (aead_req->base.complete != NULL)
+ aead_req->base.complete(&aead_req->base, 0);
+ return 0;
+}
+
+u32 crypto4xx_pd_done(struct crypto4xx_device *dev, u32 idx)
{
struct ce_pd *pd;
struct pd_uinfo *pd_uinfo;
pd = dev->pdr + sizeof(struct ce_pd)*idx;
pd_uinfo = dev->pdr_uinfo + sizeof(struct pd_uinfo)*idx;
+
if (crypto_tfm_alg_type(pd_uinfo->async_req->tfm) ==
+ CRYPTO_ALG_TYPE_AEAD)
+ return crypto4xx_aead_done(dev, pd_uinfo, pd);
+ else if (crypto_tfm_alg_type(pd_uinfo->async_req->tfm) ==
CRYPTO_ALG_TYPE_ABLKCIPHER)
return crypto4xx_ablkcipher_done(dev, pd_uinfo, pd);
- else
- return crypto4xx_ahash_done(dev, pd_uinfo);
+ else if (crypto_tfm_alg_type(pd_uinfo->async_req->tfm) ==
+ CRYPTO_ALG_TYPE_AHASH)
+ return crypto4xx_ahash_done(dev, pd_uinfo, pd);
+
+ return 0;
}
/**
@@ -769,18 +1163,23 @@ static u32 get_next_sd(u32 current)
else
return 0;
}
-
+extern int ssl_arc4;
+extern int tls;
+int var = 0;
u32 crypto4xx_build_pd(struct crypto_async_request *req,
struct crypto4xx_ctx *ctx,
struct scatterlist *src,
struct scatterlist *dst,
unsigned int datalen,
+ struct scatterlist *assoc,
+ u32 aad_len,
void *iv, u32 iv_len)
{
struct crypto4xx_device *dev = ctx->dev;
dma_addr_t addr, pd_dma, sd_dma, gd_dma;
struct dynamic_sa_ctl *sa;
struct scatterlist *sg;
+ struct scatterlist *aad;
struct ce_gd *gd;
struct ce_pd *pd;
u32 num_gd, num_sd;
@@ -790,13 +1189,19 @@ u32 crypto4xx_build_pd(struct crypto_async_request *req,
unsigned long flags;
struct pd_uinfo *pd_uinfo = NULL;
unsigned int nbytes = datalen, idx;
- unsigned int ivlen = 0;
u32 gd_idx = 0;
+ unsigned int aadlen = 0;
+ datalen_check = datalen;
/* figure how many gd is needed */
- num_gd = get_sg_count(src, datalen);
- if (num_gd == 1)
- num_gd = 0;
+ if (aad_len) {
+ num_gd = get_sg_count(assoc, aad_len) +
+ get_sg_count(src, datalen);
+ } else {
+ num_gd = get_sg_count(src, datalen);
+ if (num_gd == 1)
+ num_gd = 0;
+ }
/* figure how many sd is needed */
if (sg_is_last(dst) || ctx->is_hash) {
@@ -852,8 +1257,8 @@ u32 crypto4xx_build_pd(struct crypto_async_request *req,
pd_uinfo->num_gd = num_gd;
pd_uinfo->num_sd = num_sd;
+ writel(0, ctx->dev->ce_base + CRYPTO4XX_SA_UADDR);
if (iv_len || ctx->is_hash) {
- ivlen = iv_len;
pd->sa = pd_uinfo->sa_pa;
sa = (struct dynamic_sa_ctl *) pd_uinfo->sa_va;
if (ctx->direction == DIR_INBOUND)
@@ -864,17 +1269,48 @@ u32 crypto4xx_build_pd(struct crypto_async_request *req,
memcpy((void *) sa + ctx->offset_to_sr_ptr,
&pd_uinfo->sr_pa, 4);
- if (iv_len)
- crypto4xx_memcpy_le(pd_uinfo->sr_va, iv, iv_len);
+ if (iv_len) {
+ if (ctx->ctr_aes) {
+ /* First the nonce */
+ memcpy(pd_uinfo->sr_va, ctx->state_record,
+ CTR_RFC3686_NONCE_SIZE);
+ /* Copy the IV that is passed through
+ * each operation
+ */
+ crypto4xx_memcpy_le(pd_uinfo->sr_va +
+ CTR_RFC3686_NONCE_SIZE, iv, iv_len);
+ } else
+ crypto4xx_memcpy_le(pd_uinfo->sr_va,
+ iv, iv_len);
+ }
+ if (ctx->is_gcm || ctx->ctr_aes) {
+ u32 seq = 1;
+ /*For GCM and CTR(AES) algs adding the counter value*/
+ crypto4xx_memcpy_le(pd_uinfo->sr_va + 12,
+ (void *)&seq, 4);
+ }
} else {
if (ctx->direction == DIR_INBOUND) {
+#ifdef CONFIG_SEC_SA_OCM
+ writel((ctx->sa_in_ocm_addr >> 32),
+ ctx->dev->ce_base + CRYPTO4XX_SA_UADDR);
+#endif
pd->sa = ctx->sa_in_dma_addr;
sa = (struct dynamic_sa_ctl *) ctx->sa_in;
- } else {
+ } else {
+#ifdef CONFIG_SEC_SA_OCM
+ writel((ctx->sa_out_ocm_addr >> 32),
+ ctx->dev->ce_base + CRYPTO4XX_SA_UADDR);
+#endif
pd->sa = ctx->sa_out_dma_addr;
sa = (struct dynamic_sa_ctl *) ctx->sa_out;
}
}
+
+ //u32 sa_upper = readl(ctx->dev->ce_base + CRYPTO4XX_SA_UADDR);
+ //printk("Dumping the Upper SA address = 0x%x\n", sa_upper);
+ //printk("Dumping the lower SA address = 0x%x\n", pd->sa);
+
pd->sa_len = ctx->sa_len;
if (num_gd) {
/* get first gd we are going to use */
@@ -886,6 +1322,35 @@ u32 crypto4xx_build_pd(struct crypto_async_request *req,
/* enable gather */
sa->sa_command_0.bf.gather = 1;
idx = 0;
+ if (aad_len) {
+ aadlen = aad_len;
+ aad = assoc;
+ /* walk the sg, and setup gather array for aad*/
+ while (aadlen) {
+ sg = &aad[idx];
+ addr = dma_map_page(dev->core_dev->device,
+ sg_page(sg), sg->offset,
+ sg->length, DMA_TO_DEVICE);
+
+ gd->ptr = addr;
+ gd->ctl_len.len = sg->length;
+ gd->ctl_len.done = 0;
+ gd->ctl_len.ready = 1;
+
+ if (sg->length >= aadlen)
+ break;
+
+ aadlen -= sg->length;
+
+ gd_idx = get_next_gd(gd_idx);
+ gd = crypto4xx_get_gdp(dev, &gd_dma, gd_idx);
+ idx++;
+ }
+ /* prepare gd for src */
+ gd_idx = get_next_gd(gd_idx);
+ gd = crypto4xx_get_gdp(dev, &gd_dma, gd_idx);
+ }
+ idx = 0;
src = &src[0];
/* walk the sg, and setup gather array */
while (nbytes) {
@@ -970,13 +1435,24 @@ u32 crypto4xx_build_pd(struct crypto_async_request *req,
}
}
- sa->sa_command_1.bf.hash_crypto_offset = 0;
+ sa->sa_command_1.bf.hash_crypto_offset = (aad_len >> 2);
pd->pd_ctl.w = ctx->pd_ctl;
- pd->pd_ctl_len.w = 0x00400000 | (ctx->bypass << 24) | datalen;
+ pd->pd_ctl_len.w = 0x00400000 | (ctx->bypass << 24) |
+ (datalen + aad_len);
+ if (ctx->next_hdr)
+ pd->pd_ctl.bf.next_hdr = ctx->next_hdr;
pd_uinfo->state = PD_ENTRY_INUSE;
wmb();
/* write any value to push engine to read a pd */
- writel(1, dev->ce_base + CRYPTO4XX_INT_DESCR_RD);
+ if (dev->core_dev->revb_ver == 1) {
+#ifndef CONFIG_SEC_HW_POLL
+ writel(1, dev->ce_base + CRYPTO4XX_INT_DESCR_RD);
+#endif
+ } else
+ writel(1, dev->ce_base + CRYPTO4XX_INT_DESCR_RD);
+
+
+ dev->pkt_cnt++;
return -EINPROGRESS;
}
@@ -995,6 +1471,8 @@ static int crypto4xx_alg_init(struct crypto_tfm *tfm)
ctx->sa_in_dma_addr = 0;
ctx->sa_out_dma_addr = 0;
ctx->sa_len = 0;
+ ctx->is_gcm = 0;
+ ctx->append_icv = 0;
switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {
default:
@@ -1004,6 +1482,9 @@ static int crypto4xx_alg_init(struct crypto_tfm *tfm)
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
sizeof(struct crypto4xx_ctx));
break;
+ case CRYPTO_ALG_TYPE_AEAD:
+ tfm->crt_aead.reqsize = sizeof(struct crypto4xx_ctx);
+ break;
}
return 0;
@@ -1015,6 +1496,7 @@ static void crypto4xx_alg_exit(struct crypto_tfm *tfm)
crypto4xx_free_sa(ctx);
crypto4xx_free_state_record(ctx);
+ crypto4xx_free_arc4_state_record(ctx);
}
int crypto4xx_register_alg(struct crypto4xx_device *sec_dev,
@@ -1098,6 +1580,14 @@ static void crypto4xx_bh_tasklet_cb(unsigned long data)
}
}
}
+#define SRAM_OCM_ADDR_ERR 0x0B4
+#define SRAM_OCM_STATUS0 0x0B5
+#define SRAM_OCM_STATUS1 0X0B6
+
+#define PLBA0_ESRL 0x0082
+#define PLBA0_ESRH 0x0083
+#define PLBA0_EARL 0x0084
+#define PLBA0_EARH 0x0085
/**
* Top Half of isr.
@@ -1106,33 +1596,140 @@ static irqreturn_t crypto4xx_ce_interrupt_handler(int irq, void *data)
{
struct device *dev = (struct device *)data;
struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
+ //u32 int_status;
if (core_dev->dev->ce_base == 0)
return 0;
- writel(PPC4XX_INTERRUPT_CLR,
- core_dev->dev->ce_base + CRYPTO4XX_INT_CLR);
+ //int_status = readl(core_dev->dev->ce_base + CRYPTO4XX_INT_UNMASK_STAT);
+ //printk("Interrupt status = 0x%08x\n", int_status);
+
+ /* For RevB, 460EX and 460ExR Rev B */
+ if (core_dev->revb_ver == 1) {
+ writel(PPC4XX_INTERRUPT_CLR_REVB,
+ core_dev->dev->ce_base + CRYPTO4XX_INT_CLR);
+ } else {
+ writel(PPC4XX_INTERRUPT_CLR,
+ core_dev->dev->ce_base + CRYPTO4XX_INT_CLR);
+ }
+
+ core_dev->irq_cnt++;
tasklet_schedule(&core_dev->tasklet);
return IRQ_HANDLED;
}
+
/**
* Supported Crypto Algorithms
*/
struct crypto4xx_alg_common crypto4xx_alg[] = {
+ /* Crypto DES ECB, CBC, modes */
+#if 1
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "cbc(des)",
+ .cra_driver_name = "ppc4xx-cbc-des",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = DES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = DES_KEY_SIZE,
+ .max_keysize = DES_KEY_SIZE,
+ .ivsize = DES_BLOCK_SIZE,
+ .setkey = crypto4xx_setkey_3des_cbc,
+ .encrypt = crypto4xx_encrypt,
+ .decrypt = crypto4xx_decrypt,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "ecb(des)",
+ .cra_driver_name = "ppc4xx-ecb-des",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = DES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = DES_KEY_SIZE,
+ .max_keysize = DES_KEY_SIZE,
+ .setkey = crypto4xx_setkey_3des_ecb,
+ .encrypt = crypto4xx_encrypt,
+ .decrypt = crypto4xx_decrypt,
+ }
+ }
+ }},
+
+ /* Crypto 3DES ECB, CBC, CFB, and OFB modes */
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "cbc(des3_ede)",
+ .cra_driver_name = "ppc4xx-cbc-3des",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = DES3_EDE_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = DES3_EDE_KEY_SIZE,
+ .max_keysize = DES3_EDE_KEY_SIZE,
+ .ivsize = DES3_EDE_BLOCK_SIZE,
+ .setkey = crypto4xx_setkey_3des_cbc,
+ .encrypt = crypto4xx_encrypt,
+ .decrypt = crypto4xx_decrypt,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "ecb(des3_ede)",
+ .cra_driver_name = "ppc4xx-ecb-3des",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = DES3_EDE_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = DES3_EDE_KEY_SIZE,
+ .max_keysize = DES3_EDE_KEY_SIZE,
+ .setkey = crypto4xx_setkey_3des_ecb,
+ .encrypt = crypto4xx_encrypt,
+ .decrypt = crypto4xx_decrypt,
+ }
+ }
+ }},
/* Crypto AES modes */
{ .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
- .cra_name = "cbc(aes)",
- .cra_driver_name = "cbc-aes-ppc4xx",
- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
- .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
- .cra_blocksize = AES_BLOCK_SIZE,
- .cra_ctxsize = sizeof(struct crypto4xx_ctx),
- .cra_type = &crypto_ablkcipher_type,
- .cra_init = crypto4xx_alg_init,
- .cra_exit = crypto4xx_alg_exit,
- .cra_module = THIS_MODULE,
+ .cra_name = "cbc(aes)",
+ .cra_driver_name = "cbc-aes-ppc4xx",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
.cra_u = {
.ablkcipher = {
.min_keysize = AES_MIN_KEY_SIZE,
@@ -1144,8 +1741,2184 @@ struct crypto4xx_alg_common crypto4xx_alg[] = {
}
}
}},
-};
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "ofb(aes)",
+ .cra_driver_name = "ppc4xx-ofb-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = AES_MIN_KEY_SIZE,
+ .max_keysize = AES_MAX_KEY_SIZE,
+ .ivsize = AES_BLOCK_SIZE,
+ .setkey = crypto4xx_setkey_aes_ofb,
+ .encrypt = crypto4xx_encrypt,
+ .decrypt = crypto4xx_decrypt,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "cfb(aes)",
+ .cra_driver_name = "ppc4xx-cfb-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = AES_MIN_KEY_SIZE,
+ .max_keysize = AES_MAX_KEY_SIZE,
+ .ivsize = AES_BLOCK_SIZE,
+ .setkey = crypto4xx_setkey_aes_cfb,
+ .encrypt = crypto4xx_encrypt,
+ .decrypt = crypto4xx_decrypt,
+ }
+ }
+ }},
+ /* Crypto AES ECB, CBC, CTR, GCM, CCM, and GMAC modes */
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "ecb(aes)",
+ .cra_driver_name = "ppc4xx-ecb-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = AES_MIN_KEY_SIZE,
+ .max_keysize = AES_MAX_KEY_SIZE,
+ .setkey = crypto4xx_setkey_aes_ecb,
+ .encrypt = crypto4xx_encrypt,
+ .decrypt = crypto4xx_decrypt,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "rfc3686(ctr(aes))",
+ .cra_driver_name = "ppc4xx-ctr-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = CTR_RFC3686_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = AES_MIN_KEY_SIZE,
+ .max_keysize = AES_MAX_KEY_SIZE,
+ .ivsize = CTR_RFC3686_BLOCK_SIZE,
+ .setkey = crypto4xx_setkey_aes_ctr,
+ .encrypt = crypto4xx_encrypt_ctr,
+ .decrypt = crypto4xx_decrypt_ctr,
+ }
+ }
+ }},
+
+ /* AEAD Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "gcm(aes)",
+ .cra_driver_name = "ppc4xx-gcm-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .maxauthsize = 16,
+ .ivsize = 12,
+ .setkey = crypto4xx_setkey_aes_gcm,
+ .setauthsize = crypto4xx_setauthsize_aes,
+ .encrypt = crypto4xx_encrypt_aes_gcm,
+ .decrypt = crypto4xx_decrypt_aes_gcm,
+ .givencrypt = crypto4xx_givencrypt_aes_gcm,
+ .givdecrypt = crypto4xx_givdecrypt_aes_gcm,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "ccm(aes)",
+ .cra_driver_name = "ppc4xx-ccm-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = AES_BLOCK_SIZE,
+ .maxauthsize = 16,
+ .setkey = crypto4xx_setkey_aes_ccm,
+ .setauthsize = crypto4xx_setauthsize_aes,
+ .encrypt = crypto4xx_encrypt_aes_ccm,
+ .decrypt = crypto4xx_decrypt_aes_ccm,
+ .givencrypt = crypto4xx_givencrypt_aes_ccm,
+ .givdecrypt = crypto4xx_givdecrypt_aes_ccm,
+ }
+ }
+ }},
+
+ /* Hash MD5 */
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .halg.digestsize = SA_HASH_ALG_MD5_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "md5",
+ .cra_driver_name = "ppc4xx-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_init = crypto4xx_md5_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+#endif
+#if 1
+ /* Hash MD5-HMAC */
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .setkey = crypto4xx_md5_hmac_setkey,
+ .halg.digestsize = SA_HASH_ALG_MD5_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "hmac(md5)",
+ .cra_driver_name = "ppc4xx-hmac-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+
+ /* Hash SHA1, SHA2 and HMAC */
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .halg.digestsize = SHA1_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "sha1",
+ .cra_driver_name = "ppc4xx-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA1_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_init = crypto4xx_sha1_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+#endif
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .setkey = crypto4xx_sha1_hmac_setkey,
+ .halg.digestsize = SHA1_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "hmac(sha1)",
+ .cra_driver_name = "ppc4xx-hmac-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA1_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+
+#if 1
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .halg.digestsize = SHA224_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "sha224",
+ .cra_driver_name = "ppc4xx-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA224_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_init = crypto4xx_sha2_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .setkey = crypto4xx_sha2_hmac_setkey,
+ .halg.digestsize = SHA224_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "hmac(sha224)",
+ .cra_driver_name = "ppc4xx-hmac-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA224_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .halg.digestsize = SHA256_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "sha256",
+ .cra_driver_name = "ppc4xx-sha256",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA256_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_init = crypto4xx_sha2_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .setkey = crypto4xx_sha2_hmac_setkey,
+ .halg.digestsize = SHA256_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "hmac(sha256)",
+ .cra_driver_name = "ppc4xx-hmac-sha256",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA256_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .halg.digestsize = SHA384_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "sha384",
+ .cra_driver_name = "ppc4xx-sha384",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA384_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_init = crypto4xx_sha2_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .setkey = crypto4xx_sha2_hmac_setkey,
+ .halg.digestsize = SHA384_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "hmac(sha384)",
+ .cra_driver_name = "ppc4xx-hmac-sha384",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA384_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .halg.digestsize = SHA512_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "sha512",
+ .cra_driver_name = "ppc4xx-sha512",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA512_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_init = crypto4xx_sha2_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+#endif
+#if 1
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .setkey = crypto4xx_sha2_hmac_setkey,
+ .halg.digestsize = SHA512_DIGEST_SIZE,
+ .halg.base = {
+ .cra_name = "hmac(sha512)",
+ .cra_driver_name = "ppc4xx-hmac-sha512",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = SHA512_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+ /* Hash XCBC, GHASH, and Kasumi F9 */
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_hash_digest,
+ .setkey = crypto4xx_xcbc_setkey,
+ .halg.digestsize = 16,
+ .halg.base = {
+ .cra_name = "xcbc(aes)",
+ .cra_driver_name = "ppc4xx-xcbc-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+
+ /* Crypto Kasumi and Kasumi F8 */
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "kasumi",
+ .cra_driver_name = "ppc4xx-kasumi",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = KASUMI_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = KASUMI_KEY_SIZE,
+ .max_keysize = KASUMI_KEY_SIZE,
+ .ivsize = KASUMI_BLOCK_SIZE,
+ .setkey = crypto4xx_setkey_kasumi_p,
+ .encrypt = crypto4xx_encrypt,
+ .decrypt = crypto4xx_decrypt,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "f8(kasumi)",
+ .cra_driver_name = "ppc4xx-f8-kasumi",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = KASUMI_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = KASUMI_KEY_SIZE,
+ .max_keysize = KASUMI_KEY_SIZE,
+ .ivsize = KASUMI_BLOCK_SIZE,
+ .setkey = crypto4xx_setkey_kasumi_f8,
+ .encrypt = crypto4xx_encrypt_kasumi_f8,
+ .decrypt = crypto4xx_decrypt_kasumi_f8,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AHASH, .u.hash = {
+ .init = crypto4xx_hash_init,
+ .update = crypto4xx_hash_update,
+ .final = crypto4xx_hash_final,
+ .digest = crypto4xx_kasumi_f9_digest,
+ .setkey = crypto4xx_kasumi_f9_setkey,
+ .halg.digestsize = 8,
+ .halg.base = {
+ .cra_name = "f9(kasumi)",
+ .cra_driver_name = "ppc4xx-f9-kasumi",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = KASUMI_BLOCK_SIZE,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ahash_type,
+ .cra_module = THIS_MODULE,
+ }
+ }},
+#endif
+#if 1
+ /* Crypto ARC4 - stateless */
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "ecb(arc4)",
+ .cra_driver_name = "ppc4xx-arc4",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 1,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = 1,
+ .max_keysize = 16,
+ .setkey = crypto4xx_setkey_arc4,
+ .encrypt = crypto4xx_arc4_encrypt,
+ .decrypt = crypto4xx_arc4_decrypt,
+ }
+ }
+ }},
+ /* Crypto ARC4 - statefull */
+ { .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .u.cipher = {
+ .cra_name = "cbc(arc4)",
+ .cra_driver_name = "ppc4xx-arc4",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 1,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_ablkcipher_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .ablkcipher = {
+ .min_keysize = 1,
+ .max_keysize = 16,
+ .setkey = crypto4xx_setkey_arc4,
+ .encrypt = crypto4xx_arc4_encrypt,
+ .decrypt = crypto4xx_arc4_decrypt,
+ }
+ }
+ }},
+#endif
+#if 1
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(md5),cbc(aes))))",
+ .cra_driver_name = "tunnel-esp-cbc-aes-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u ={
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 16, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_aes_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha1),cbc(aes))))",
+ .cra_driver_name = "tunnel-esp-cbc-aes-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 20, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_aes_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+#endif
+#if 1
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha224),cbc(aes))))",
+ .cra_driver_name = "tunnel-esp-cbc-aes-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 28, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_aes_sha224,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+#endif
+#if 1
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha256),cbc(aes))))",
+ .cra_driver_name = "tunnel-esp-cbc-aes-sha256",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 32, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_aes_sha256,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha384),cbc(aes))))",
+ .cra_driver_name = "tunnel-esp-cbc-aes-sha384",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 48, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_aes_sha384,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha512),cbc(aes))))",
+ .cra_driver_name = "tunnel-esp-cbc-aes-sha512",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 64, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_aes_sha512,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(md5),cbc(des))))",
+ .cra_driver_name = "tunnel-esp-cbc-des-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 16, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_des_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha1),cbc(des))))",
+ .cra_driver_name = "tunnel-esp-cbc-des-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 20, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_des_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha224),cbc(des))))",
+ .cra_driver_name = "tunnel-esp-cbc-des-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 28, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_des_sha224,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha256),cbc(des))))",
+ .cra_driver_name = "tunnel-esp-cbc-des-sha256",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 32, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_des_sha256,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha384),cbc(des))))",
+ .cra_driver_name = "tunnel-esp-cbc-des-sha384",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 48, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_des_sha384,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha512),cbc(des))))",
+ .cra_driver_name = "tunnel-esp-cbc-des-sha512",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 64, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_des_sha512,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(md5),cbc(des3_ede))))",
+ .cra_driver_name = "tunnel-esp-cbc-3des-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 16, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_3des_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(md5),cbc(des3_ede))))",
+ .cra_driver_name = "tunnel-esp-cbc-3des-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 16, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_3des_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha1),cbc(des3_ede))))",
+ .cra_driver_name = "tunnel-esp-cbc-3des-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 20, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_3des_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha224),cbc(des3_ede))))",
+ .cra_driver_name = "tunnel-esp-cbc-3des-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 28, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_3des_sha224,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha256),cbc(des3_ede))))",
+ .cra_driver_name = "tunnel-esp-cbc-3des-sha256",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 32, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_3des_sha256,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha384),cbc(des3_ede))))",
+ .cra_driver_name = "tunnel-esp-cbc-3des-sha384",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 48, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_3des_sha384,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tunnel(esp(authenc(hmac(sha512),cbc(des3_ede))))",
+ .cra_driver_name = "tunnel-esp-cbc-3des-sha512",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 8 bytes */
+ .maxauthsize = 64, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tunnel_esp_cbc_3des_sha512,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_esp_cbc,
+ .decrypt = crypto4xx_decrypt_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_esp_cbc,
+ }
+ }
+ }},
+
+ /** IPSec transport combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(md5),cbc(aes))))",
+ .cra_driver_name = "transport-esp-cbc-aes-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 16, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_aes_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha1),cbc(aes))))",
+ .cra_driver_name = "transport-esp-cbc-aes-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 20, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_aes_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha224),cbc(aes))))",
+ .cra_driver_name = "transport-esp-cbc-aes-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 28, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_aes_sha224,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha256),cbc(aes))))",
+ .cra_driver_name = "transport-esp-cbc-aes-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 32, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_aes_sha256,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha384),cbc(aes))))",
+ .cra_driver_name = "transport-esp-cbc-aes-sha384",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 48, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_aes_sha384,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha512),cbc(aes))))",
+ .cra_driver_name = "transport-esp-cbc-aes-sha512",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 64, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_aes_sha512,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ /* IPSec transport combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(md5),cbc(des))))",
+ .cra_driver_name = "transport-esp-cbc-des-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 16, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_des_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha1),cbc(des))))",
+ .cra_driver_name = "transport-esp-cbc-des-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 20, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_des_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha224),cbc(des))))",
+ .cra_driver_name = "transport-esp-cbc-des-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 28, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_des_sha224,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha256),cbc(des))))",
+ .cra_driver_name = "transport-esp-cbc-des-sha256",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 32, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_des_sha256,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha384),cbc(des))))",
+ .cra_driver_name = "transport-esp-cbc-des-sha384",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 48, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_des_sha384,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha512),cbc(des))))",
+ .cra_driver_name = "transport-esp-cbc-des-sha512",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 64, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_des_sha512,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ /* IPSec transport combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(md5),cbc(des3_ede))))",
+ .cra_driver_name = "transport-esp-cbc-3des-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 16, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_3des_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha1),cbc(des3_ede))))",
+ .cra_driver_name = "transport-esp-cbc-3des-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 20, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_3des_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha224),cbc(des3_ede))))",
+ .cra_driver_name = "transport-esp-cbc-3des-sha224",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 28, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_3des_sha224,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+#endif
+#if 1
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha256),cbc(des3_ede))))",
+ .cra_driver_name = "transport-esp-cbc-3des-sha256",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 32, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_3des_sha256,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ /* IPSec combined hash and crypto Algorithms */
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha384),cbc(des3_ede))))",
+ .cra_driver_name = "transport-esp-cbc-3des-sha384",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 48, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_3des_sha384,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(authenc(hmac(sha512),cbc(des3_ede))))",
+ .cra_driver_name = "transport-esp-cbc-3des-sha512",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 8,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 64, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_cbc_3des_sha512,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "transport(esp(rfc4106(gcm(aes))))",
+ .cra_driver_name = "transport-esp-rfc4106-gcm-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0, /* Hardware requires 16 bytes aligned */
+ .cra_type = &crypto_aead_type,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size for crypto */
+ .maxauthsize = 12, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_transport_esp_rfc4106_gcm,
+ .setauthsize = crypto4xx_setauthsize_aes,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "rfc4106(gcm(aes))",
+ .cra_driver_name = "transport-esp-rfc4104-gcm-aes",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY_IPSEC-100,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 16,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_u = {.aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .setkey = crypto4xx_setkey_transport_esp_rfc4106_gcm,
+ .setauthsize = crypto4xx_setauthsize_aes,
+ .encrypt = crypto4xx_encrypt_transport_esp_cbc,
+ .decrypt = crypto4xx_decrypt_transport_esp_cbc,
+ .givencrypt = crypto4xx_givencrypt_transport_esp_cbc,
+ }
+ }}},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "macsec(gcm)",
+ .cra_driver_name = "macsec-ppc4xx",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64,
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_macsec_gcm,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_macsec,
+ .decrypt = crypto4xx_decrypt_macsec,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+#endif
+#if 1
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "dtls(aes-sha1)",
+ .cra_driver_name = "dtls-ppc4xx",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_dtls_aes_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+#endif
+#if 1
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "dtls(des-sha1)",
+ .cra_driver_name = "ppc4xx-dtls-des-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_dtls_des_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+#endif
+#if 1
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "dtls(des3-sha1)",
+ .cra_driver_name = "ppc4xx-dtls-des3-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_dtls_des3_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "dtls(NULL-md5)",
+ .cra_driver_name = "ppc4xx-dtls-null-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 0, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_dtls_null_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "dtls(NULL-sha1)",
+ .cra_driver_name = "ppc4xx-dtls-null-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 0, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_dtls_null_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+
+#endif
+#if 1
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "ssl(aes-sha1)",
+ .cra_driver_name = "ppc4xx-ssl-aes-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 64 bits ... 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0xF,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_ssl_aes_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_aes,
+ .decrypt = crypto4xx_decrypt_ssl_aes,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "ssl(des-sha1)",
+ .cra_driver_name = "ppc4xx-ssl-des-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_ssl_des_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_des,
+ .decrypt = crypto4xx_decrypt_ssl_des,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "ssl(des3-sha1)",
+ .cra_driver_name = "ppc4xx-ssl-des3-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_ssl_des3_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_des,
+ .decrypt = crypto4xx_decrypt_ssl_des,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "ssl(arc4-sha1)",
+ .cra_driver_name = "ppc4xx-ssl-arc4-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_ssl_arc4_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_arc4,
+ .decrypt = crypto4xx_decrypt_ssl_arc4,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "ssl(arc4-md5)",
+ .cra_driver_name = "ppc4xx-ssl-arc4-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_ssl_arc4_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_arc4,
+ .decrypt = crypto4xx_decrypt_ssl_arc4,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+#endif
+#if 1
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "ssl(NULL-md5)",
+ .cra_driver_name = "ppc4xx-ssl-null-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 0, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_ssl_null_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_null,
+ .decrypt = crypto4xx_decrypt_ssl_null,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "ssl(NULL-sha1)",
+ .cra_driver_name = "ppc4xx-ssl-null-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 0, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_ssl_null_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_null,
+ .decrypt = crypto4xx_decrypt_ssl_null,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+#endif
+#if 1
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls(aes-sha1)",
+ .cra_driver_name = "ppc4xx-tls-aes-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls_aes_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_aes,
+ .decrypt = crypto4xx_decrypt_ssl_aes,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls(des-sha1)",
+ .cra_driver_name = "ppc4xx-tls-des-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls_des_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_des,
+ .decrypt = crypto4xx_decrypt_ssl_des,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls(des3-sha1)",
+ .cra_driver_name = "ppc4xx-tls-des3-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls_des3_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_des,
+ .decrypt = crypto4xx_decrypt_ssl_des,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls(arc4-sha1)",
+ .cra_driver_name = "ppc4xx-tls-arc4-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls_arc4_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_arc4,
+ .decrypt = crypto4xx_decrypt_ssl_arc4,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls(arc4-md5)",
+ .cra_driver_name = "ppc4xx-tls-arc4-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls_arc4_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_arc4,
+ .decrypt = crypto4xx_decrypt_ssl_arc4,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls(NULL-md5)",
+ .cra_driver_name = "ppc4xx-tls-null-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 0, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls_null_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_null,
+ .decrypt = crypto4xx_decrypt_ssl_null,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls(NULL-sha1)",
+ .cra_driver_name = "ppc4xx-tls-null-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 0, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls_null_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_null,
+ .decrypt = crypto4xx_decrypt_ssl_null,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls1_1(aes-sha1)",
+ .cra_driver_name = "ppc4xx-tls1.1-aes-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls1_1_aes_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls1_1(des-sha1)",
+ .cra_driver_name = "ppc4xx-tls1.1-des-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls1_1_des_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls1_1(des3-sha1)",
+ .cra_driver_name = "ppc4xx-tls1.1-des3-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 8, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls1_1_des3_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls1_1(arc4-sha1)",
+ .cra_driver_name = "ppc4xx-tls1.1-arc4-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls1_1_arc4_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_arc4,
+ .decrypt = crypto4xx_decrypt_ssl_arc4,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls1_1(arc4-md5)",
+ .cra_driver_name = "ppc4xx-tls1.1-arc4-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 16, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls1_1_arc4_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_ssl_arc4,
+ .decrypt = crypto4xx_decrypt_ssl_arc4,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls1_1(NULL-md5)",
+ .cra_driver_name = "ppc4xx-tls1.1-null-md5",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 0, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls1_1_null_md5,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+
+ { .type = CRYPTO_ALG_TYPE_AEAD, .u.cipher = {
+ .cra_name = "tls1_1(NULL-sha1)",
+ .cra_driver_name = "ppc4xx-tls1.1-null-sha1",
+ .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
+ .cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC,
+ .cra_blocksize = 64, /* 128-bits block */
+ .cra_ctxsize = sizeof(struct crypto4xx_ctx),
+ .cra_alignmask = 0,
+ .cra_type = &crypto_aead_type,
+ .cra_init = crypto4xx_alg_init,
+ .cra_exit = crypto4xx_alg_exit,
+ .cra_module = THIS_MODULE,
+ .cra_u = {
+ .aead = {
+ .ivsize = 0, /* IV size is 16 bytes */
+ .maxauthsize = 128, /* Max auth data size in bytes */
+ .setkey = crypto4xx_setkey_tls1_1_null_sha1,
+ .setauthsize = NULL,
+ .encrypt = crypto4xx_encrypt_dtls,
+ .decrypt = crypto4xx_decrypt_dtls,
+ .givencrypt = NULL,
+ .givdecrypt = NULL,
+ }
+ }
+ }},
+#endif
+};
+#define CRYPTO4XX_CONSOLE_DRIVER_NAME "crypto4xx"
/**
* Module Initialization Routine
*/
@@ -1156,6 +3929,9 @@ static int __init crypto4xx_probe(struct of_device *ofdev,
struct resource res;
struct device *dev = &ofdev->dev;
struct crypto4xx_core_device *core_dev;
+ unsigned int pvr;
+ unsigned short min;
+ int revb_ver = 1; /* RevB of crypto core */
rc = of_address_to_resource(ofdev->node, 0, &res);
if (rc)
@@ -1172,6 +3948,7 @@ static int __init crypto4xx_probe(struct of_device *ofdev,
mfdcri(SDR0, PPC405EX_SDR0_SRST) | PPC405EX_CE_RESET);
mtdcri(SDR0, PPC405EX_SDR0_SRST,
mfdcri(SDR0, PPC405EX_SDR0_SRST) & ~PPC405EX_CE_RESET);
+ revb_ver = 0;
} else if (of_find_compatible_node(NULL, NULL,
"amcc,ppc460sx-crypto")) {
mtdcri(SDR0, PPC460SX_SDR0_SRST,
@@ -1193,8 +3970,23 @@ static int __init crypto4xx_probe(struct of_device *ofdev,
if (!core_dev->dev)
goto err_alloc_dev;
+ /* Older version of 460EX/GT does not support H/W based security intr coalescing */
+ pvr = mfspr(SPRN_PVR);
+ printk("Reading pvr value = %x\n", pvr);
+ if ((pvr & 0xfffffff0) == 0x130218A0) {
+ min = PVR_MIN(pvr);
+ if (min < 4) {
+ printk(KERN_INFO "RevA 460EX/GT ... h/w bug in security intr coal\n");
+ revb_ver = 0;
+ } else {
+ printk(KERN_INFO "RevB h/w security interrupt coalescing supported ...\n");
+ }
+ }
+
+ core_dev->revb_ver = revb_ver;
core_dev->dev->core_dev = core_dev;
core_dev->device = dev;
+ core_dev->irq_cnt = 0ll;
spin_lock_init(&core_dev->lock);
INIT_LIST_HEAD(&core_dev->dev->alg_list);
rc = crypto4xx_build_pdr(core_dev->dev);
@@ -1209,6 +4001,25 @@ static int __init crypto4xx_probe(struct of_device *ofdev,
if (rc)
goto err_build_sdr;
+ proc_crypto4xx = proc_mkdir("driver/crypto4xx", NULL);
+ if(proc_crypto4xx == NULL) {
+ printk(KERN_ERR
+ "%s: Error creating proc entry\n",__FUNCTION__);
+ return -ENOMEM;
+ }
+
+ entry = create_proc_read_entry("crypto4xx",
+ 0,
+ proc_crypto4xx,
+ crypto4xx_device_read_procmem,
+ core_dev);
+ if(entry == NULL) {
+ printk(KERN_CRIT
+ "%s: crypto4xx: create_proc_read_entry failed!\n",
+ __FUNCTION__);
+ return -ENOMEM;
+ }
+
/* Init tasklet for bottom half processing */
tasklet_init(&core_dev->tasklet, crypto4xx_bh_tasklet_cb,
(unsigned long) dev);
@@ -1216,7 +4027,7 @@ static int __init crypto4xx_probe(struct of_device *ofdev,
/* Register for Crypto isr, Crypto Engine IRQ */
core_dev->irq = irq_of_parse_and_map(ofdev->node, 0);
rc = request_irq(core_dev->irq, crypto4xx_ce_interrupt_handler, 0,
- core_dev->dev->name, dev);
+ "CRYPTO", dev);
if (rc)
goto err_request_irq;
@@ -1269,8 +4080,12 @@ static int __exit crypto4xx_remove(struct of_device *ofdev)
/* Un-register with Linux CryptoAPI */
crypto4xx_unregister_alg(core_dev->dev);
/* Free all allocated memory */
- crypto4xx_stop_all(core_dev);
+ remove_proc_entry("crypto4xx", entry) ;
+ entry = NULL;
+ remove_proc_entry("driver/crypto4xx", proc_crypto4xx);
+ proc_crypto4xx = NULL;
+ crypto4xx_stop_all(core_dev);
return 0;
}