From: Tomohiro Kusumi Date: Mon, 2 Sep 2019 23:00:07 +0000 (+0900) Subject: lib/libdmsg: Fix compile warnings on Linux distros X-Git-Tag: v5.8.0rc1~1043 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/5b601f051ed2d561218d138fe76bebe7f7c538e6 lib/libdmsg: Fix compile warnings on Linux distros -- crypto.c: In function 'dmsg_crypto_negotiate': crypto.c:552: warning: pointer targets in passing argument 2 of 'RSA_private_encrypt' differ in signedness /usr/include/openssl/rsa.h:305: note: expected 'const unsigned char *' but argument is of type 'char *' crypto.c:552: warning: pointer targets in passing argument 3 of 'RSA_private_encrypt' differ in signedness /usr/include/openssl/rsa.h:305: note: expected 'unsigned char *' but argument is of type 'char *' --- diff --git a/lib/libdmsg/crypto.c b/lib/libdmsg/crypto.c index 2978861aac..e009486e6a 100644 --- a/lib/libdmsg/crypto.c +++ b/lib/libdmsg/crypto.c @@ -543,14 +543,18 @@ urandfail: */ do { ++*(int *)(ptr + 4); - if (RSA_private_encrypt(blksize, ptr, buf1, + if (RSA_private_encrypt(blksize, + (unsigned char*)ptr, + (unsigned char*)buf1, keys[2], RSA_NO_PADDING) < 0) { iocom->ioq_rx.error = DMSG_IOQ_ERROR_KEYXCHGFAIL; } } while (buf1[0] & 0xC0); - if (RSA_public_encrypt(blksize, buf1, buf2, + if (RSA_public_encrypt(blksize, + (unsigned char*)buf1, + (unsigned char*)buf2, keys[0], RSA_NO_PADDING) < 0) { iocom->ioq_rx.error = DMSG_IOQ_ERROR_KEYXCHGFAIL; @@ -580,11 +584,15 @@ urandfail: ptr -= (i & blkmask); i += n; if (keys[0] && (i & blkmask) == 0) { - if (RSA_private_decrypt(blksize, ptr, buf1, + if (RSA_private_decrypt(blksize, + (unsigned char*)ptr, + (unsigned char*)buf1, keys[2], RSA_NO_PADDING) < 0) iocom->ioq_rx.error = DMSG_IOQ_ERROR_KEYXCHGFAIL; - if (RSA_public_decrypt(blksize, buf1, ptr, + if (RSA_public_decrypt(blksize, + (unsigned char*)buf1, + (unsigned char*)ptr, keys[0], RSA_NO_PADDING) < 0) iocom->ioq_rx.error = DMSG_IOQ_ERROR_KEYXCHGFAIL;