Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec1248e7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  [CRYPTO] aes: Fixed array boundary violation
  [CRYPTO] tcrypt: Fix key alignment
  [CRYPTO] all: Add missing cra_alignmask
  [CRYPTO] all: Use kzalloc where possible
  [CRYPTO] api: Align tfm context as wide as possible
  [CRYPTO] twofish: Use rol32/ror32 where appropriate
parents 3d1f337b 55e9dce3
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -77,12 +77,11 @@ static inline u8 byte(const u32 x, const unsigned n)
struct aes_ctx
{
	u32 key_length;
	u32 E[60];
	u32 D[60];
	u32 buf[120];
};

#define E_KEY ctx->E
#define D_KEY ctx->D
#define E_KEY (&ctx->buf[0])
#define D_KEY (&ctx->buf[60])

static u8 pow_tab[256] __initdata;
static u8 log_tab[256] __initdata;
+3 −4
Original line number Diff line number Diff line
@@ -75,12 +75,11 @@ byte(const u32 x, const unsigned n)

struct aes_ctx {
	int key_length;
	u32 E[60];
	u32 D[60];
	u32 buf[120];
};

#define E_KEY ctx->E
#define D_KEY ctx->D
#define E_KEY (&ctx->buf[0])
#define D_KEY (&ctx->buf[60])

static u8 pow_tab[256] __initdata;
static u8 log_tab[256] __initdata;
+2 −4
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ static unsigned int crypto_ctxsize(struct crypto_alg *alg, int flags)
		break;
	}

	return len + alg->cra_alignmask;
	return len + (alg->cra_alignmask & ~(crypto_tfm_ctx_alignment() - 1));
}

struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
@@ -179,12 +179,10 @@ struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
		goto out;

	tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, flags);
	tfm = kmalloc(tfm_size, GFP_KERNEL);
	tfm = kzalloc(tfm_size, GFP_KERNEL);
	if (tfm == NULL)
		goto out_put;

	memset(tfm, 0, tfm_size);
	
	tfm->__crt_alg = alg;
	
	if (crypto_init_flags(tfm, flags))
+1 −2
Original line number Diff line number Diff line
@@ -73,12 +73,11 @@ static int deflate_decomp_init(struct deflate_ctx *ctx)
	int ret = 0;
	struct z_stream_s *stream = &ctx->decomp_stream;

	stream->workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
	stream->workspace = kzalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
	if (!stream->workspace ) {
		ret = -ENOMEM;
		goto out;
	}
	memset(stream->workspace, 0, zlib_inflate_workspacesize());
	ret = zlib_inflateInit2(stream, -DEFLATE_DEF_WINBITS);
	if (ret != Z_OK) {
		ret = -EINVAL;
+1 −0
Original line number Diff line number Diff line
@@ -965,6 +965,7 @@ static struct crypto_alg des3_ede_alg = {
	.cra_blocksize		=	DES3_EDE_BLOCK_SIZE,
	.cra_ctxsize		=	sizeof(struct des3_ede_ctx),
	.cra_module		=	THIS_MODULE,
	.cra_alignmask		=	3,
	.cra_list		=	LIST_HEAD_INIT(des3_ede_alg.cra_list),
	.cra_u			=	{ .cipher = {
	.cia_min_keysize	=	DES3_EDE_KEY_SIZE,
Loading