Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check range in _rijndael_ecb_ functions #493

Merged
merged 1 commit into from
Sep 4, 2019

Conversation

jbech-linaro
Copy link
Contributor

There is no check that the 'skey' structure has been properly
initialized. For example, the skey->rijndael.Nr is assumed to contain a
positive number corresponding to the number of AES rounds to perform. In
_rijndael_ecb_encrypt the skey->rijndael.Nr is subtracted by two, which
can result in an integer underflow if the structure hasn't been
initialized correctly.

By clamping the value for skey->rijndael.Nr into the valid rounds for
AES we can return an error instead of ending up reading outside the
boundaries (of skey->rijndael.eK).

I've also been running the tests

./testme.sh "makefile -j8" "-DUSE_LTM -DLTM_DESC -I../libtommath" ../libtommath/libtommath.a test

And I couldn't spot any errors, full log can be found here.

There is no check that the 'skey' structure has been properly
initialized. For example, the skey->rijndael.Nr is assumed to contain a
positive number corresponding to the number of AES rounds to perform. In
_rijndael_ecb_encrypt the skey->rijndael.Nr is subtracted by two, which
can result in an integer underflow if the structure hasn't been
initialized correctly.

By clamping the value for skey->rijndael.Nr into the valid rounds for
AES we can return an error instead of ending up reading outside the
boundaries (of skey->rijndael.eK).

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Reported-by: Martijn Bogaard <bogaard@riscure.com>
@jbech-linaro
Copy link
Contributor Author

All Travis errors seems to be related to apt-get issues.

@sjaeckel sjaeckel merged commit a1f6312 into libtom:develop Sep 4, 2019
@jbech-linaro jbech-linaro deleted the rijndael_range branch September 4, 2019 11:45
sjaeckel added a commit that referenced this pull request Oct 2, 2019
Inspired by #493 of @jbech-linaro I reviewed all blockciphers
for similar patterns.
sjaeckel added a commit that referenced this pull request Oct 8, 2019
Inspired by #493 of @jbech-linaro I reviewed all blockciphers
for similar patterns.

Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
sjaeckel added a commit that referenced this pull request Oct 11, 2019
Inspired by #493 of @jbech-linaro I reviewed all blockciphers
for similar patterns.

Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
sjaeckel added a commit that referenced this pull request Oct 12, 2019
Inspired by #493 of @jbech-linaro I reviewed all blockciphers
for similar patterns.

Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants