Commit e944eab3 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: testmgr - fix length truncation with large page size

On PowerPC with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y, there is sometimes
a crash in generate_random_aead_testvec().  The problem is that the
generated test vectors use data lengths of up to about 2 * PAGE_SIZE,
which is 128 KiB on PowerPC; however, the data length fields in the test
vectors are 'unsigned short', so the lengths get truncated.  Fix this by
changing the relevant fields to 'unsigned int'.

Fixes: 40153b10 ("crypto: testmgr - fuzz AEADs against their generic implementation")
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2621a869
...@@ -43,7 +43,7 @@ struct hash_testvec { ...@@ -43,7 +43,7 @@ struct hash_testvec {
const char *key; const char *key;
const char *plaintext; const char *plaintext;
const char *digest; const char *digest;
unsigned short psize; unsigned int psize;
unsigned short ksize; unsigned short ksize;
int setkey_error; int setkey_error;
int digest_error; int digest_error;
...@@ -74,7 +74,7 @@ struct cipher_testvec { ...@@ -74,7 +74,7 @@ struct cipher_testvec {
const char *ctext; const char *ctext;
unsigned char wk; /* weak key flag */ unsigned char wk; /* weak key flag */
unsigned short klen; unsigned short klen;
unsigned short len; unsigned int len;
bool fips_skip; bool fips_skip;
bool generates_iv; bool generates_iv;
int setkey_error; int setkey_error;
...@@ -110,9 +110,9 @@ struct aead_testvec { ...@@ -110,9 +110,9 @@ struct aead_testvec {
unsigned char novrfy; unsigned char novrfy;
unsigned char wk; unsigned char wk;
unsigned char klen; unsigned char klen;
unsigned short plen; unsigned int plen;
unsigned short clen; unsigned int clen;
unsigned short alen; unsigned int alen;
int setkey_error; int setkey_error;
int setauthsize_error; int setauthsize_error;
int crypt_error; int crypt_error;
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