Skip to content

[Bug] Error when attacking only one word (`words=int`)

Bug report

Summary

The words argument of selection functions accepts int arguments.
But in this case, the attack result shape has only 2 dimensions.

Steps to reproduce

sf = aes.selection_functions.decrypt.LastAddRoundKey(
        plaintext_tag='nop',
        words=6,
        guesses=_alt_guesses,
        key_tag='thekey'
    )

data = np.random.randint(0, 255, (10, 16), dtype='uint8')

print(sf(nop=data).shape())

Library version

Latest, python 3.6

Relevant screenshots/logs/whatever material useful

Possible fixes

Convert int values to list

if isinstance(words, int):
    words = [words]