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

Building 3.9.0 on windows, with cmake+visual studio #1017

Open
d3x0r opened this issue Mar 12, 2024 · 1 comment
Open

Building 3.9.0 on windows, with cmake+visual studio #1017

d3x0r opened this issue Mar 12, 2024 · 1 comment

Comments

@d3x0r
Copy link
Contributor

d3x0r commented Mar 12, 2024

There are some basic warnings that maybe can be fixed...

Visual studio issues a warning about libressl\3.9.0\crypto\empty.c(1,1): warning C4206: nonstandard extension used: translation unit is empty. There are 3 files in 5 targets called 'empty.c' which are compiled, in crypto, tls, and ssl for compat.obj tls_compat.obj, crypto, ssl, and tls targets.

(Github doesn't have this code? even under tag 3.9.0?) crypto/pkcs7/pk7_doit.c line 657 has 'unreachable code' which is the final 'return NULL' after the forever loop for(;;).

static BIO *
PKCS7_find_digest(EVP_MD_CTX **pmd, BIO *bio, int nid)
{
	for (;;) {
		bio = BIO_find_type(bio, BIO_TYPE_MD);
		if (bio == NULL) {
			PKCS7error(PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST);
			return NULL;
		}
		BIO_get_md_ctx(bio, pmd);
		if (*pmd == NULL) {
			PKCS7error(ERR_R_INTERNAL_ERROR);
			return NULL;
		}
		if (EVP_MD_CTX_type(*pmd) == nid)
			return bio;
		bio = BIO_next(bio);
	}
	return NULL;
}

There are other 'unreachable code' warnings, but they are actually reachable if the object is invalid and contains an enum value that's not actually part of the enum. So some of these warnings are compiler false positives. Issue filed to MS Any switch without default:, that even covers all values defined in an enum that is the switch condition should actually be the warning, because there are various ways to get values into enum variables that can be not one of the choices in the enum. Actually there's an assert(0) that makes it unreachable in debug build.

mostly libressl does compile cleanly.

#1004 I think should still be implemented - don't generate uninstall if LIBRESSL_SKIP_INSTALL is enabled in CMake.

@botovq
Copy link
Contributor

botovq commented Mar 18, 2024

Visual studio issues a warning about libressl\3.9.0\crypto\empty.c(1,1): warning C4206: nonstandard extension used: translation unit is empty. There are 3 files in 5 targets called 'empty.c' which are compiled, in crypto, tls, and ssl for compat.obj tls_compat.obj, crypto, ssl, and tls targets.

This is a weird hack that is apparently still needed for xcode. I don't know cmake well enough to figure out how to do this properly. See #996

The PKCS#7 code is here: https://github.com/libressl/openbsd/blob/master/src/lib/libcrypto/pkcs7/pk7_doit.c#L640
I need to think about this a bit. I would not be surprised if removing the offending line resulted in whining by another compiler with bad warnings (looking at you gcc)...

I have made a triage of most of the windows warnings a few months back #966 (comment)
I might fix one or the other remaining issues, but this is mostly just busywork with no clear benefit.

I'm not entirely sure I understand what #1004 accomplishes, but I think we would be happy to take a PR.

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