[CRYPTO] all: Pass tfm instead of ctx to algorithms
Up until now algorithms have been happy to get a context pointer since they know everything that's in the tfm already (e.g., alignment, block size). However, once we have parameterised algorithms, such information will be specific to each tfm. So the algorithm API needs to be changed to pass the tfm structure instead of the context pointer. This patch is basically a text substitution. The only tricky bit is the assembly routines that need to get the context pointer offset through asm-offsets.h. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
此提交包含在:
@@ -37,10 +37,10 @@ struct s390_aes_ctx {
|
||||
int key_len;
|
||||
};
|
||||
|
||||
static int aes_set_key(void *ctx, const u8 *in_key, unsigned int key_len,
|
||||
u32 *flags)
|
||||
static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
|
||||
unsigned int key_len, u32 *flags)
|
||||
{
|
||||
struct s390_aes_ctx *sctx = ctx;
|
||||
struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm);
|
||||
|
||||
switch (key_len) {
|
||||
case 16:
|
||||
@@ -70,9 +70,9 @@ fail:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void aes_encrypt(void *ctx, u8 *out, const u8 *in)
|
||||
static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
||||
{
|
||||
const struct s390_aes_ctx *sctx = ctx;
|
||||
const struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm);
|
||||
|
||||
switch (sctx->key_len) {
|
||||
case 16:
|
||||
@@ -90,9 +90,9 @@ static void aes_encrypt(void *ctx, u8 *out, const u8 *in)
|
||||
}
|
||||
}
|
||||
|
||||
static void aes_decrypt(void *ctx, u8 *out, const u8 *in)
|
||||
static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
|
||||
{
|
||||
const struct s390_aes_ctx *sctx = ctx;
|
||||
const struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm);
|
||||
|
||||
switch (sctx->key_len) {
|
||||
case 16:
|
||||
|
新增問題並參考
封鎖使用者