libkcapi/002-libkcapi-1.3.0-s390-typ...

48 lines
1.7 KiB
Diff

From 00603fbe01de879eb1bd49a4475b0e619f4bb3b0 Mon Sep 17 00:00:00 2001
From: Ondrej Mosnacek <omosnace@redhat.com>
Date: Tue, 18 May 2021 15:03:17 +0200
Subject: [PATCH] Fix bad types in _kcapi_common_send_meta()
The types for 'type' and 'assoclen' variables need to match the kernel
ABI, so they can't be changed to size_t. On most arches it is by chance
still working, but on s390x usign size_t here makes almost all tests
fail. Change the variables back to uint32_t pointers to fix this.
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
lib/kcapi-kernel-if.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/kcapi-kernel-if.c b/lib/kcapi-kernel-if.c
index a92e2f7..4968a8a 100644
--- a/lib/kcapi-kernel-if.c
+++ b/lib/kcapi-kernel-if.c
@@ -125,7 +125,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle,
/* plaintext / ciphertext data */
struct cmsghdr *header = NULL;
- size_t *type = NULL;
+ uint32_t *type = NULL;
struct msghdr msg;
/* IV data */
@@ -135,7 +135,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle,
0;
/* AEAD data */
- size_t *assoclen = NULL;
+ uint32_t *assoclen = NULL;
size_t assoc_msg_size = handle->aead.assoclen ?
CMSG_SPACE(sizeof(*assoclen)) : 0;
@@ -205,7 +205,7 @@ ssize_t _kcapi_common_send_meta(struct kcapi_handle *handle,
header->cmsg_type = ALG_SET_AEAD_ASSOCLEN;
header->cmsg_len = CMSG_LEN(sizeof(*assoclen));
assoclen = (void*)CMSG_DATA(header);
- *assoclen = handle->aead.assoclen;
+ *assoclen = (uint32_t)handle->aead.assoclen;
}
ret = sendmsg(*_kcapi_get_opfd(handle), &msg, (int)flags);