s390/crypto: simplify return code handling
The CPACF instructions can complete with three different condition codes: CC=0 for successful completion, CC=1 if the protected key verification failed, and CC=3 for partial completion. The inline functions will restart the CPACF instruction for partial completion, this removes the CC=3 case. The CC=1 case is only relevant for the protected key functions of the KM, KMC, KMAC and KMCTR instructions. As the protected key functions are not used by the current code, there is no need for any kind of return code handling. Reviewed-by: Harald Freudenberger <freude@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
edc63a3785
commit
0177db01ad
|
@ -324,9 +324,7 @@ static int ecb_aes_crypt(struct blkcipher_desc *desc, long func, void *param,
|
|||
u8 *out = walk->dst.virt.addr;
|
||||
u8 *in = walk->src.virt.addr;
|
||||
|
||||
ret = cpacf_km(func, param, out, in, n);
|
||||
if (ret < 0 || ret != n)
|
||||
return -EIO;
|
||||
cpacf_km(func, param, out, in, n);
|
||||
|
||||
nbytes &= AES_BLOCK_SIZE - 1;
|
||||
ret = blkcipher_walk_done(desc, walk, nbytes);
|
||||
|
@ -460,9 +458,7 @@ static int cbc_aes_crypt(struct blkcipher_desc *desc, long func,
|
|||
u8 *out = walk->dst.virt.addr;
|
||||
u8 *in = walk->src.virt.addr;
|
||||
|
||||
ret = cpacf_kmc(func, ¶m, out, in, n);
|
||||
if (ret < 0 || ret != n)
|
||||
return -EIO;
|
||||
cpacf_kmc(func, ¶m, out, in, n);
|
||||
|
||||
nbytes &= AES_BLOCK_SIZE - 1;
|
||||
ret = blkcipher_walk_done(desc, walk, nbytes);
|
||||
|
@ -640,9 +636,7 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func,
|
|||
memcpy(pcc_param.tweak, walk->iv, sizeof(pcc_param.tweak));
|
||||
memcpy(pcc_param.key, xts_ctx->pcc_key, 32);
|
||||
/* remove decipher modifier bit from 'func' and call PCC */
|
||||
ret = cpacf_pcc(func & 0x7f, &pcc_param.key[offset]);
|
||||
if (ret < 0)
|
||||
return -EIO;
|
||||
cpacf_pcc(func & 0x7f, &pcc_param.key[offset]);
|
||||
|
||||
memcpy(xts_param.key, xts_ctx->key, 32);
|
||||
memcpy(xts_param.init, pcc_param.xts, 16);
|
||||
|
@ -652,9 +646,7 @@ static int xts_aes_crypt(struct blkcipher_desc *desc, long func,
|
|||
out = walk->dst.virt.addr;
|
||||
in = walk->src.virt.addr;
|
||||
|
||||
ret = cpacf_km(func, &xts_param.key[offset], out, in, n);
|
||||
if (ret < 0 || ret != n)
|
||||
return -EIO;
|
||||
cpacf_km(func, &xts_param.key[offset], out, in, n);
|
||||
|
||||
nbytes &= AES_BLOCK_SIZE - 1;
|
||||
ret = blkcipher_walk_done(desc, walk, nbytes);
|
||||
|
@ -798,12 +790,7 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
|
|||
n = __ctrblk_init(ctrptr, nbytes);
|
||||
else
|
||||
n = AES_BLOCK_SIZE;
|
||||
ret = cpacf_kmctr(func, sctx->key, out, in, n, ctrptr);
|
||||
if (ret < 0 || ret != n) {
|
||||
if (ctrptr == ctrblk)
|
||||
spin_unlock(&ctrblk_lock);
|
||||
return -EIO;
|
||||
}
|
||||
cpacf_kmctr(func, sctx->key, out, in, n, ctrptr);
|
||||
if (n > AES_BLOCK_SIZE)
|
||||
memcpy(ctrptr, ctrptr + n - AES_BLOCK_SIZE,
|
||||
AES_BLOCK_SIZE);
|
||||
|
@ -830,10 +817,7 @@ static int ctr_aes_crypt(struct blkcipher_desc *desc, long func,
|
|||
if (nbytes) {
|
||||
out = walk->dst.virt.addr;
|
||||
in = walk->src.virt.addr;
|
||||
ret = cpacf_kmctr(func, sctx->key, buf, in,
|
||||
AES_BLOCK_SIZE, ctrbuf);
|
||||
if (ret < 0 || ret != AES_BLOCK_SIZE)
|
||||
return -EIO;
|
||||
cpacf_kmctr(func, sctx->key, buf, in, AES_BLOCK_SIZE, ctrbuf);
|
||||
memcpy(out, buf, nbytes);
|
||||
crypto_inc(ctrbuf, AES_BLOCK_SIZE);
|
||||
ret = blkcipher_walk_done(desc, walk, 0);
|
||||
|
|
|
@ -95,9 +95,7 @@ static int ecb_desall_crypt(struct blkcipher_desc *desc, long func,
|
|||
u8 *out = walk->dst.virt.addr;
|
||||
u8 *in = walk->src.virt.addr;
|
||||
|
||||
ret = cpacf_km(func, key, out, in, n);
|
||||
if (ret < 0 || ret != n)
|
||||
return -EIO;
|
||||
cpacf_km(func, key, out, in, n);
|
||||
|
||||
nbytes &= DES_BLOCK_SIZE - 1;
|
||||
ret = blkcipher_walk_done(desc, walk, nbytes);
|
||||
|
@ -128,9 +126,7 @@ static int cbc_desall_crypt(struct blkcipher_desc *desc, long func,
|
|||
u8 *out = walk->dst.virt.addr;
|
||||
u8 *in = walk->src.virt.addr;
|
||||
|
||||
ret = cpacf_kmc(func, ¶m, out, in, n);
|
||||
if (ret < 0 || ret != n)
|
||||
return -EIO;
|
||||
cpacf_kmc(func, ¶m, out, in, n);
|
||||
|
||||
nbytes &= DES_BLOCK_SIZE - 1;
|
||||
ret = blkcipher_walk_done(desc, walk, nbytes);
|
||||
|
@ -411,12 +407,7 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
|
|||
n = __ctrblk_init(ctrptr, nbytes);
|
||||
else
|
||||
n = DES_BLOCK_SIZE;
|
||||
ret = cpacf_kmctr(func, ctx->key, out, in, n, ctrptr);
|
||||
if (ret < 0 || ret != n) {
|
||||
if (ctrptr == ctrblk)
|
||||
spin_unlock(&ctrblk_lock);
|
||||
return -EIO;
|
||||
}
|
||||
cpacf_kmctr(func, ctx->key, out, in, n, ctrptr);
|
||||
if (n > DES_BLOCK_SIZE)
|
||||
memcpy(ctrptr, ctrptr + n - DES_BLOCK_SIZE,
|
||||
DES_BLOCK_SIZE);
|
||||
|
@ -441,10 +432,7 @@ static int ctr_desall_crypt(struct blkcipher_desc *desc, long func,
|
|||
if (nbytes) {
|
||||
out = walk->dst.virt.addr;
|
||||
in = walk->src.virt.addr;
|
||||
ret = cpacf_kmctr(func, ctx->key, buf, in,
|
||||
DES_BLOCK_SIZE, ctrbuf);
|
||||
if (ret < 0 || ret != DES_BLOCK_SIZE)
|
||||
return -EIO;
|
||||
cpacf_kmctr(func, ctx->key, buf, in, DES_BLOCK_SIZE, ctrbuf);
|
||||
memcpy(out, buf, nbytes);
|
||||
crypto_inc(ctrbuf, DES_BLOCK_SIZE);
|
||||
ret = blkcipher_walk_done(desc, walk, 0);
|
||||
|
|
|
@ -58,7 +58,6 @@ static int ghash_update(struct shash_desc *desc,
|
|||
struct ghash_desc_ctx *dctx = shash_desc_ctx(desc);
|
||||
unsigned int n;
|
||||
u8 *buf = dctx->buffer;
|
||||
int ret;
|
||||
|
||||
if (dctx->bytes) {
|
||||
u8 *pos = buf + (GHASH_BLOCK_SIZE - dctx->bytes);
|
||||
|
@ -71,18 +70,14 @@ static int ghash_update(struct shash_desc *desc,
|
|||
src += n;
|
||||
|
||||
if (!dctx->bytes) {
|
||||
ret = cpacf_kimd(CPACF_KIMD_GHASH, dctx, buf,
|
||||
GHASH_BLOCK_SIZE);
|
||||
if (ret != GHASH_BLOCK_SIZE)
|
||||
return -EIO;
|
||||
cpacf_kimd(CPACF_KIMD_GHASH, dctx, buf,
|
||||
GHASH_BLOCK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
n = srclen & ~(GHASH_BLOCK_SIZE - 1);
|
||||
if (n) {
|
||||
ret = cpacf_kimd(CPACF_KIMD_GHASH, dctx, src, n);
|
||||
if (ret != n)
|
||||
return -EIO;
|
||||
cpacf_kimd(CPACF_KIMD_GHASH, dctx, src, n);
|
||||
src += n;
|
||||
srclen -= n;
|
||||
}
|
||||
|
@ -98,17 +93,12 @@ static int ghash_update(struct shash_desc *desc,
|
|||
static int ghash_flush(struct ghash_desc_ctx *dctx)
|
||||
{
|
||||
u8 *buf = dctx->buffer;
|
||||
int ret;
|
||||
|
||||
if (dctx->bytes) {
|
||||
u8 *pos = buf + (GHASH_BLOCK_SIZE - dctx->bytes);
|
||||
|
||||
memset(pos, 0, dctx->bytes);
|
||||
|
||||
ret = cpacf_kimd(CPACF_KIMD_GHASH, dctx, buf, GHASH_BLOCK_SIZE);
|
||||
if (ret != GHASH_BLOCK_SIZE)
|
||||
return -EIO;
|
||||
|
||||
cpacf_kimd(CPACF_KIMD_GHASH, dctx, buf, GHASH_BLOCK_SIZE);
|
||||
dctx->bytes = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,12 +135,7 @@ static int generate_entropy(u8 *ebuf, size_t nbytes)
|
|||
else
|
||||
h = ebuf;
|
||||
/* generate sha256 from this page */
|
||||
if (cpacf_kimd(CPACF_KIMD_SHA_256, h,
|
||||
pg, PAGE_SIZE) != PAGE_SIZE) {
|
||||
prng_errorflag = PRNG_GEN_ENTROPY_FAILED;
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
cpacf_kimd(CPACF_KIMD_SHA_256, h, pg, PAGE_SIZE);
|
||||
if (n < sizeof(hash))
|
||||
memcpy(ebuf, hash, n);
|
||||
ret += n;
|
||||
|
@ -148,7 +143,6 @@ static int generate_entropy(u8 *ebuf, size_t nbytes)
|
|||
nbytes -= n;
|
||||
}
|
||||
|
||||
out:
|
||||
free_page((unsigned long)pg);
|
||||
return ret;
|
||||
}
|
||||
|
@ -160,13 +154,11 @@ static void prng_tdes_add_entropy(void)
|
|||
{
|
||||
__u64 entropy[4];
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
ret = cpacf_kmc(CPACF_KMC_PRNG, prng_data->prngws.parm_block,
|
||||
(char *)entropy, (char *)entropy,
|
||||
sizeof(entropy));
|
||||
BUG_ON(ret < 0 || ret != sizeof(entropy));
|
||||
cpacf_kmc(CPACF_KMC_PRNG, prng_data->prngws.parm_block,
|
||||
(char *) entropy, (char *) entropy,
|
||||
sizeof(entropy));
|
||||
memcpy(prng_data->prngws.parm_block, entropy, sizeof(entropy));
|
||||
}
|
||||
}
|
||||
|
@ -303,21 +295,14 @@ static int __init prng_sha512_selftest(void)
|
|||
0x21, 0xe4, 0xb0, 0x86, 0x44, 0xf6, 0x72, 0x7c,
|
||||
0x36, 0x8c, 0x5a, 0x9f, 0x7a, 0x4b, 0x3e, 0xe2 };
|
||||
|
||||
int ret = 0;
|
||||
u8 buf[sizeof(random)];
|
||||
struct ppno_ws_s ws;
|
||||
|
||||
memset(&ws, 0, sizeof(ws));
|
||||
|
||||
/* initial seed */
|
||||
ret = cpacf_ppno(CPACF_PPNO_SHA512_DRNG_SEED, &ws, NULL, 0,
|
||||
seed, sizeof(seed));
|
||||
if (ret < 0) {
|
||||
pr_err("The prng self test seed operation for the "
|
||||
"SHA-512 mode failed with rc=%d\n", ret);
|
||||
prng_errorflag = PRNG_SELFTEST_FAILED;
|
||||
return -EIO;
|
||||
}
|
||||
cpacf_ppno(CPACF_PPNO_SHA512_DRNG_SEED,
|
||||
&ws, NULL, 0, seed, sizeof(seed));
|
||||
|
||||
/* check working states V and C */
|
||||
if (memcmp(ws.V, V0, sizeof(V0)) != 0
|
||||
|
@ -329,22 +314,10 @@ static int __init prng_sha512_selftest(void)
|
|||
}
|
||||
|
||||
/* generate random bytes */
|
||||
ret = cpacf_ppno(CPACF_PPNO_SHA512_DRNG_GEN,
|
||||
&ws, buf, sizeof(buf), NULL, 0);
|
||||
if (ret < 0) {
|
||||
pr_err("The prng self test generate operation for "
|
||||
"the SHA-512 mode failed with rc=%d\n", ret);
|
||||
prng_errorflag = PRNG_SELFTEST_FAILED;
|
||||
return -EIO;
|
||||
}
|
||||
ret = cpacf_ppno(CPACF_PPNO_SHA512_DRNG_GEN,
|
||||
&ws, buf, sizeof(buf), NULL, 0);
|
||||
if (ret < 0) {
|
||||
pr_err("The prng self test generate operation for "
|
||||
"the SHA-512 mode failed with rc=%d\n", ret);
|
||||
prng_errorflag = PRNG_SELFTEST_FAILED;
|
||||
return -EIO;
|
||||
}
|
||||
cpacf_ppno(CPACF_PPNO_SHA512_DRNG_GEN,
|
||||
&ws, buf, sizeof(buf), NULL, 0);
|
||||
cpacf_ppno(CPACF_PPNO_SHA512_DRNG_GEN,
|
||||
&ws, buf, sizeof(buf), NULL, 0);
|
||||
|
||||
/* check against expected data */
|
||||
if (memcmp(buf, random, sizeof(random)) != 0) {
|
||||
|
@ -392,26 +365,16 @@ static int __init prng_sha512_instantiate(void)
|
|||
get_tod_clock_ext(seed + 48);
|
||||
|
||||
/* initial seed of the ppno drng */
|
||||
ret = cpacf_ppno(CPACF_PPNO_SHA512_DRNG_SEED,
|
||||
&prng_data->ppnows, NULL, 0, seed, sizeof(seed));
|
||||
if (ret < 0) {
|
||||
prng_errorflag = PRNG_SEED_FAILED;
|
||||
ret = -EIO;
|
||||
goto outfree;
|
||||
}
|
||||
cpacf_ppno(CPACF_PPNO_SHA512_DRNG_SEED,
|
||||
&prng_data->ppnows, NULL, 0, seed, sizeof(seed));
|
||||
|
||||
/* if fips mode is enabled, generate a first block of random
|
||||
bytes for the FIPS 140-2 Conditional Self Test */
|
||||
if (fips_enabled) {
|
||||
prng_data->prev = prng_data->buf + prng_chunk_size;
|
||||
ret = cpacf_ppno(CPACF_PPNO_SHA512_DRNG_GEN,
|
||||
&prng_data->ppnows,
|
||||
prng_data->prev, prng_chunk_size, NULL, 0);
|
||||
if (ret < 0 || ret != prng_chunk_size) {
|
||||
prng_errorflag = PRNG_GEN_FAILED;
|
||||
ret = -EIO;
|
||||
goto outfree;
|
||||
}
|
||||
cpacf_ppno(CPACF_PPNO_SHA512_DRNG_GEN,
|
||||
&prng_data->ppnows,
|
||||
prng_data->prev, prng_chunk_size, NULL, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -440,12 +403,8 @@ static int prng_sha512_reseed(void)
|
|||
return ret;
|
||||
|
||||
/* do a reseed of the ppno drng with this bytestring */
|
||||
ret = cpacf_ppno(CPACF_PPNO_SHA512_DRNG_SEED,
|
||||
&prng_data->ppnows, NULL, 0, seed, sizeof(seed));
|
||||
if (ret) {
|
||||
prng_errorflag = PRNG_RESEED_FAILED;
|
||||
return -EIO;
|
||||
}
|
||||
cpacf_ppno(CPACF_PPNO_SHA512_DRNG_SEED,
|
||||
&prng_data->ppnows, NULL, 0, seed, sizeof(seed));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -463,12 +422,8 @@ static int prng_sha512_generate(u8 *buf, size_t nbytes)
|
|||
}
|
||||
|
||||
/* PPNO generate */
|
||||
ret = cpacf_ppno(CPACF_PPNO_SHA512_DRNG_GEN,
|
||||
&prng_data->ppnows, buf, nbytes, NULL, 0);
|
||||
if (ret < 0 || ret != nbytes) {
|
||||
prng_errorflag = PRNG_GEN_FAILED;
|
||||
return -EIO;
|
||||
}
|
||||
cpacf_ppno(CPACF_PPNO_SHA512_DRNG_GEN,
|
||||
&prng_data->ppnows, buf, nbytes, NULL, 0);
|
||||
|
||||
/* FIPS 140-2 Conditional Self Test */
|
||||
if (fips_enabled) {
|
||||
|
@ -494,7 +449,7 @@ static int prng_open(struct inode *inode, struct file *file)
|
|||
static ssize_t prng_tdes_read(struct file *file, char __user *ubuf,
|
||||
size_t nbytes, loff_t *ppos)
|
||||
{
|
||||
int chunk, n, tmp, ret = 0;
|
||||
int chunk, n, ret = 0;
|
||||
|
||||
/* lock prng_data struct */
|
||||
if (mutex_lock_interruptible(&prng_data->mutex))
|
||||
|
@ -545,13 +500,9 @@ static ssize_t prng_tdes_read(struct file *file, char __user *ubuf,
|
|||
*
|
||||
* Note: you can still get strict X9.17 conformity by setting
|
||||
* prng_chunk_size to 8 bytes.
|
||||
*/
|
||||
tmp = cpacf_kmc(CPACF_KMC_PRNG, prng_data->prngws.parm_block,
|
||||
prng_data->buf, prng_data->buf, n);
|
||||
if (tmp < 0 || tmp != n) {
|
||||
ret = -EIO;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
cpacf_kmc(CPACF_KMC_PRNG, prng_data->prngws.parm_block,
|
||||
prng_data->buf, prng_data->buf, n);
|
||||
|
||||
prng_data->prngws.byte_counter += n;
|
||||
prng_data->prngws.reseed_counter += n;
|
||||
|
|
|
@ -22,8 +22,7 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
|
|||
{
|
||||
struct s390_sha_ctx *ctx = shash_desc_ctx(desc);
|
||||
unsigned int bsize = crypto_shash_blocksize(desc->tfm);
|
||||
unsigned int index;
|
||||
int ret;
|
||||
unsigned int index, n;
|
||||
|
||||
/* how much is already in the buffer? */
|
||||
index = ctx->count & (bsize - 1);
|
||||
|
@ -35,9 +34,7 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
|
|||
/* process one stored block */
|
||||
if (index) {
|
||||
memcpy(ctx->buf + index, data, bsize - index);
|
||||
ret = cpacf_kimd(ctx->func, ctx->state, ctx->buf, bsize);
|
||||
if (ret != bsize)
|
||||
return -EIO;
|
||||
cpacf_kimd(ctx->func, ctx->state, ctx->buf, bsize);
|
||||
data += bsize - index;
|
||||
len -= bsize - index;
|
||||
index = 0;
|
||||
|
@ -45,12 +42,10 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
|
|||
|
||||
/* process as many blocks as possible */
|
||||
if (len >= bsize) {
|
||||
ret = cpacf_kimd(ctx->func, ctx->state, data,
|
||||
len & ~(bsize - 1));
|
||||
if (ret != (len & ~(bsize - 1)))
|
||||
return -EIO;
|
||||
data += ret;
|
||||
len -= ret;
|
||||
n = len & ~(bsize - 1);
|
||||
cpacf_kimd(ctx->func, ctx->state, data, n);
|
||||
data += n;
|
||||
len -= n;
|
||||
}
|
||||
store:
|
||||
if (len)
|
||||
|
@ -66,7 +61,6 @@ int s390_sha_final(struct shash_desc *desc, u8 *out)
|
|||
unsigned int bsize = crypto_shash_blocksize(desc->tfm);
|
||||
u64 bits;
|
||||
unsigned int index, end, plen;
|
||||
int ret;
|
||||
|
||||
/* SHA-512 uses 128 bit padding length */
|
||||
plen = (bsize > SHA256_BLOCK_SIZE) ? 16 : 8;
|
||||
|
@ -88,10 +82,7 @@ int s390_sha_final(struct shash_desc *desc, u8 *out)
|
|||
*/
|
||||
bits = ctx->count * 8;
|
||||
memcpy(ctx->buf + end - 8, &bits, sizeof(bits));
|
||||
|
||||
ret = cpacf_kimd(ctx->func, ctx->state, ctx->buf, end);
|
||||
if (ret != end)
|
||||
return -EIO;
|
||||
cpacf_kimd(ctx->func, ctx->state, ctx->buf, end);
|
||||
|
||||
/* copy digest to out */
|
||||
memcpy(out, ctx->state, crypto_shash_digestsize(desc->tfm));
|
||||
|
|
|
@ -234,11 +234,9 @@ static inline int cpacf_kmc(unsigned long func, void *param,
|
|||
* @param: address of parameter block; see POP for details on each func
|
||||
* @src: address of source memory area
|
||||
* @src_len: length of src operand in bytes
|
||||
*
|
||||
* Returns 0 for the query func, number of processed bytes for digest funcs
|
||||
*/
|
||||
static inline int cpacf_kimd(unsigned long func, void *param,
|
||||
const u8 *src, long src_len)
|
||||
static inline void cpacf_kimd(unsigned long func, void *param,
|
||||
const u8 *src, long src_len)
|
||||
{
|
||||
register unsigned long r0 asm("0") = (unsigned long) func;
|
||||
register unsigned long r1 asm("1") = (unsigned long) param;
|
||||
|
@ -251,8 +249,6 @@ static inline int cpacf_kimd(unsigned long func, void *param,
|
|||
: [src] "+a" (r2), [len] "+d" (r3)
|
||||
: [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KIMD)
|
||||
: "cc", "memory");
|
||||
|
||||
return src_len - r3;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -261,11 +257,9 @@ static inline int cpacf_kimd(unsigned long func, void *param,
|
|||
* @param: address of parameter block; see POP for details on each func
|
||||
* @src: address of source memory area
|
||||
* @src_len: length of src operand in bytes
|
||||
*
|
||||
* Returns 0 for the query func, number of processed bytes for digest funcs
|
||||
*/
|
||||
static inline int cpacf_klmd(unsigned long func, void *param,
|
||||
const u8 *src, long src_len)
|
||||
static inline void cpacf_klmd(unsigned long func, void *param,
|
||||
const u8 *src, long src_len)
|
||||
{
|
||||
register unsigned long r0 asm("0") = (unsigned long) func;
|
||||
register unsigned long r1 asm("1") = (unsigned long) param;
|
||||
|
@ -278,8 +272,6 @@ static inline int cpacf_klmd(unsigned long func, void *param,
|
|||
: [src] "+a" (r2), [len] "+d" (r3)
|
||||
: [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_KLMD)
|
||||
: "cc", "memory");
|
||||
|
||||
return src_len - r3;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -352,13 +344,10 @@ static inline int cpacf_kmctr(unsigned long func, void *param, u8 *dest,
|
|||
* @dest_len: size of destination memory area in bytes
|
||||
* @seed: address of seed data
|
||||
* @seed_len: size of seed data in bytes
|
||||
*
|
||||
* Returns 0 for the query func, number of random bytes stored in
|
||||
* dest buffer for generate function
|
||||
*/
|
||||
static inline int cpacf_ppno(unsigned long func, void *param,
|
||||
u8 *dest, long dest_len,
|
||||
const u8 *seed, long seed_len)
|
||||
static inline void cpacf_ppno(unsigned long func, void *param,
|
||||
u8 *dest, long dest_len,
|
||||
const u8 *seed, long seed_len)
|
||||
{
|
||||
register unsigned long r0 asm("0") = (unsigned long) func;
|
||||
register unsigned long r1 asm("1") = (unsigned long) param;
|
||||
|
@ -374,8 +363,6 @@ static inline int cpacf_ppno(unsigned long func, void *param,
|
|||
: [fc] "d" (r0), [pba] "a" (r1),
|
||||
[seed] "a" (r4), [slen] "d" (r5), [opc] "i" (CPACF_PPNO)
|
||||
: "cc", "memory");
|
||||
|
||||
return dest_len - r3;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -383,10 +370,8 @@ static inline int cpacf_ppno(unsigned long func, void *param,
|
|||
* instruction
|
||||
* @func: the function code passed to PCC; see CPACF_KM_xxx defines
|
||||
* @param: address of parameter block; see POP for details on each func
|
||||
*
|
||||
* Returns 0.
|
||||
*/
|
||||
static inline int cpacf_pcc(unsigned long func, void *param)
|
||||
static inline void cpacf_pcc(unsigned long func, void *param)
|
||||
{
|
||||
register unsigned long r0 asm("0") = (unsigned long) func;
|
||||
register unsigned long r1 asm("1") = (unsigned long) param;
|
||||
|
@ -397,8 +382,6 @@ static inline int cpacf_pcc(unsigned long func, void *param)
|
|||
:
|
||||
: [fc] "d" (r0), [pba] "a" (r1), [opc] "i" (CPACF_PCC)
|
||||
: "cc", "memory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _ASM_S390_CPACF_H */
|
||||
|
|
Loading…
Reference in New Issue