Commit a9c01cd6 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Herbert Xu

crypto: bcm-spu - switch to skcipher API

Commit 7a7ffe65 ("crypto: skcipher - Add top-level skcipher interface")
dated 20 august 2015 introduced the new skcipher API which is supposed to
replace both blkcipher and ablkcipher. While all consumers of the API have
been converted long ago, some producers of the ablkcipher remain, forcing
us to keep the ablkcipher support routines alive, along with the matching
code to expose [a]blkciphers via the skcipher API.

So switch this driver to the skcipher API, allowing us to finally drop the
ablkcipher code in the near future.
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 967d4910
...@@ -708,7 +708,7 @@ config CRYPTO_DEV_BCM_SPU ...@@ -708,7 +708,7 @@ config CRYPTO_DEV_BCM_SPU
select CRYPTO_SHA512 select CRYPTO_SHA512
help help
This driver provides support for Broadcom crypto acceleration using the This driver provides support for Broadcom crypto acceleration using the
Secure Processing Unit (SPU). The SPU driver registers ablkcipher, Secure Processing Unit (SPU). The SPU driver registers skcipher,
ahash, and aead algorithms with the kernel cryptographic API. ahash, and aead algorithms with the kernel cryptographic API.
source "drivers/crypto/stm32/Kconfig" source "drivers/crypto/stm32/Kconfig"
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* /*
* Copyright 2016 Broadcom * Copyright 2016 Broadcom
...@@ -11,6 +12,7 @@ ...@@ -11,6 +12,7 @@
#include <linux/mailbox_client.h> #include <linux/mailbox_client.h>
#include <crypto/aes.h> #include <crypto/aes.h>
#include <crypto/internal/hash.h> #include <crypto/internal/hash.h>
#include <crypto/internal/skcipher.h>
#include <crypto/aead.h> #include <crypto/aead.h>
#include <crypto/arc4.h> #include <crypto/arc4.h>
#include <crypto/gcm.h> #include <crypto/gcm.h>
...@@ -102,7 +104,7 @@ struct auth_op { ...@@ -102,7 +104,7 @@ struct auth_op {
struct iproc_alg_s { struct iproc_alg_s {
u32 type; u32 type;
union { union {
struct crypto_alg crypto; struct skcipher_alg skcipher;
struct ahash_alg hash; struct ahash_alg hash;
struct aead_alg aead; struct aead_alg aead;
} alg; } alg;
...@@ -149,7 +151,7 @@ struct spu_msg_buf { ...@@ -149,7 +151,7 @@ struct spu_msg_buf {
u8 rx_stat[ALIGN(SPU_RX_STATUS_LEN, SPU_MSG_ALIGN)]; u8 rx_stat[ALIGN(SPU_RX_STATUS_LEN, SPU_MSG_ALIGN)];
union { union {
/* Buffers only used for ablkcipher */ /* Buffers only used for skcipher */
struct { struct {
/* /*
* Field used for either SUPDT when RC4 is used * Field used for either SUPDT when RC4 is used
...@@ -214,7 +216,7 @@ struct iproc_ctx_s { ...@@ -214,7 +216,7 @@ struct iproc_ctx_s {
/* /*
* Buffer to hold SPU message header template. Template is created at * Buffer to hold SPU message header template. Template is created at
* setkey time for ablkcipher requests, since most of the fields in the * setkey time for skcipher requests, since most of the fields in the
* header are known at that time. At request time, just fill in a few * header are known at that time. At request time, just fill in a few
* missing pieces related to length of data in the request and IVs, etc. * missing pieces related to length of data in the request and IVs, etc.
*/ */
...@@ -256,7 +258,7 @@ struct iproc_reqctx_s { ...@@ -256,7 +258,7 @@ struct iproc_reqctx_s {
/* total todo, rx'd, and sent for this request */ /* total todo, rx'd, and sent for this request */
unsigned int total_todo; unsigned int total_todo;
unsigned int total_received; /* only valid for ablkcipher */ unsigned int total_received; /* only valid for skcipher */
unsigned int total_sent; unsigned int total_sent;
/* /*
......
...@@ -542,7 +542,7 @@ void spu2_dump_msg_hdr(u8 *buf, unsigned int buf_len) ...@@ -542,7 +542,7 @@ void spu2_dump_msg_hdr(u8 *buf, unsigned int buf_len)
/** /**
* spu2_fmd_init() - At setkey time, initialize the fixed meta data for * spu2_fmd_init() - At setkey time, initialize the fixed meta data for
* subsequent ablkcipher requests for this context. * subsequent skcipher requests for this context.
* @spu2_cipher_type: Cipher algorithm * @spu2_cipher_type: Cipher algorithm
* @spu2_mode: Cipher mode * @spu2_mode: Cipher mode
* @cipher_key_len: Length of cipher key, in bytes * @cipher_key_len: Length of cipher key, in bytes
...@@ -1107,13 +1107,13 @@ u32 spu2_create_request(u8 *spu_hdr, ...@@ -1107,13 +1107,13 @@ u32 spu2_create_request(u8 *spu_hdr,
} }
/** /**
* spu_cipher_req_init() - Build an ablkcipher SPU2 request message header, * spu_cipher_req_init() - Build an skcipher SPU2 request message header,
* including FMD and OMD. * including FMD and OMD.
* @spu_hdr: Location of start of SPU request (FMD field) * @spu_hdr: Location of start of SPU request (FMD field)
* @cipher_parms: Parameters describing cipher request * @cipher_parms: Parameters describing cipher request
* *
* Called at setkey time to initialize a msg header that can be reused for all * Called at setkey time to initialize a msg header that can be reused for all
* subsequent ablkcipher requests. Construct the message starting at spu_hdr. * subsequent skcipher requests. Construct the message starting at spu_hdr.
* Caller should allocate this buffer in DMA-able memory at least * Caller should allocate this buffer in DMA-able memory at least
* SPU_HEADER_ALLOC_LEN bytes long. * SPU_HEADER_ALLOC_LEN bytes long.
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment