cryptography icon indicating copy to clipboard operation
cryptography copied to clipboard

Resurrect the PoC of OpenSSL from Rust

Open alex opened this issue 2 years ago • 3 comments

alex avatar Apr 30 '22 22:04 alex

Blocked on https://foss.heptapod.net/pypy/pypy/-/issues/3619

alex avatar May 11 '22 18:05 alex

This should be fixed in the next PyPy release. I'll rebase then and we can contemplate how we want to handle it.

alex avatar May 29 '22 20:05 alex

macOS wheel builds are failing due to https://github.com/rust-lang/rust/issues/55235

The PyPy wheel builds are failing because they aren't using PyPy nightly.

alex avatar May 30 '22 18:05 alex

Ok, assuming tests pass, this PR now requires:

  • rust 1.66 (December 15th -- incidentally several friends' of mines birthdays)
  • PyPy 3.8 and 3.9 releases

alex avatar Oct 06 '22 03:10 alex

Some of the jobs are failing because of https://github.com/actions/setup-python/issues/518

alex avatar Oct 09 '22 14:10 alex

Sorry for long post but it seems that cffi is producing better C code compared to Rust one. Compiling on i686-pc-windows-gnu/rust 1.66.0/Windows 7 x64 SP1 with latest KB5022338 installed/Python 3.7 x86 (because I backporting my builds for legacy systems). My compiler (MSYS2/Win32/MinGW) complains:

warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:575: warning: "WIN32_LEAN_AND_MEAN" redefined
warning:   575 | #define WIN32_LEAN_AND_MEAN
warning:       |
warning: <command-line>: note: this is the location of the previous definition
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function 'Cryptography_malloc_wrapper':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:956:60: warning: unused parameter 'path' [-Wunused-parameter]
warning:   956 | void *Cryptography_malloc_wrapper(size_t size, const char *path, int line) {
warning:       |                                                ~~~~~~~~~~~~^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:956:70: warning: unused parameter 'line' [-Wunused-parameter]
warning:   956 | void *Cryptography_malloc_wrapper(size_t size, const char *path, int line) {
warning:       |                                                                  ~~~~^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function 'Cryptography_realloc_wrapper':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:960:72: warning: unused parameter 'path' [-Wunused-parameter]
warning:   960 | void *Cryptography_realloc_wrapper(void *ptr, size_t size, const char *path,
warning:       |                                                            ~~~~~~~~~~~~^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:961:40: warning: unused parameter 'line' [-Wunused-parameter]
warning:   961 |                                    int line) {
warning:       |                                    ~~~~^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function 'Cryptography_free_wrapper':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:965:55: warning: unused parameter 'path' [-Wunused-parameter]
warning:   965 | void Cryptography_free_wrapper(void *ptr, const char *path, int line) {
warning:       |                                           ~~~~~~~~~~~~^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:965:65: warning: unused parameter 'line' [-Wunused-parameter]
warning:   965 | void Cryptography_free_wrapper(void *ptr, const char *path, int line) {
warning:       |                                                             ~~~~^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function 'Cryptography_pem_password_cb':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:2174:37: warning: conversion to 'size_t' {aka 'unsigned int'} from 'int' may change the sign of the result [-Wsign-conversion]
warning:  2174 |         memcpy(buf, st->password, st->length);
warning:       |                                   ~~^~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:2164:39: warning: unused parameter 'rwflag' [-Wunused-parameter]
warning:  2164 |                                   int rwflag, void *userdata) {
warning:       |                                   ~~~~^~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_ERR_put_error':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:16265:47: warning: unused parameter 'x1' [-Wunused-parameter]
warning: 16265 | static void _cffi_d_ERR_put_error(int x0, int x1, int x2, char const * x3, int x4)
warning:       |                                           ~~~~^~
warning: In file included from C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:822:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_add_extra_chain_cert':
warning: C:\Python37\include/openssl/ssl.h:1439:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  1439 |         SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509))
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26231:10: note: in expansion of macro 'SSL_CTX_add_extra_chain_cert'
warning: 26231 |   return SSL_CTX_add_extra_chain_cert(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_add_extra_chain_cert':
warning: C:\Python37\include/openssl/ssl.h:1439:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  1439 |         SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)(x509))
warning:       |         ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26269:14: note: in expansion of macro 'SSL_CTX_add_extra_chain_cert'
warning: 26269 |   { result = SSL_CTX_add_extra_chain_cert(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: In file included from C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:822:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_clear_mode':
warning: C:\Python37\include/openssl/ssl.h:626:48: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning:   626 |         SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL)
warning:       |                                                ^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26410:10: note: in expansion of macro 'SSL_CTX_clear_mode'
warning: 26410 |   return SSL_CTX_clear_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~
warning: C:\Python37\include/openssl/ssl.h:626:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   626 |         SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL)
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26410:10: note: in expansion of macro 'SSL_CTX_clear_mode'
warning: 26410 |   return SSL_CTX_clear_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_clear_mode':
warning: C:\Python37\include/openssl/ssl.h:626:48: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning:   626 |         SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL)
warning:       |                                                ^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26443:14: note: in expansion of macro 'SSL_CTX_clear_mode'
warning: 26443 |   { result = SSL_CTX_clear_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~~~
warning: C:\Python37\include/openssl/ssl.h:626:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   626 |         SSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL)
warning:       |         ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26443:14: note: in expansion of macro 'SSL_CTX_clear_mode'
warning: 26443 |   { result = SSL_CTX_clear_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_clear_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26458:10: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 26458 |   return SSL_CTX_clear_options(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_clear_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26491:14: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 26491 |   { result = SSL_CTX_clear_options(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~~~~~~
warning: In file included from C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:822:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_get_mode':
warning: C:\Python37\include/openssl/ssl.h:628:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   628 |         SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26818:10: note: in expansion of macro 'SSL_CTX_get_mode'
warning: 26818 |   return SSL_CTX_get_mode(x0);
warning:       |          ^~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_get_mode':
warning: C:\Python37\include/openssl/ssl.h:628:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   628 |         SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)
warning:       |         ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26841:14: note: in expansion of macro 'SSL_CTX_get_mode'
warning: 26841 |   { result = SSL_CTX_get_mode(x0); }
warning:       |              ^~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_get_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26856:10: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 26856 |   return SSL_CTX_get_options(x0);
warning:       |          ^~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_get_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26879:14: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 26879 |   { result = SSL_CTX_get_options(x0); }
warning:       |              ^~~~~~~~~~~~~~~~~~~
warning: In file included from C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:822:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_get_session_cache_mode':
warning: C:\Python37\include/openssl/ssl.h:2213:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  2213 |         SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26932:10: note: in expansion of macro 'SSL_CTX_get_session_cache_mode'
warning: 26932 |   return SSL_CTX_get_session_cache_mode(x0);
warning:       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_get_session_cache_mode':
warning: C:\Python37\include/openssl/ssl.h:2213:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  2213 |         SSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)
warning:       |         ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:26955:14: note: in expansion of macro 'SSL_CTX_get_session_cache_mode'
warning: 26955 |   { result = SSL_CTX_get_session_cache_mode(x0); }
warning:       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: In file included from C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:822:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_set_mode':
warning: C:\Python37\include/openssl/ssl.h:624:42: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning:   624 |         SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
warning:       |                                          ^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:28649:10: note: in expansion of macro 'SSL_CTX_set_mode'
warning: 28649 |   return SSL_CTX_set_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~
warning: C:\Python37\include/openssl/ssl.h:624:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   624 |         SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:28649:10: note: in expansion of macro 'SSL_CTX_set_mode'
warning: 28649 |   return SSL_CTX_set_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_set_mode':
warning: C:\Python37\include/openssl/ssl.h:624:42: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning:   624 |         SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
warning:       |                                          ^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:28682:14: note: in expansion of macro 'SSL_CTX_set_mode'
warning: 28682 |   { result = SSL_CTX_set_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~
warning: C:\Python37\include/openssl/ssl.h:624:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   624 |         SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)
warning:       |         ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:28682:14: note: in expansion of macro 'SSL_CTX_set_mode'
warning: 28682 |   { result = SSL_CTX_set_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_set_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:28794:10: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 28794 |   return SSL_CTX_set_options(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_set_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:28827:14: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 28827 |   { result = SSL_CTX_set_options(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~~~~
warning: In file included from C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:822:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_set_session_cache_mode':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:29120:45: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning: 29120 |   return SSL_CTX_set_session_cache_mode(x0, x1);
warning:       |                                             ^~
warning: C:\Python37\include/openssl/ssl.h:2211:55: note: in definition of macro 'SSL_CTX_set_session_cache_mode'
warning:  2211 |         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
warning:       |                                                       ^
warning: C:\Python37\include/openssl/ssl.h:2211:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  2211 |         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:29120:10: note: in expansion of macro 'SSL_CTX_set_session_cache_mode'
warning: 29120 |   return SSL_CTX_set_session_cache_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_set_session_cache_mode':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:29153:49: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning: 29153 |   { result = SSL_CTX_set_session_cache_mode(x0, x1); }
warning:       |                                                 ^~
warning: C:\Python37\include/openssl/ssl.h:2211:55: note: in definition of macro 'SSL_CTX_set_session_cache_mode'
warning:  2211 |         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
warning:       |                                                       ^
warning: C:\Python37\include/openssl/ssl.h:2211:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  2211 |         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)
warning:       |         ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:29153:14: note: in expansion of macro 'SSL_CTX_set_session_cache_mode'
warning: 29153 |   { result = SSL_CTX_set_session_cache_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_set_tmp_dh':
warning: C:\Python37\include/openssl/ssl.h:1422:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  1422 |         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh))
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:29526:10: note: in expansion of macro 'SSL_CTX_set_tmp_dh'
warning: 29526 |   return SSL_CTX_set_tmp_dh(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_set_tmp_dh':
warning: C:\Python37\include/openssl/ssl.h:1422:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  1422 |         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)(dh))
warning:       |         ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:29564:14: note: in expansion of macro 'SSL_CTX_set_tmp_dh'
warning: 29564 |   { result = SSL_CTX_set_tmp_dh(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_CTX_set_tmp_ecdh':
warning: C:\Python37\include/openssl/ssl.h:1434:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  1434 |         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh))
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:29579:10: note: in expansion of macro 'SSL_CTX_set_tmp_ecdh'
warning: 29579 |   return SSL_CTX_set_tmp_ecdh(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_CTX_set_tmp_ecdh':
warning: C:\Python37\include/openssl/ssl.h:1434:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:  1434 |         SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)(ecdh))
warning:       |         ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:29617:14: note: in expansion of macro 'SSL_CTX_set_tmp_ecdh'
warning: 29617 |   { result = SSL_CTX_set_tmp_ecdh(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_SESSION_get_ticket_lifetime_hint':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:30246:10: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning: 30246 |   return SSL_SESSION_get_ticket_lifetime_hint(x0);
warning:       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_SESSION_get_ticket_lifetime_hint':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:30269:14: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning: 30269 |   { result = SSL_SESSION_get_ticket_lifetime_hint(x0); }
warning:       |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: In file included from C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:822:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_clear_mode':
warning: C:\Python37\include/openssl/ssl.h:630:44: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning:   630 |         SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL)
warning:       |                                            ^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:30617:10: note: in expansion of macro 'SSL_clear_mode'
warning: 30617 |   return SSL_clear_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~~~
warning: C:\Python37\include/openssl/ssl.h:630:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   630 |         SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL)
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:30617:10: note: in expansion of macro 'SSL_clear_mode'
warning: 30617 |   return SSL_clear_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_clear_mode':
warning: C:\Python37\include/openssl/ssl.h:630:44: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning:   630 |         SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL)
warning:       |                                            ^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:30650:14: note: in expansion of macro 'SSL_clear_mode'
warning: 30650 |   { result = SSL_clear_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~
warning: C:\Python37\include/openssl/ssl.h:630:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   630 |         SSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL)
warning:       |         ^~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:30650:14: note: in expansion of macro 'SSL_clear_mode'
warning: 30650 |   { result = SSL_clear_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_get_mode':
warning: C:\Python37\include/openssl/ssl.h:634:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   634 |         SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:31560:10: note: in expansion of macro 'SSL_get_mode'
warning: 31560 |   return SSL_get_mode(x0);
warning:       |          ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_get_mode':
warning: C:\Python37\include/openssl/ssl.h:634:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   634 |         SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)
warning:       |         ^~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:31583:14: note: in expansion of macro 'SSL_get_mode'
warning: 31583 |   { result = SSL_get_mode(x0); }
warning:       |              ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_get_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:31598:10: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 31598 |   return SSL_get_options(x0);
warning:       |          ^~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_get_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:31621:14: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 31621 |   { result = SSL_get_options(x0); }
warning:       |              ^~~~~~~~~~~~~~~
warning: In file included from C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:822:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_set_mode':
warning: C:\Python37\include/openssl/ssl.h:632:38: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning:   632 |         SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
warning:       |                                      ^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:33200:10: note: in expansion of macro 'SSL_set_mode'
warning: 33200 |   return SSL_set_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~
warning: C:\Python37\include/openssl/ssl.h:632:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   632 |         SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
warning:       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:33200:10: note: in expansion of macro 'SSL_set_mode'
warning: 33200 |   return SSL_set_mode(x0, x1);
warning:       |          ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_set_mode':
warning: C:\Python37\include/openssl/ssl.h:632:38: warning: conversion to 'long int' from 'long unsigned int' may change the sign of the result [-Wsign-conversion]
warning:   632 |         SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
warning:       |                                      ^~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:33233:14: note: in expansion of macro 'SSL_set_mode'
warning: 33233 |   { result = SSL_set_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~
warning: C:\Python37\include/openssl/ssl.h:632:9: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
warning:   632 |         SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
warning:       |         ^~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:33233:14: note: in expansion of macro 'SSL_set_mode'
warning: 33233 |   { result = SSL_set_mode(x0, x1); }
warning:       |              ^~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_d_SSL_set_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:33296:10: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 33296 |   return SSL_set_options(x0, x1);
warning:       |          ^~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: In function '_cffi_f_SSL_set_options':
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:33329:14: warning: conversion from 'uint64_t' {aka 'long long unsigned int'} to 'long unsigned int' may change value [-Wconversion]
warning: 33329 |   { result = SSL_set_options(x0, x1); }
warning:       |              ^~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: At top level:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:784:13: warning: 'ERR_load_Cryptography_OSRandom_strings' declared 'static' but never defined [-Wunused-function]
warning:   784 | static void ERR_load_Cryptography_OSRandom_strings(void);
warning:       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:785:13: warning: 'ERR_Cryptography_OSRandom_error' declared 'static' but never defined [-Wunused-function]
warning:   785 | static void ERR_Cryptography_OSRandom_error(int function, int reason,
warning:       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Static build against latest OSSL 3.2 dev works fine, dynamic build fails.

Tarnum-tst avatar Jan 20 '23 14:01 Tarnum-tst

All these warnings are coming from cffi already -- none of them are new warnings from this branch.

alex avatar Jan 20 '23 15:01 alex

@alex When compiling cffi build I got only two warnings, similar to these:

warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c: At top level:
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:784:13: warning: 'ERR_load_Cryptography_OSRandom_strings' declared 'static' but never defined [-Wunused-function]
warning:   784 | static void ERR_load_Cryptography_OSRandom_strings(void);
warning:       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: C:\Python37\crypmain\src\rust\target\i686-pc-windows-gnu\release\build\cryptography-rust-74aa9bb878ed6b19\out\_openssl.c:785:13: warning: 'ERR_Cryptography_OSRandom_error' declared 'static' but never defined [-Wunused-function]
warning:   785 | static void ERR_Cryptography_OSRandom_error(int function, int reason,
warning:       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tarnum-tst avatar Jan 21 '23 06:01 Tarnum-tst

If you believe you have an actual issue please file it in a new issue and describe how to reproduce it. The statements in this PR not only don’t belong here but also appear to be inaccurate. For example, we test against a dynamically linked openssl 3.2b1 in our CI right now and the warnings you’re seeing come directly from cffi generated source (the directory structure, which may have led you to believe it was rust, is not relevant).

Compiling this project (especially with custom openssl) requires a significant amount of knowledge about platform linking behavior, symbol namespaces, etc and we cannot support or help users with every possible configuration.

reaperhulk avatar Jan 21 '23 07:01 reaperhulk

@reaperhulk No, I don't have an actual issue, I just wanted to give a feedback on this PR according to my experience. :-) And You are right, I was not fully correct about dynamically linked build. The compilation process completed successfully but it doesn't work for some reason with libcrypto-3.dll/libssl-3.dll loaded by Python's _ssl.pyd because of missing functions ("ImportError: DLL load failed: The specified procedure could not be found."). Dependency walker on (dynamically linked) _rust.pyd shows the absence of some calls related to OpenSSL 3.2 dev. But because static build works just fine on my system, I don't really want to dig into what's wrong with dynamically linked build. @alex Thank You for this PR!

Tarnum-tst avatar Jan 21 '23 08:01 Tarnum-tst

New challenge... the act of making boringssl work means that we now require libclang to always be available, even if boring isn't in use.

This seems unfortunate, I can't quite tell if it's a dealbreaker or not. Triangulating all the things we want is getting increasingly difficult :-/ @reaperhulk thoughts appreciated

alex avatar Mar 10 '23 16:03 alex

ok nevermind, solved that problem.

alex avatar Mar 10 '23 16:03 alex