Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: s390 - Respect STFL bit

Bevore issuing any s390 crypto operation check whether the
CPACF facility is enabled in the facility list. That way a
virtualization layer can prevent usage of the CPACF facility
regardless of the availability of the crypto instructions.

Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Jan Glauber and committed by
Herbert Xu
a72f0dbf 3952f17e

+4
+4
arch/s390/crypto/crypt_s390.h
··· 296 296 unsigned char status[16]; 297 297 int ret; 298 298 299 + /* check if CPACF facility (bit 17) is available */ 300 + if (!(stfl() & 1ULL << (31 - 17))) 301 + return 0; 302 + 299 303 switch (func & CRYPT_S390_OP_MASK) { 300 304 case CRYPT_S390_KM: 301 305 ret = crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0);