Commit 8ff34588 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390/zcrypt: get rid of little/big endian handling

The zcrypt code contains a couple of functions which receive a
"big_endian" argument. All callers naturally pass "1" for big endian,
since s390 is big endian. Therefore get rid of this argument and also
get rid of the cpu_to_le()/cpu_to_be() calls.

This way we get rid of a couple of sparse warnings:

drivers/s390/crypto/zcrypt_cca_key.h:255:34:
 warning: incorrect type in assignment (different base types)
    expected unsigned short [unsigned] ulen
    got restricted __be16 [usertype] <noident>

Cc: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 35bb092a
...@@ -133,8 +133,7 @@ struct cca_pvt_ext_CRT_sec { ...@@ -133,8 +133,7 @@ struct cca_pvt_ext_CRT_sec {
* *
* Returns the size of the key area or -EFAULT * Returns the size of the key area or -EFAULT
*/ */
static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex, static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex, void *p)
void *p, int big_endian)
{ {
static struct cca_token_hdr static_pvt_me_hdr = { static struct cca_token_hdr static_pvt_me_hdr = {
.token_identifier = 0x1E, .token_identifier = 0x1E,
...@@ -162,13 +161,8 @@ static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex, ...@@ -162,13 +161,8 @@ static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex,
memset(key, 0, sizeof(*key)); memset(key, 0, sizeof(*key));
if (big_endian) { key->t6_hdr.blen = 0x189;
key->t6_hdr.blen = cpu_to_be16(0x189); key->t6_hdr.ulen = 0x189 - 2;
key->t6_hdr.ulen = cpu_to_be16(0x189 - 2);
} else {
key->t6_hdr.blen = cpu_to_le16(0x189);
key->t6_hdr.ulen = cpu_to_le16(0x189 - 2);
}
key->pvtMeHdr = static_pvt_me_hdr; key->pvtMeHdr = static_pvt_me_hdr;
key->pvtMeSec = static_pvt_me_sec; key->pvtMeSec = static_pvt_me_sec;
key->pubMeSec = static_pub_me_sec; key->pubMeSec = static_pub_me_sec;
...@@ -205,8 +199,7 @@ static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex, ...@@ -205,8 +199,7 @@ static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex,
* *
* Returns the size of the key area or -EFAULT * Returns the size of the key area or -EFAULT
*/ */
static inline int zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex, static inline int zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex, void *p)
void *p, int big_endian)
{ {
static struct cca_token_hdr static_pub_hdr = { static struct cca_token_hdr static_pub_hdr = {
.token_identifier = 0x1E, .token_identifier = 0x1E,
...@@ -251,13 +244,8 @@ static inline int zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex, ...@@ -251,13 +244,8 @@ static inline int zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex,
2*mex->inputdatalength - i; 2*mex->inputdatalength - i;
key->pubHdr.token_length = key->pubHdr.token_length =
key->pubSec.section_length + sizeof(key->pubHdr); key->pubSec.section_length + sizeof(key->pubHdr);
if (big_endian) { key->t6_hdr.ulen = key->pubHdr.token_length + 4;
key->t6_hdr.ulen = cpu_to_be16(key->pubHdr.token_length + 4); key->t6_hdr.blen = key->pubHdr.token_length + 6;
key->t6_hdr.blen = cpu_to_be16(key->pubHdr.token_length + 6);
} else {
key->t6_hdr.ulen = cpu_to_le16(key->pubHdr.token_length + 4);
key->t6_hdr.blen = cpu_to_le16(key->pubHdr.token_length + 6);
}
return sizeof(*key) + 2*mex->inputdatalength - i; return sizeof(*key) + 2*mex->inputdatalength - i;
} }
...@@ -271,8 +259,7 @@ static inline int zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex, ...@@ -271,8 +259,7 @@ static inline int zcrypt_type6_mex_key_en(struct ica_rsa_modexpo *mex,
* *
* Returns the size of the key area or -EFAULT * Returns the size of the key area or -EFAULT
*/ */
static inline int zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt, static inline int zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt, void *p)
void *p, int big_endian)
{ {
static struct cca_public_sec static_cca_pub_sec = { static struct cca_public_sec static_cca_pub_sec = {
.section_identifier = 4, .section_identifier = 4,
...@@ -298,13 +285,8 @@ static inline int zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt, ...@@ -298,13 +285,8 @@ static inline int zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt,
size = sizeof(*key) + key_len + sizeof(*pub) + 3; size = sizeof(*key) + key_len + sizeof(*pub) + 3;
/* parameter block.key block */ /* parameter block.key block */
if (big_endian) { key->t6_hdr.blen = size;
key->t6_hdr.blen = cpu_to_be16(size); key->t6_hdr.ulen = size - 2;
key->t6_hdr.ulen = cpu_to_be16(size - 2);
} else {
key->t6_hdr.blen = cpu_to_le16(size);
key->t6_hdr.ulen = cpu_to_le16(size - 2);
}
/* key token header */ /* key token header */
key->token.token_identifier = CCA_TKN_HDR_ID_EXT; key->token.token_identifier = CCA_TKN_HDR_ID_EXT;
......
...@@ -291,7 +291,7 @@ static int ICAMEX_msg_to_type6MEX_msgX(struct zcrypt_queue *zq, ...@@ -291,7 +291,7 @@ static int ICAMEX_msg_to_type6MEX_msgX(struct zcrypt_queue *zq,
return -EFAULT; return -EFAULT;
/* Set up key which is located after the variable length text. */ /* Set up key which is located after the variable length text. */
size = zcrypt_type6_mex_key_en(mex, msg->text+mex->inputdatalength, 1); size = zcrypt_type6_mex_key_en(mex, msg->text+mex->inputdatalength);
if (size < 0) if (size < 0)
return size; return size;
size += sizeof(*msg) + mex->inputdatalength; size += sizeof(*msg) + mex->inputdatalength;
...@@ -353,7 +353,7 @@ static int ICACRT_msg_to_type6CRT_msgX(struct zcrypt_queue *zq, ...@@ -353,7 +353,7 @@ static int ICACRT_msg_to_type6CRT_msgX(struct zcrypt_queue *zq,
return -EFAULT; return -EFAULT;
/* Set up key which is located after the variable length text. */ /* Set up key which is located after the variable length text. */
size = zcrypt_type6_crt_key(crt, msg->text + crt->inputdatalength, 1); size = zcrypt_type6_crt_key(crt, msg->text + crt->inputdatalength);
if (size < 0) if (size < 0)
return size; return size;
size += sizeof(*msg) + crt->inputdatalength; /* total size of msg */ size += sizeof(*msg) + crt->inputdatalength; /* total size of msg */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment