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

Commit 424a5da6 authored by Cristian Stoica's avatar Cristian Stoica Committed by Herbert Xu
Browse files

crypto: testmgr - limit IV copy length in aead tests



The working copy of IV is the same size as the transformation's IV.
It is not necessary to copy more than that from the template since
iv_len is usually less than MAX_IVLEN and the rest of the copied data
is garbage.

Signed-off-by: default avatarCristian Stoica <cristian.stoica@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent c4768993
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -429,7 +429,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
	struct scatterlist *sgout;
	struct scatterlist *sgout;
	const char *e, *d;
	const char *e, *d;
	struct tcrypt_result result;
	struct tcrypt_result result;
	unsigned int authsize;
	unsigned int authsize, iv_len;
	void *input;
	void *input;
	void *output;
	void *output;
	void *assoc;
	void *assoc;
@@ -500,10 +500,11 @@ static int __test_aead(struct crypto_aead *tfm, int enc,


		memcpy(input, template[i].input, template[i].ilen);
		memcpy(input, template[i].input, template[i].ilen);
		memcpy(assoc, template[i].assoc, template[i].alen);
		memcpy(assoc, template[i].assoc, template[i].alen);
		iv_len = crypto_aead_ivsize(tfm);
		if (template[i].iv)
		if (template[i].iv)
			memcpy(iv, template[i].iv, MAX_IVLEN);
			memcpy(iv, template[i].iv, iv_len);
		else
		else
			memset(iv, 0, MAX_IVLEN);
			memset(iv, 0, iv_len);


		crypto_aead_clear_flags(tfm, ~0);
		crypto_aead_clear_flags(tfm, ~0);
		if (template[i].wk)
		if (template[i].wk)