Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 247781
b: refs/heads/master
c: 1822bc9
h: refs/heads/master
i:
  247779: 5fed926
v: v3
  • Loading branch information
Jan Glauber authored and Herbert Xu committed May 4, 2011
1 parent 1dc4c51 commit 0612943
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba0e14acc417eceb895efda1ff46366f4d1728f8
refs/heads/master: 1822bc9093e05059e4144d6041b0f5450ad275e1
6 changes: 3 additions & 3 deletions trunk/arch/s390/crypto/aes_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,11 @@ static int __init aes_s390_init(void)
{
int ret;

if (crypt_s390_func_available(KM_AES_128_ENCRYPT))
if (crypt_s390_func_available(KM_AES_128_ENCRYPT, CRYPT_S390_MSA))
keylen_flag |= AES_KEYLEN_128;
if (crypt_s390_func_available(KM_AES_192_ENCRYPT))
if (crypt_s390_func_available(KM_AES_192_ENCRYPT, CRYPT_S390_MSA))
keylen_flag |= AES_KEYLEN_192;
if (crypt_s390_func_available(KM_AES_256_ENCRYPT))
if (crypt_s390_func_available(KM_AES_256_ENCRYPT, CRYPT_S390_MSA))
keylen_flag |= AES_KEYLEN_256;

if (!keylen_flag)
Expand Down
14 changes: 11 additions & 3 deletions trunk/arch/s390/crypto/crypt_s390.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#define CRYPT_S390_PRIORITY 300
#define CRYPT_S390_COMPOSITE_PRIORITY 400

#define CRYPT_S390_MSA 0x1
#define CRYPT_S390_MSA3 0x2
#define CRYPT_S390_MSA4 0x4

/* s390 cryptographic operations */
enum crypt_s390_operations {
CRYPT_S390_KM = 0x0100,
Expand Down Expand Up @@ -291,13 +295,17 @@ static inline int crypt_s390_kmac(long func, void *param,
*
* Returns 1 if func available; 0 if func or op in general not available
*/
static inline int crypt_s390_func_available(int func)
static inline int crypt_s390_func_available(int func,
unsigned int facility_mask)
{
unsigned char status[16];
int ret;

/* check if CPACF facility (bit 17) is available */
if (!test_facility(17))
if (facility_mask & CRYPT_S390_MSA && !test_facility(17))
return 0;
if (facility_mask & CRYPT_S390_MSA3 && !test_facility(76))
return 0;
if (facility_mask & CRYPT_S390_MSA4 && !test_facility(77))
return 0;

switch (func & CRYPT_S390_OP_MASK) {
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/s390/crypto/des_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ static int des_s390_init(void)
{
int ret;

if (!crypt_s390_func_available(KM_DEA_ENCRYPT) ||
!crypt_s390_func_available(KM_TDEA_192_ENCRYPT))
if (!crypt_s390_func_available(KM_DEA_ENCRYPT, CRYPT_S390_MSA) ||
!crypt_s390_func_available(KM_TDEA_192_ENCRYPT, CRYPT_S390_MSA))
return -EOPNOTSUPP;

ret = crypto_register_alg(&des_alg);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/s390/crypto/prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static int __init prng_init(void)
int ret;

/* check if the CPU has a PRNG */
if (!crypt_s390_func_available(KMC_PRNG))
if (!crypt_s390_func_available(KMC_PRNG, CRYPT_S390_MSA))
return -EOPNOTSUPP;

if (prng_chunk_size < 8)
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/s390/crypto/sha1_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static struct shash_alg alg = {

static int __init sha1_s390_init(void)
{
if (!crypt_s390_func_available(KIMD_SHA_1))
if (!crypt_s390_func_available(KIMD_SHA_1, CRYPT_S390_MSA))
return -EOPNOTSUPP;
return crypto_register_shash(&alg);
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/s390/crypto/sha256_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static struct shash_alg alg = {

static int sha256_s390_init(void)
{
if (!crypt_s390_func_available(KIMD_SHA_256))
if (!crypt_s390_func_available(KIMD_SHA_256, CRYPT_S390_MSA))
return -EOPNOTSUPP;

return crypto_register_shash(&alg);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/s390/crypto/sha512_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static int __init init(void)
{
int ret;

if (!crypt_s390_func_available(KIMD_SHA_512))
if (!crypt_s390_func_available(KIMD_SHA_512, CRYPT_S390_MSA))
return -EOPNOTSUPP;
if ((ret = crypto_register_shash(&sha512_alg)) < 0)
goto out;
Expand Down

0 comments on commit 0612943

Please sign in to comment.