buglwIP - A Lightweight TCP/IP stack - Bugs: bug #65040, Compilation error when...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #65040: Compilation error when MBEDTLS_HAVE_TIME is not defined

Submitter:  flashything
Submitted:  Sat 16 Dec 2023 01:14:30 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Compiler Warning Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
lwIP version:  2.2.0

Sat 16 Dec 2023 01:14:30 PM UTC, original submission:  

To save space I don't use time functions in mbedtls, so MBEDTLS_HAVE_TIME is disabled. Thus the variable "start" in mbedtls_ssl_session is also not defined in mbedtls/ssl.h:

struct mbedtls_ssl_session {
...
#if defined(MBEDTLS_HAVE_TIME)
    mbedtls_time_t start;       /*!< starting time      */
#endif
...
}


Then the compilation of altcp_tls_set_session in altcp_tls_mbedtls.c fails, because there is a check of "session->data.start":

altcp_tls_set_session(struct altcp_pcb *conn, struct altcp_tls_session *session)
{
...
    if (session->data.start)
      ret = mbedtls_ssl_set_session(&state->ssl_context, &session->data);
...
}


A possible patch could be testing "id_len" instead of "start":

--- a/src/apps/altcp_tls/altcp_tls_mbedtls.c
+++ b/src/apps/altcp_tls/altcp_tls_mbedtls.c
@@ -683,7 +683,7 @@ altcp_tls_set_session(struct altcp_pcb *conn, struct altcp_tls_session *session)
   if (session && conn && conn->state) {
     altcp_mbedtls_state_t *state = (altcp_mbedtls_state_t *)conn->state;
     int ret = -1;
-    if (session->data.start)
+    if (session->data.id_len)
       ret = mbedtls_ssl_set_session(&state->ssl_context, &session->data);
     return ret < 0 ? ERR_VAL : ERR_OK;
   }


flashything

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by flashything (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code