summaryrefslogtreecommitdiff
path: root/crypto/pcbc.c
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2016-11-29 09:45:04 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-11-30 19:46:44 +0800
commitec0d9079f2d0a97197891401f0db1c51a64b2891 (patch)
tree7a4ace7d9faa04c638957847537670f96566e574 /crypto/pcbc.c
parentc24d856ab6af7c070faf98f3e4db107d5f5e0568 (diff)
downloadlinux-crypto-ec0d9079f2d0a97197891401f0db1c51a64b2891.tar.gz
linux-crypto-ec0d9079f2d0a97197891401f0db1c51a64b2891.zip
crypto: drbg - prevent invalid SG mappings
When using SGs, only heap memory (memory that is valid as per virt_addr_valid) is allowed to be referenced. The CTR DRBG used to reference the caller-provided memory directly in an SG. In case the caller provided stack memory pointers, the SG mapping is not considered to be valid. In some cases, this would even cause a paging fault. The change adds a new scratch buffer that is used unconditionally to catch the cases where the caller-provided buffer is not suitable for use in an SG. The crypto operation of the CTR DRBG produces its output with that scratch buffer and finally copies the content of the scratch buffer to the caller's buffer. The scratch buffer is allocated during allocation time of the CTR DRBG as its access is protected with the DRBG mutex. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/pcbc.c')
0 files changed, 0 insertions, 0 deletions