[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libtelnet: Make encryption decls compatible with C23.
From: |
Simon Josefsson |
Subject: |
Re: libtelnet: Make encryption decls compatible with C23. |
Date: |
Fri, 10 May 2024 15:52:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Collin Funk <collin.funk1@gmail.com> writes:
> I've applied the attached patch to fix the following error building
> libtelnet. I think the only ones remaining are in telnet/*. Once I fix
> that maybe these are good for an existing CI job?
>
> $ ./configure CC="gcc-14.1" CFLAGS="-std=c23 -Wstrict-prototypes"
> --enable-authentication --enable-encryption --with-krb5
Ah, you answered my request from the earlier email already :-)
Looks good, and yes let's improve the compiler warning usage to catch
this. I added a new idiom in last libidn2 that make sense to backport,
then --enable-gcc-warnings=error should result in build failures (we
should make sure it enabled -Wstrict-prototypes). A C23 build would be
nice too, we alreayd build using latest gcc but not in C23 mode --
adding that would be simple.
/Simon
> encrypt.c:208:40: error: initialization of 'Encryptions * (*)(void)'
> from incompatible pointer type 'Encryptions * (*)(int)'
> [-Wincompatible-pointer-types]
> 208 | {{0}, 0, DIR_ENCRYPT, &encrypt_mode, findencryption},
> | ^~~~~~~~~~~~~~
> encrypt.c:208:40: note: (near initialization for 'ki[0].getcrypt')
> encrypt.c:209:40: error: initialization of 'Encryptions * (*)(void)'
> from incompatible pointer type 'Encryptions * (*)(int)'
> [-Wincompatible-pointer-types]
> 209 | {{0}, 0, DIR_DECRYPT, &decrypt_mode, finddecryption},
> | ^~~~~~~~~~~~~~
> encrypt.c:209:40: note: (near initialization for 'ki[1].getcrypt')
> encrypt.c: In function 'encrypt_keyid':
> encrypt.c:777:9: error: too many arguments to function 'kp->getcrypt'
> 777 | ep = (*kp->getcrypt) (*kp->modep);
> | ~^~~~~~~~~~~~~~
>
> Collin
>
> From 25816697e6c79ae0e009b4762d8f325dfad6e99e Mon Sep 17 00:00:00 2001
> From: Collin Funk <collin.funk1@gmail.com>
> Date: Thu, 9 May 2024 21:10:57 -0700
> Subject: [PATCH] libtelnet: Make encryption decls compatible with C23.
>
> * libtelnet/enc-proto.h (findencryption, finddecryption): Add
> prototypes.
> * libtelnet/encrypt.c (struct key_info): Add the parameter type.
> ---
> libtelnet/enc-proto.h | 2 ++
> libtelnet/encrypt.c | 2 +-
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libtelnet/enc-proto.h b/libtelnet/enc-proto.h
> index effdf828..2f8828a5 100644
> --- a/libtelnet/enc-proto.h
> +++ b/libtelnet/enc-proto.h
> @@ -66,6 +66,8 @@
> */
>
> #ifdef ENCRYPTION
> +Encryptions *findencryption (int);
> +Encryptions *finddecryption (int);
> int EncryptStart (char *);
> int EncryptStartInput (void);
> int EncryptStartOutput (void);
> diff --git a/libtelnet/encrypt.c b/libtelnet/encrypt.c
> index 876208b8..7c95e9c1 100644
> --- a/libtelnet/encrypt.c
> +++ b/libtelnet/encrypt.c
> @@ -203,7 +203,7 @@ static struct key_info
> int keylen;
> int dir;
> int *modep;
> - Encryptions *(*getcrypt) ();
> + Encryptions *(*getcrypt) (int);
> } ki[2] = {
> {{0}, 0, DIR_ENCRYPT, &encrypt_mode, findencryption},
> {{0}, 0, DIR_DECRYPT, &decrypt_mode, finddecryption},
signature.asc
Description: PGP signature