]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/crypto: Generalize parameters for key conversion
authorHolger Dengler <dengler@linux.ibm.com>
Fri, 25 Oct 2024 15:12:46 +0000 (17:12 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 29 Oct 2024 10:17:19 +0000 (11:17 +0100)
As a preparation for multiple key tokens in a key_blob structure, use
separate pointer and length parameters for __paes_keyblob2pkey()
instead a pointer to the struct key_blob.

The functionality of the paes module is not affected by this commit.

Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/crypto/paes_s390.c

index 7c860af8a679a58cf2563a98882ca3a28e657f41..3daaa6e60ba11d1c8ea1456605429094b540463c 100644 (file)
@@ -129,8 +129,8 @@ struct s390_pxts_ctx {
        unsigned long fc;
 };
 
-static inline int __paes_keyblob2pkey(struct key_blob *kb,
-                                    struct paes_protkey *pk)
+static inline int __paes_keyblob2pkey(const u8 *key, unsigned int keylen,
+                                     struct paes_protkey *pk)
 {
        int i, rc = -EIO;
 
@@ -140,8 +140,8 @@ static inline int __paes_keyblob2pkey(struct key_blob *kb,
                        if (msleep_interruptible(1000))
                                return -EINTR;
                }
-               rc = pkey_key2protkey(kb->key, kb->keylen,
-                                     pk->protkey, &pk->len, &pk->type);
+               rc = pkey_key2protkey(key, keylen, pk->protkey, &pk->len,
+                                     &pk->type);
        }
 
        return rc;
@@ -153,7 +153,7 @@ static inline int __paes_convert_key(struct s390_paes_ctx *ctx)
        int rc;
 
        pk.len = sizeof(pk.protkey);
-       rc = __paes_keyblob2pkey(&ctx->kb, &pk);
+       rc = __paes_keyblob2pkey(ctx->kb.key, ctx->kb.keylen, &pk);
        if (rc)
                return rc;
 
@@ -425,8 +425,8 @@ static inline int __xts_paes_convert_key(struct s390_pxts_ctx *ctx)
        pk0.len = sizeof(pk0.protkey);
        pk1.len = sizeof(pk1.protkey);
 
-       if (__paes_keyblob2pkey(&ctx->kb[0], &pk0) ||
-           __paes_keyblob2pkey(&ctx->kb[1], &pk1))
+       if (__paes_keyblob2pkey(ctx->kb[0].key, ctx->kb[0].keylen, &pk0) ||
+           __paes_keyblob2pkey(ctx->kb[1].key, ctx->kb[1].keylen, &pk1))
                return -EINVAL;
 
        spin_lock_bh(&ctx->pk_lock);