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

bctoolbox-5.1.58 and mbedtls-3.2.1 compile failure #19

Open
stumbles opened this issue Sep 11, 2022 · 6 comments
Open

bctoolbox-5.1.58 and mbedtls-3.2.1 compile failure #19

stumbles opened this issue Sep 11, 2022 · 6 comments

Comments

@stumbles
Copy link

Trying to compile 5.1.58 using mbedtls-3.2.1. Cmake is configured as;

BcUnit_DIR /usr/share/BCunit/cmake CMAKE_BUILD_TYPE RELEASE CMAKE_INSTALL_PREFIX /usr Decaf_DIR /usr/share/decaf/cmake ENABLE_DECAF ON ENABLE_MBEDTLS ON ENABLE_PACKAGE_SOURCE OFF ENABLE_POLARSSL ON ENABLE_SHARED ON ENABLE_STATIC ON ENABLE_STRICT OFF ENABLE_TESTS ON ENABLE_TESTS_COMPONENT ON MBEDCRYPTO_LIBRARY /usr/lib/libmbedcrypto.so MBEDTLS_LIBRARY /usr/lib/libmbedtls.so MBEDX509_LIBRARY /usr/lib/libmbedx509.so SYSCONF_INSTALL_DIR /etc

and fails with these errors;

Consolidate compiler generated dependencies of target bctoolbox-static [ 1%] Building C object src/CMakeFiles/bctoolbox-static.dir/crypto/mbedtls.c.o /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_signing_key_parse' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:135:13: error: too few arguments to function 'mbedtls_pk_parse_key' 135 | err=mbedtls_pk_parse_key((mbedtls_pk_context *)key, (const unsigned char *)buffer, buffer_length, password, password_length); | ^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/mbedtls/ssl_ciphersuites.h:28, from /usr/include/mbedtls/ssl.h:32, from /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:27: /usr/include/mbedtls/pk.h:793:5: note: declared here 793 | int mbedtls_pk_parse_key( mbedtls_pk_context *ctx, | ^~~~~~~~~~~~~~~~~~~~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_signing_key_parse_file' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:149:13: error: too few arguments to function 'mbedtls_pk_parse_keyfile' 149 | err=mbedtls_pk_parse_keyfile((mbedtls_pk_context *)key, path, password); | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/mbedtls/pk.h:847:5: note: declared here 847 | int mbedtls_pk_parse_keyfile( mbedtls_pk_context *ctx, | ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_x509_certificate_get_subjects' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:236:33: error: 'mbedtls_x509_crt' has no member named 'ext_types' 236 | if( mbedtls_cert->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME ) { | ^~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_x509_certificate_get_signature_hash_function' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:366:22: error: 'mbedtls_x509_crt' has no member named 'sig_md'; did you mean 'sig_oid'? 366 | switch (crt->sig_md) { | ^~~~~~ | sig_oid /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_x509_certificate_get_fingerprint' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:427:40: error: 'mbedtls_x509_crt' has no member named 'sig_md'; did you mean 'sig_oid'? 427 | hash_id = crt->sig_md; | ^~~~~~ | sig_oid /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_CreateDHMContext' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:718:73: error: 'mbedtls_dhm_context' has no member named 'P' 718 | if ((mbedtls_mpi_read_string(&(mbedtlsDhmContext->P), 16, MBEDTLS_DHM_RFC3526_MODP_2048_P) != 0) || | ^~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:718:83: error: 'MBEDTLS_DHM_RFC3526_MODP_2048_P' undeclared (first use in this function); did you mean 'MBEDTLS_DHM_RFC3526_MODP_2048_P_BIN'? 718 | if ((mbedtls_mpi_read_string(&(mbedtlsDhmContext->P), 16, MBEDTLS_DHM_RFC3526_MODP_2048_P) != 0) || | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | MBEDTLS_DHM_RFC3526_MODP_2048_P_BIN /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:718:83: note: each undeclared identifier is reported only once for each function it appears in /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:719:69: error: 'mbedtls_dhm_context' has no member named 'G' 719 | (mbedtls_mpi_read_string(&(mbedtlsDhmContext->G), 16, MBEDTLS_DHM_RFC3526_MODP_2048_G) != 0)) { | ^~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:719:79: error: 'MBEDTLS_DHM_RFC3526_MODP_2048_G' undeclared (first use in this function); did you mean 'MBEDTLS_DHM_RFC3526_MODP_2048_G_BIN'? 719 | (mbedtls_mpi_read_string(&(mbedtlsDhmContext->G), 16, MBEDTLS_DHM_RFC3526_MODP_2048_G) != 0)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | MBEDTLS_DHM_RFC3526_MODP_2048_G_BIN /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:723:42: error: 'mbedtls_dhm_context' has no member named 'len' 723 | mbedtlsDhmContext->len=256; | ^~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:727:73: error: 'mbedtls_dhm_context' has no member named 'P' 727 | if ((mbedtls_mpi_read_string(&(mbedtlsDhmContext->P), 16, MBEDTLS_DHM_RFC3526_MODP_3072_P) != 0) || | ^~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:727:83: error: 'MBEDTLS_DHM_RFC3526_MODP_3072_P' undeclared (first use in this function); did you mean 'MBEDTLS_DHM_RFC3526_MODP_3072_P_BIN'? 727 | if ((mbedtls_mpi_read_string(&(mbedtlsDhmContext->P), 16, MBEDTLS_DHM_RFC3526_MODP_3072_P) != 0) || | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | MBEDTLS_DHM_RFC3526_MODP_3072_P_BIN /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:728:69: error: 'mbedtls_dhm_context' has no member named 'G' 728 | (mbedtls_mpi_read_string(&(mbedtlsDhmContext->G), 16, MBEDTLS_DHM_RFC3526_MODP_3072_G) != 0)) { | ^~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:728:79: error: 'MBEDTLS_DHM_RFC3526_MODP_3072_G' undeclared (first use in this function); did you mean 'MBEDTLS_DHM_RFC3526_MODP_3072_G_BIN'? 728 | (mbedtls_mpi_read_string(&(mbedtlsDhmContext->G), 16, MBEDTLS_DHM_RFC3526_MODP_3072_G) != 0)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | MBEDTLS_DHM_RFC3526_MODP_3072_G_BIN /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:732:42: error: 'mbedtls_dhm_context' has no member named 'len' 732 | mbedtlsDhmContext->len=384; | ^~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_ssl_handshake' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:887:32: error: 'mbedtls_ssl_context' has no member named 'state' 887 | while( ssl_ctx->ssl_ctx.state != MBEDTLS_SSL_HANDSHAKE_OVER ) | ^ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:898:45: error: 'mbedtls_ssl_context' has no member named 'state' 898 | if (ssl_ctx->ssl_ctx.state == MBEDTLS_SSL_CLIENT_CERTIFICATE && ssl_ctx->ssl_ctx.client_auth > 0) { | ^ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:898:105: error: 'mbedtls_ssl_context' has no member named 'client_auth' 898 | if (ssl_ctx->ssl_ctx.state == MBEDTLS_SSL_CLIENT_CERTIFICATE && ssl_ctx->ssl_ctx.client_auth > 0) { | ^ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:902:142: error: 'mbedtls_ssl_context' has no member named 'session_negotiate'; did you mean 'private_session_negotiate'? 902 | bctbx_list_t *names = bctbx_x509_certificate_get_subjects((const bctbx_x509_certificate_t *)ssl_ctx->ssl_ctx.session_negotiate->peer_cert); | ^~~~~~~~~~~~~~~~~ | private_session_negotiate /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_ssl_set_hs_own_cert' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:927:29: error: 'mbedtls_ssl_context' has no member named 'conf' 927 | if (ssl_ctx->ssl_ctx.conf->endpoint == MBEDTLS_SSL_IS_SERVER ) { | ^ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:930:88: error: 'mbedtls_ssl_context' has no member named 'conf' 930 | return mbedtls_ssl_conf_own_cert((mbedtls_ssl_config *)ssl_ctx->ssl_ctx.conf , (mbedtls_x509_crt *)cert , (mbedtls_pk_context *)key); | ^ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_aes_gcm_context_new' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:1742:15: error: too many arguments to function 'mbedtls_gcm_starts' 1742 | ret = mbedtls_gcm_starts(ctx, mbedtls_mode, initializationVector, initializationVectorLength, authenticatedData, authenticatedDataLength); | ^~~~~~~~~~~~~~~~~~ In file included from /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:40: /usr/include/mbedtls/gcm.h:234:5: note: declared here 234 | int mbedtls_gcm_starts( mbedtls_gcm_context *ctx, | ^~~~~~~~~~~~~~~~~~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_aes_gcm_process_chunk' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:1764:67: warning: passing argument 2 of 'mbedtls_gcm_update' makes pointer from integer without a cast [-Wint-conversion] 1764 | return mbedtls_gcm_update((mbedtls_gcm_context *)context, inputLength, input, output); | ^~~~~~~~~~~ | | | size_t {aka long unsigned int} /usr/include/mbedtls/gcm.h:315:46: note: expected 'const unsigned char *' but argument is of type 'size_t' {aka 'long unsigned int'} 315 | const unsigned char *input, size_t input_length, | ~~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:1764:80: warning: passing argument 3 of 'mbedtls_gcm_update' makes integer from pointer without a cast [-Wint-conversion] 1764 | return mbedtls_gcm_update((mbedtls_gcm_context *)context, inputLength, input, output); | ^~~~~ | | | const uint8_t * {aka const unsigned char *} /usr/include/mbedtls/gcm.h:315:60: note: expected 'size_t' {aka 'long unsigned int'} but argument is of type 'const uint8_t *' {aka 'const unsigned char *'} 315 | const unsigned char *input, size_t input_length, | ~~~~~~~^~~~~~~~~~~~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:1764:16: error: too few arguments to function 'mbedtls_gcm_update' 1764 | return mbedtls_gcm_update((mbedtls_gcm_context *)context, inputLength, input, output); | ^~~~~~~~~~~~~~~~~~ /usr/include/mbedtls/gcm.h:314:5: note: declared here 314 | int mbedtls_gcm_update( mbedtls_gcm_context *ctx, | ^~~~~~~~~~~~~~~~~~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_aes_gcm_finish' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:1780:15: error: too few arguments to function 'mbedtls_gcm_finish' 1780 | ret = mbedtls_gcm_finish((mbedtls_gcm_context *)context, tag, tagLength); | ^~~~~~~~~~~~~~~~~~ /usr/include/mbedtls/gcm.h:352:5: note: declared here 352 | int mbedtls_gcm_finish( mbedtls_gcm_context *ctx, | ^~~~~~~~~~~~~~~~~~ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_ssl_set_hs_own_cert' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:932:1: warning: control reaches end of non-void function [-Wreturn-type] 932 | } | ^ /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c: In function 'bctbx_aes_gcm_process_chunk' /usr/src/bctoolbox-5.1.58/src/crypto/mbedtls.c:1765:1: warning: control reaches end of non-void function [-Wreturn-type] 1765 | } | ^ make[2]: *** [src/CMakeFiles/bctoolbox-static.dir/build.make:202: src/CMakeFiles/bctoolbox-static.dir/crypto/mbedtls.c.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:140: src/CMakeFiles/bctoolbox-static.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

Any suggestions?

I would file this at https://gitlab.linphone.org/users/sign_in?redirect_to_referer=yes but don't see where I can create an account.

@brechtsanders
Copy link

brechtsanders commented Sep 23, 2022

When I try to compile bctoolbox 5.1.61 against mbedtls 3.2.1 I get this:

FAILED: src/CMakeFiles/bctoolbox-static.dir/crypto/mbedtls.c.obj 
D:\Prog\winlibs64-11.3.0msvcrt\mingw64\bin\gcc.exe -DHAVE_CONFIG_H -IR:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/include -IR:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src -IR:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/build_win -DBCTBX_EXPORTS -O3 -DNDEBUG  -Wall -Wuninitialized -Wno-error=pragmas -MD -MT src/CMakeFiles/bctoolbox-static.dir/crypto/mbedtls.c.obj -MF src\CMakeFiles\bctoolbox-static.dir\crypto\mbedtls.c.obj.d -o src/CMakeFiles/bctoolbox-static.dir/crypto/mbedtls.c.obj -c R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_signing_key_parse':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:135:13: error: too few arguments to function 'mbedtls_pk_parse_key'
  135 |         err=mbedtls_pk_parse_key((mbedtls_pk_context *)key, (const unsigned char *)buffer, buffer_length, password, password_length);
      |             ^~~~~~~~~~~~~~~~~~~~
In file included from D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/ssl_ciphersuites.h:28,
                 from D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/ssl.h:32,
                 from R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:27:
D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/pk.h:793:5: note: declared here
  793 | int mbedtls_pk_parse_key( mbedtls_pk_context *ctx,
      |     ^~~~~~~~~~~~~~~~~~~~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_signing_key_parse_file':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:149:13: error: too few arguments to function 'mbedtls_pk_parse_keyfile'
  149 |         err=mbedtls_pk_parse_keyfile((mbedtls_pk_context *)key, path, password);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/ssl_ciphersuites.h:28,
                 from D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/ssl.h:32,
                 from R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:27:
D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/pk.h:847:5: note: declared here
  847 | int mbedtls_pk_parse_keyfile( mbedtls_pk_context *ctx,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_x509_certificate_get_subjects':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:236:33: error: 'mbedtls_x509_crt' has no member named 'ext_types'
  236 |                 if( mbedtls_cert->ext_types & MBEDTLS_X509_EXT_SUBJECT_ALT_NAME ) {
      |                                 ^~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_x509_certificate_get_signature_hash_function':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:366:22: error: 'mbedtls_x509_crt' has no member named 'sig_md'; did you mean 'sig_oid'?
  366 |         switch (crt->sig_md) {
      |                      ^~~~~~
      |                      sig_oid
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_x509_certificate_get_fingerprint':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:427:40: error: 'mbedtls_x509_crt' has no member named 'sig_md'; did you mean 'sig_oid'?
  427 |                         hash_id = crt->sig_md;
      |                                        ^~~~~~
      |                                        sig_oid
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_CreateDHMContext':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:718:73: error: 'mbedtls_dhm_context' has no member named 'P'
  718 |                         if ((mbedtls_mpi_read_string(&(mbedtlsDhmContext->P), 16, MBEDTLS_DHM_RFC3526_MODP_2048_P) != 0) ||
      |                                                                         ^~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:718:83: error: 'MBEDTLS_DHM_RFC3526_MODP_2048_P' undeclared (first use in this function); did you mean 'MBEDTLS_DHM_RFC3526_MODP_2048_P_BIN'?
  718 |                         if ((mbedtls_mpi_read_string(&(mbedtlsDhmContext->P), 16, MBEDTLS_DHM_RFC3526_MODP_2048_P) != 0) ||
      |                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                   MBEDTLS_DHM_RFC3526_MODP_2048_P_BIN
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:718:83: note: each undeclared identifier is reported only once for each function it appears in
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:719:69: error: 'mbedtls_dhm_context' has no member named 'G'
  719 |                         (mbedtls_mpi_read_string(&(mbedtlsDhmContext->G), 16, MBEDTLS_DHM_RFC3526_MODP_2048_G) != 0)) {
      |                                                                     ^~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:719:79: error: 'MBEDTLS_DHM_RFC3526_MODP_2048_G' undeclared (first use in this function); did you mean 'MBEDTLS_DHM_RFC3526_MODP_2048_G_BIN'?
  719 |                         (mbedtls_mpi_read_string(&(mbedtlsDhmContext->G), 16, MBEDTLS_DHM_RFC3526_MODP_2048_G) != 0)) {
      |                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                               MBEDTLS_DHM_RFC3526_MODP_2048_G_BIN
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:723:42: error: 'mbedtls_dhm_context' has no member named 'len'
  723 |                         mbedtlsDhmContext->len=256;
      |                                          ^~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:727:73: error: 'mbedtls_dhm_context' has no member named 'P'
  727 |                         if ((mbedtls_mpi_read_string(&(mbedtlsDhmContext->P), 16, MBEDTLS_DHM_RFC3526_MODP_3072_P) != 0) ||
      |                                                                         ^~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:727:83: error: 'MBEDTLS_DHM_RFC3526_MODP_3072_P' undeclared (first use in this function); did you mean 'MBEDTLS_DHM_RFC3526_MODP_3072_P_BIN'?
  727 |                         if ((mbedtls_mpi_read_string(&(mbedtlsDhmContext->P), 16, MBEDTLS_DHM_RFC3526_MODP_3072_P) != 0) ||
      |                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                   MBEDTLS_DHM_RFC3526_MODP_3072_P_BIN
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:728:69: error: 'mbedtls_dhm_context' has no member named 'G'
  728 |                         (mbedtls_mpi_read_string(&(mbedtlsDhmContext->G), 16, MBEDTLS_DHM_RFC3526_MODP_3072_G) != 0)) {
      |                                                                     ^~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:728:79: error: 'MBEDTLS_DHM_RFC3526_MODP_3072_G' undeclared (first use in this function); did you mean 'MBEDTLS_DHM_RFC3526_MODP_3072_G_BIN'?
  728 |                         (mbedtls_mpi_read_string(&(mbedtlsDhmContext->G), 16, MBEDTLS_DHM_RFC3526_MODP_3072_G) != 0)) {
      |                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                               MBEDTLS_DHM_RFC3526_MODP_3072_G_BIN
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:732:42: error: 'mbedtls_dhm_context' has no member named 'len'
  732 |                         mbedtlsDhmContext->len=384;
      |                                          ^~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_ssl_handshake':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:887:32: error: 'mbedtls_ssl_context' has no member named 'state'
  887 |         while( ssl_ctx->ssl_ctx.state != MBEDTLS_SSL_HANDSHAKE_OVER )
      |                                ^
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:898:45: error: 'mbedtls_ssl_context' has no member named 'state'
  898 |                         if (ssl_ctx->ssl_ctx.state == MBEDTLS_SSL_CLIENT_CERTIFICATE && ssl_ctx->ssl_ctx.client_auth > 0) {
      |                                             ^
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:898:105: error: 'mbedtls_ssl_context' has no member named 'client_auth'
  898 |                         if (ssl_ctx->ssl_ctx.state == MBEDTLS_SSL_CLIENT_CERTIFICATE && ssl_ctx->ssl_ctx.client_auth > 0) {
      |                                                                                                         ^
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:902:142: error: 'mbedtls_ssl_context' has no member named 'session_negotiate'; did you mean 'private_session_negotiate'?
  902 |                                 bctbx_list_t *names = bctbx_x509_certificate_get_subjects((const bctbx_x509_certificate_t *)ssl_ctx->ssl_ctx.session_negotiate->peer_cert);
      |                                                                                                                                              ^~~~~~~~~~~~~~~~~
      |                                                                                                                                              private_session_negotiate
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_ssl_set_hs_own_cert':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:927:29: error: 'mbedtls_ssl_context' has no member named 'conf'
  927 |         if (ssl_ctx->ssl_ctx.conf->endpoint == MBEDTLS_SSL_IS_SERVER ) {
      |                             ^
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:930:88: error: 'mbedtls_ssl_context' has no member named 'conf'
  930 |                 return mbedtls_ssl_conf_own_cert((mbedtls_ssl_config *)ssl_ctx->ssl_ctx.conf , (mbedtls_x509_crt *)cert , (mbedtls_pk_context *)key);
      |                                                                                        ^
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_aes_gcm_context_new':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:1742:15: error: too many arguments to function 'mbedtls_gcm_starts'
 1742 |         ret = mbedtls_gcm_starts(ctx, mbedtls_mode, initializationVector, initializationVectorLength, authenticatedData, authenticatedDataLength);
      |               ^~~~~~~~~~~~~~~~~~
In file included from R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:40:
D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/gcm.h:234:5: note: declared here
  234 | int mbedtls_gcm_starts( mbedtls_gcm_context *ctx,
      |     ^~~~~~~~~~~~~~~~~~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_aes_gcm_process_chunk':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:1764:67: warning: passing argument 2 of 'mbedtls_gcm_update' makes pointer from integer without a cast [-Wint-conversion]
 1764 |         return mbedtls_gcm_update((mbedtls_gcm_context *)context, inputLength, input, output);
      |                                                                   ^~~~~~~~~~~
      |                                                                   |
      |                                                                   size_t {aka long long unsigned int}
In file included from R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:40:
D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/gcm.h:315:46: note: expected 'const unsigned char *' but argument is of type 'size_t' {aka 'long long unsigned int'}
  315 |                         const unsigned char *input, size_t input_length,
      |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:1764:80: warning: passing argument 3 of 'mbedtls_gcm_update' makes integer from pointer without a cast [-Wint-conversion]
 1764 |         return mbedtls_gcm_update((mbedtls_gcm_context *)context, inputLength, input, output);
      |                                                                                ^~~~~
      |                                                                                |
      |                                                                                const uint8_t * {aka const unsigned char *}
In file included from R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:40:
D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/gcm.h:315:60: note: expected 'size_t' {aka 'long long unsigned int'} but argument is of type 'const uint8_t *' {aka 'const unsigned char *'}
  315 |                         const unsigned char *input, size_t input_length,
      |                                                     ~~~~~~~^~~~~~~~~~~~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:1764:16: error: too few arguments to function 'mbedtls_gcm_update'
 1764 |         return mbedtls_gcm_update((mbedtls_gcm_context *)context, inputLength, input, output);
      |                ^~~~~~~~~~~~~~~~~~
In file included from R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:40:
D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/gcm.h:314:5: note: declared here
  314 | int mbedtls_gcm_update( mbedtls_gcm_context *ctx,
      |     ^~~~~~~~~~~~~~~~~~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_aes_gcm_finish':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:1780:15: error: too few arguments to function 'mbedtls_gcm_finish'
 1780 |         ret = mbedtls_gcm_finish((mbedtls_gcm_context *)context, tag, tagLength);
      |               ^~~~~~~~~~~~~~~~~~
In file included from R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:40:
D:\Prog\winlibs64-11.3.0msvcrt\custombuilt\include/mbedtls/gcm.h:352:5: note: declared here
  352 | int mbedtls_gcm_finish( mbedtls_gcm_context *ctx,
      |     ^~~~~~~~~~~~~~~~~~
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_ssl_set_hs_own_cert':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:932:1: warning: control reaches end of non-void function [-Wreturn-type]
  932 | }
      | ^
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c: In function 'bctbx_aes_gcm_process_chunk':
R:/winlibs64-11.3.0msvcrt/bctoolbox-5.1.61/src/crypto/mbedtls.c:1765:1: warning: control reaches end of non-void function [-Wreturn-type]
 1765 | }
      | ^
ninja: build stopped: subcommand failed.

So there are similar issues in the latest version.

I'm on Windows 11 using MinGW-w64 from https://winlibs.com/

@sinFunc
Copy link

sinFunc commented May 29, 2023

bctoolbox-5.2.64,mbedtls3.4.0.The error is below when compiling in redhat7.9 system.
error: too few arguments to function ‘mbedtls_pk_parse_key’
err=mbedtls_pk_parse_key((mbedtls_pk_context *)key, (const unsigned char *)buffer, buffer_length, password, password_length);
^~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/mbedtls/ssl_ciphersuites.h:28,
from /usr/local/include/mbedtls/ssl.h:32,
from /home/sean/installBySrc/bctoolbox-5.2.64/src/crypto/mbedtls.c:27:
/usr/local/include/mbedtls/pk.h:830:5: note: declared here
int mbedtls_pk_parse_key(mbedtls_pk_context *ctx,
^~~~~~~~~~~~~~~~~~~~
/home/sean/installBySrc/bctoolbox-5.2.64/src/crypto/mbedtls.c: In function ‘bctbx_signing_key_parse_file’:
/home/sean/installBySrc/bctoolbox-5.2.64/src/crypto/mbedtls.c:149:6: error: too few arguments to function ‘mbedtls_pk_parse_keyfile’
err=mbedtls_pk_parse_keyfile((mbedtls_pk_context *)key, path, password);

@sinFunc
Copy link

sinFunc commented May 31, 2023

mbedtls 2.83.3 and bctoolbox 5.2.64.it works! but i don't know why! just tell me if you know the reason.

@brechtsanders
Copy link

@sinFunc The latest mbedtls version is 3.4.0. Any plans to support versions 3.x ?

@sinFunc
Copy link

sinFunc commented Jun 1, 2023

I have no idea about it! as i was saying "just tell me if you know the reason." good luck!

@brechtsanders
Copy link

I would say the reason is the code is simply not written with mbedtls 3.x in mind, just mbedtls 2.x

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

3 participants