linux/drivers/crypto/chelsio
Wenwen Wang f16b613ca8 crypto: chtls - fix a missing-check bug
In do_chtls_setsockopt(), the tls crypto info is first copied from the
poiner 'optval' in userspace and saved to 'tmp_crypto_info'. Then the
'version' of the crypto info is checked. If the version is not as expected,
i.e., TLS_1_2_VERSION, error code -ENOTSUPP is returned to indicate that
the provided crypto info is not supported yet. Then, the 'cipher_type'
field of the 'tmp_crypto_info' is also checked to see if it is
TLS_CIPHER_AES_GCM_128. If it is, the whole struct of
tls12_crypto_info_aes_gcm_128 is copied from the pointer 'optval' and then
the function chtls_setkey() is invoked to set the key.

Given that the 'optval' pointer resides in userspace, a malicious userspace
process can race to change the data pointed by 'optval' between the two
copies. For example, a user can provide a crypto info with TLS_1_2_VERSION
and TLS_CIPHER_AES_GCM_128. After the first copy, the user can modify the
'version' and the 'cipher_type' fields to any versions and/or cipher types
that are not allowed. This way, the user can bypass the checks, inject
bad data to the kernel, cause chtls_setkey() to set a wrong key or other
issues.

This patch reuses the data copied in the first try so as to ensure these
checks will not be bypassed.

Signed-off-by: Wenwen Wang <wang6495@umn.edu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-05-27 00:12:04 +08:00
..
chtls crypto: chtls - fix a missing-check bug 2018-05-27 00:12:04 +08:00
chcr_algo.c crypto: chelsio - don't leak pointers to authenc keys 2018-03-31 01:33:12 +08:00
chcr_algo.h Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-04-04 17:11:08 -07:00
chcr_core.c chcr: Add support for Inline IPSec 2017-11-29 17:33:29 +11:00
chcr_core.h Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-04-04 17:11:08 -07:00
chcr_crypto.h crypto: chelsio - Remove declaration of static function from header 2018-03-31 01:32:50 +08:00
chcr_ipsec.c crypto: chelsio - request to HW should wrap 2018-05-19 00:13:56 +08:00
Kconfig crypto: chtls - Makefile Kconfig 2018-03-31 23:37:33 -04:00
Makefile crypto: chtls - Makefile Kconfig 2018-03-31 23:37:33 -04:00