﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
2379	Nginx compile error with OpenSSL 3 on Msys2 (mingw64) Windows	pavlusha23@…		"Nginx compile error with OpenSSL 3 on Msys2 (mingw64) Windows. With OpenSSL 1.1.1 compilation was successful.

Environment:

Windows 10
Msys2 (mingw64)
Nginx 1.23.1
OpenSSL 3.0.5 

Error:
        
{{{
-o objs/src/http/ngx_http_special_response.o \
        src/http/ngx_http_special_response.c
src/event/ngx_event_openssl.c: In function 'ngx_ssl_sendfile':
src/event/ngx_event_openssl.c:2972:52: error: passing argument 2 of 'SSL_sendfile' makes integer from pointer without a cast [-Werror=int-conversion]
 2972 |     n = SSL_sendfile(c->ssl->connection, file->file->fd, file->file_pos,
      |                                          ~~~~~~~~~~^~~~
      |                                                    |
      |                                                    ngx_fd_t {aka void *}
In file included from src/event/ngx_event_openssl.h:17,
                 from src/core/ngx_core.h:84,
                 from src/event/ngx_event_openssl.c:9:
openssl-3.0.5/.openssl/include/openssl/ssl.h:1970:46: note: expected 'int' but argument is of type 'ngx_fd_t' {aka 'void *'}
 1970 | __owur ossl_ssize_t SSL_sendfile(SSL *s, int fd, off_t offset, size_t size,
      |                                          ~~~~^~

}}}

With this fix, the compilation was successful. Change this code


{{{
    n = SSL_sendfile(c->ssl->connection, file->file->fd, file->file_pos,
}}}
to

{{{
    n = SSL_sendfile(c->ssl->connection, (int)(uintptr_t) file->file->fd, file->file_pos,
}}}

in file "".\nginx\src\event\ngx_event_openssl.c"""	defect	closed	major	nginx-1.23	nginx-core	1.23.x	fixed				"$ ./nginx-1.23.1-x86_64.exe -V
nginx version: nginx/1.23.1
built by gcc 12.1.0 (Rev3, Built by MSYS2 project)
built with OpenSSL 3.0.5 5 Jul 2022
TLS SNI support enabled
"
