Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: initializer overrides prior initialization of this subobject #448

Closed
yurivict opened this issue May 21, 2021 · 8 comments
Closed

Comments

@yurivict
Copy link
Contributor

clang fails to build 4.4:

/usr/ports/net/libreswan/work/libreswan-4.4/lib/libswan/ike_alg_aes.c:61:26: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
        .encrypt_sadb_ealg_id = SADB_X_EALG_AES,
                                ^~~~~~~~~~~~~~~
@yurivict
Copy link
Contributor Author

There's double initialization of the same field when both preprocessor variables are defined:

#ifdef SADB_X_EALG_AESCBC
        .encrypt_sadb_ealg_id = SADB_X_EALG_AESCBC,
#endif
#ifdef SADB_X_EALG_AES
        .encrypt_sadb_ealg_id = SADB_X_EALG_AES,
#endif

@cagney
Copy link
Collaborator

cagney commented May 21, 2021

What does the FreeBSD header define?

@yurivict
Copy link
Contributor Author

yurivict commented May 21, 2021

$ grep -r SADB_X_EALG_AESCBC /usr/include/
/usr/include/net/pfkeyv2.h:#define	SADB_X_EALG_AESCBC	12

$ grep -r SADB_X_EALG_AES /usr/include/
/usr/include/net/pfkeyv2.h:#define SADB_X_EALG_AES		12
/usr/include/net/pfkeyv2.h:#define	SADB_X_EALG_AESCBC	12
/usr/include/net/pfkeyv2.h:#define SADB_X_EALG_AESCTR	13
/usr/include/net/pfkeyv2.h:#define SADB_X_EALG_AESGCM8	18	/* RFC4106 */
/usr/include/net/pfkeyv2.h:#define SADB_X_EALG_AESGCM12	19
/usr/include/net/pfkeyv2.h:#define SADB_X_EALG_AESGCM16	20
/usr/include/net/pfkeyv2.h:#define SADB_X_EALG_AESGMAC	23	/* RFC4543 + Errata1821 */
/usr/include/netipsec/keydb.h:			((_sav)->alg_enc == SADB_X_EALG_AESGCM8 ||	\
/usr/include/netipsec/keydb.h:			(_sav)->alg_enc == SADB_X_EALG_AESGCM12 ||	\
/usr/include/netipsec/keydb.h:			(_sav)->alg_enc == SADB_X_EALG_AESGCM16)
/usr/include/netipsec/keydb.h:#define	SAV_ISCTR(_sav) ((_sav)->alg_enc == SADB_X_EALG_AESCTR)

@yurivict
Copy link
Contributor Author

@cagney
Copy link
Collaborator

cagney commented May 21, 2021

/usr/include/net/pfkeyv2.h:#define SADB_X_EALG_AES 12
/usr/include/net/pfkeyv2.h:#define SADB_X_EALG_AESCBC 12

dumb

@yurivict
Copy link
Contributor Author

Should all these values be different?

#define SADB_X_EALG_RIJNDAELCBC	12
#define SADB_X_EALG_AES		12
#define	SADB_X_EALG_AESCBC	12

@cagney
Copy link
Collaborator

cagney commented May 21, 2021

No. They're referring to the same algorithm.

@cagney
Copy link
Collaborator

cagney commented May 21, 2021

For reference, it was only recently added (2020):
https://cgit.freebsd.org/src/commit/sys/net/pfkeyv2.h?id=00a4311adc197c3518f5d60c69e00c4e80d065fd

Refer to AES-CBC as "aes-cbc" rather than "rijndael-cbc" for IPsec.
At this point, AES is the more common name for Rijndael128. setkey(8)
will still accept the old name, and old constants remain for
compatiblity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants