]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm()
authorMark Johnston <markj@FreeBSD.org>
Mon, 30 Aug 2021 18:22:20 +0000 (14:22 -0400)
committerMark Johnston <markj@FreeBSD.org>
Mon, 6 Sep 2021 16:29:51 +0000 (12:29 -0400)
commit9ca533bfb45aa45d95e434d2682d5c5b667fb022
tree31706b06bc504c642508d9e3fa71be9b43f6b96a
parent2ea6ae7cc8146d2c05e266f80f00d35e9dc6dc24
aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm()

Given a partial block at the end of a payload, aes_encrypt_icm() would
perform a 16-byte load of the residual into a temporary variable.  This
is unsafe in principle since the full block may cross a page boundary.
Fix the problem by copying the residual into a stack buffer first.

Reported by: syzbot+b7e44cde9e2e89f0f6c9@syzkaller.appspotmail.com
Reported by: syzbot+4b5eaf123a99456b5160@syzkaller.appspotmail.com
Reported by: syzbot+70c74c1aa232633355ca@syzkaller.appspotmail.com
Reported by: syzbot+2c663776a52828373d41@syzkaller.appspotmail.com
Reviewed by: cem, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 564b6aa7fccd98654207447f870b82659b895e7b)
sys/crypto/aesni/aesni_wrap.c