Handle zero length plaintext for VIA PadLock functions
authorMatthias-Christian Ott <ott@mirix.org>
Tue, 30 Dec 2014 09:57:36 +0000 (11:57 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 30 Dec 2014 09:57:36 +0000 (11:57 +0200)
commit33f4e67e5e9f41190f7e8e5c79e64579f400498d
treeb9d33363bbcdbfc7d932857a6ae23c2e793657a4
parent45678b9818ba13068ca2c4acef7bb3ea5b70008c
Handle zero length plaintext for VIA PadLock functions

If the plaintext is shorter than the block size of the used cipher,
_gnutls_auth_cipher_encrypt2_tag calls _gnutls_cipher_encrypt2 with
textlen = 0. padlock_ecb_encrypt and padlock_cbc_encrypt assume that the
plaintext length (last parameter) is greater than zero and segfault
otherwise. The assembler code for both functions is automatically
generated and imported from OpenSSL, so to ease maintenance the length
should be validated in the functions that call padlock_ecb_encrypt or
padlock_cbc_encrypt.
lib/accelerated/x86/aes-gcm-padlock.c
lib/accelerated/x86/aes-padlock.c