diff mbox series

[firmware-utils,4/4] pc1crypt: make decrypt/encrypt functions take void * as argument

Message ID 20240223061839.21956-4-zajec5@gmail.com
State Accepted
Delegated to: Rafał Miłecki
Headers show
Series [firmware-utils,1/4] srec2bin: drop unused "dum" variable | expand

Commit Message

Rafał Miłecki Feb. 23, 2024, 6:18 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

Make them more generic regarding accepted data buffers.

This fixes:

src/pc1crypt.c: In function ‘main’:
src/pc1crypt.c:322:26: warning: pointer targets in passing argument 2 of ‘pc1_decrypt_buf’ differ in signedness [-Wpointer-sign]
    pc1_decrypt_buf(&pc1, buf, datalen);
                          ^~~
src/pc1crypt.c:324:26: warning: pointer targets in passing argument 2 of ‘pc1_encrypt_buf’ differ in signedness [-Wpointer-sign]
    pc1_encrypt_buf(&pc1, buf, datalen);
                          ^~~

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 src/pc1crypt.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/src/pc1crypt.c b/src/pc1crypt.c
index be1038b..458c234 100644
--- a/src/pc1crypt.c
+++ b/src/pc1crypt.c
@@ -167,18 +167,18 @@  static void pc1_init(struct pc1_ctx *pc1)
 	strcpy(pc1->cle, "Remsaalps!123456");
 }
 
-static void pc1_decrypt_buf(struct pc1_ctx *pc1, unsigned char *buf,
-			    unsigned len)
+static void pc1_decrypt_buf(struct pc1_ctx *pc1, void *data, unsigned len)
 {
+	unsigned char *buf = data;
 	unsigned i;
 
 	for (i = 0; i < len; i++)
 		buf[i] = pc1_decrypt(pc1, buf[i]);
 }
 
-static void pc1_encrypt_buf(struct pc1_ctx *pc1, unsigned char *buf,
-			    unsigned len)
+static void pc1_encrypt_buf(struct pc1_ctx *pc1, void *data, unsigned len)
 {
+	unsigned char *buf = data;
 	unsigned i;
 
 	for (i = 0; i < len; i++)