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

Compile error when MBEDTLS_SSL_MAX_FRAGMENT_LENGTH is enabled. #209

Open
lhuang04 opened this issue Apr 20, 2021 · 0 comments
Open

Compile error when MBEDTLS_SSL_MAX_FRAGMENT_LENGTH is enabled. #209

lhuang04 opened this issue Apr 20, 2021 · 0 comments

Comments

@lhuang04
Copy link
Collaborator

When I turned on MBEDTLS_SSL_MAX_FRAGMENT_LENGTH in tls13-prototype branch.

diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h
index 9a8cd63ad..7b73f2f1c 100644
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
@@ -1690,7 +1690,7 @@
  *
  * Comment this macro to disable support for the max_fragment_length extension
  */
-//#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
+#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH

I got the following compiler error.

/home/lhuang04/upstream/library/ssl_tls13_client.c: In function ‘ssl_client_hello_write_partial’:
/home/lhuang04/upstream/library/ssl_tls13_client.c:1757:5: error: passing argument 3 of ‘ssl_write_max_fragment_length_ext’ makes integer from pointer without a cast [-Werror]
     ssl_write_max_fragment_length_ext( ssl, buf, end, &cur_ext_len );
     ^
/home/lhuang04/upstream/library/ssl_tls13_client.c:551:12: note: expected ‘size_t’ but argument is of type ‘unsigned char *’
 static int ssl_write_max_fragment_length_ext( mbedtls_ssl_context *ssl,
            ^
cc1: all warnings being treated as errors
make[2]: *** [library/CMakeFiles/mbedtls.dir/ssl_tls13_client.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 34%] Built target cert_req
/home/lhuang04/upstream/library/ssl_tls.c: In function ‘mbedtls_ssl_get_input_max_frag_len’:
/home/lhuang04/upstream/library/ssl_tls.c:5708:23: error: ‘MBEDTLS_SSL_SERVER_HELLO_DONE’ undeclared (first use in this function)
         ssl->state >= MBEDTLS_SSL_SERVER_HELLO_DONE )
                       ^
/home/lhuang04/upstream/library/ssl_tls.c:5708:23: note: each undeclared identifier is reported only once for each function it appears in
/home/lhuang04/upstream/library/ssl_tls13_server.c: In function ‘ssl_write_max_fragment_length_ext’:
/home/lhuang04/upstream/library/ssl_tls13_server.c:3080:9: error: ‘return’ with a value, in function returning void [-Werror]
         return( 0 );
         ^
/home/lhuang04/upstream/library/ssl_tls13_server.c:3085:9: error: ‘return’ with a value, in function returning void [-Werror]
         return( 0 );
         ^
/home/lhuang04/upstream/library/ssl_tls13_server.c: In function ‘ssl_encrypted_extensions_write’:
/home/lhuang04/upstream/library/ssl_tls13_server.c:3394:5: error: passing argument 3 of ‘ssl_write_max_fragment_length_ext’ makes pointer from integer without a cast [-Werror]
     ret = ssl_write_max_fragment_length_ext( ssl, p, end - p, &n );
     ^
/home/lhuang04/upstream/library/ssl_tls13_server.c:3070:13: note: expected ‘size_t *’ but argument is of type ‘long int’
 static void ssl_write_max_fragment_length_ext( mbedtls_ssl_context *ssl,
             ^
make[2]: *** [library/CMakeFiles/mbedtls.dir/ssl_tls.c.o] Error 1
[ 34%] Built target cert_write
/home/lhuang04/upstream/library/ssl_tls13_server.c:3394:5: error: too many arguments to function ‘ssl_write_max_fragment_length_ext’
     ret = ssl_write_max_fragment_length_ext( ssl, p, end - p, &n );
     ^
/home/lhuang04/upstream/library/ssl_tls13_server.c:3070:13: note: declared here
 static void ssl_write_max_fragment_length_ext( mbedtls_ssl_context *ssl,
             ^
/home/lhuang04/upstream/library/ssl_tls13_server.c:3394:9: error: void value not ignored as it ought to be
     ret = ssl_write_max_fragment_length_ext( ssl, p, end - p, &n );
         ^
cc1: all warnings being treated as errors
make[2]: *** [library/CMakeFiles/mbedtls.dir/ssl_tls13_server.c.o] Error 1
make[1]: *** [library/CMakeFiles/mbedtls.dir/all] Error 2
make: *** [all] Error 2
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

1 participant