Skip to content

Commit

Permalink
crypto: testmgr - fix length truncation with large page size
Browse files Browse the repository at this point in the history
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: 40153b1 ("crypto: testmgr - fuzz AEADs against their generic implementation")
Signed-off-by: Eric Biggers <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
ebiggers authored and herbertx committed May 30, 2019
1 parent 2621a86 commit e944eab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crypto/testmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct hash_testvec {
const char *key;
const char *plaintext;
const char *digest;
unsigned short psize;
unsigned int psize;
unsigned short ksize;
int setkey_error;
int digest_error;
Expand Down Expand Up @@ -74,7 +74,7 @@ struct cipher_testvec {
const char *ctext;
unsigned char wk; /* weak key flag */
unsigned short klen;
unsigned short len;
unsigned int len;
bool fips_skip;
bool generates_iv;
int setkey_error;
Expand Down Expand Up @@ -110,9 +110,9 @@ struct aead_testvec {
unsigned char novrfy;
unsigned char wk;
unsigned char klen;
unsigned short plen;
unsigned short clen;
unsigned short alen;
unsigned int plen;
unsigned int clen;
unsigned int alen;
int setkey_error;
int setauthsize_error;
int crypt_error;
Expand Down

0 comments on commit e944eab

Please sign in to comment.