diff --git a/ChangeLog b/ChangeLog index 1740eba556..459e81042f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,7 +32,7 @@ Features MBEDTLS_SSL_DTLS_CONNECTION_ID (disabled by default), and at run-time through the new APIs mbedtls_ssl_conf_cid() and mbedtls_ssl_set_cid(). * Add new API functions mbedtls_ssl_session_save() and - mbedtls_ssl_session_load() to allow serialising a session, for example to + mbedtls_ssl_session_load() to allow serializing a session, for example to store it in non-volatile storage, and later using it for TLS session resumption. diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index 270a77e295..ed7d7ee2de 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -848,7 +848,7 @@ typedef void mbedtls_ssl_async_cancel_t( mbedtls_ssl_context *ssl ); * * Note: when changing this definition, we need to check and update: * - in tests/suites/test_suite_ssl.function: - * ssl_populate_session() and ssl_serialise_session_save_load() + * ssl_populate_session() and ssl_serialize_session_save_load() * - in library/ssl_tls.c: * mbedtls_ssl_session_init() and mbedtls_ssl_session_free() * mbedtls_ssl_session_save() and ssl_session_load() @@ -2357,14 +2357,14 @@ int mbedtls_ssl_set_session( mbedtls_ssl_context *ssl, const mbedtls_ssl_session #endif /* MBEDTLS_SSL_CLI_C */ /** - * \brief Load serialised session data into a session structure. + * \brief Load serialized session data into a session structure. * On client, this can be used for loading saved sessions * before resuming them with mbedstls_ssl_set_session(). * On server, this can be used for alternative implementations * of session cache or session tickets. * * \warning If a peer certificate chain is associated with the session, - * the serialised state will only contain the peer's + * the serialized state will only contain the peer's * end-entity certificate and the result of the chain * verification (unless verification was disabled), but not * the rest of the chain. @@ -2375,9 +2375,9 @@ int mbedtls_ssl_set_session( mbedtls_ssl_context *ssl, const mbedtls_ssl_session * \param session The session structure to be populated. It must have been * initialised with mbedtls_ssl_session_init() but not * populated yet. - * \param buf The buffer holding the serialised session data. It must be a + * \param buf The buffer holding the serialized session data. It must be a * readable buffer of at least \p len bytes. - * \param len The size of the serialised data in bytes. + * \param len The size of the serialized data in bytes. * * \return \c 0 if successful. * \return #MBEDTLS_ERR_SSL_ALLOC_FAILED if memory allocation failed. @@ -2390,7 +2390,7 @@ int mbedtls_ssl_session_load( mbedtls_ssl_session *session, size_t len ); /** - * \brief Save session structure as serialised data in a buffer. + * \brief Save session structure as serialized data in a buffer. * On client, this can be used for saving session data, * potentially in non-volatile storage, for resuming later. * On server, this can be used for alternative implementations @@ -2422,7 +2422,7 @@ int mbedtls_ssl_session_save( const mbedtls_ssl_session *session, /** * \brief Get a pointer to the current session structure, for example - * to serialise it. + * to serialize it. * * \warning Ownership of the session remains with the SSL context, and * the returned pointer is only guaranteed to be valid until diff --git a/library/ssl_tls.c b/library/ssl_tls.c index cc70510cb8..8342a3ee6d 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -9959,7 +9959,7 @@ int mbedtls_ssl_session_save( const mbedtls_ssl_session *session, } /* - * Unserialise session, see mbedtls_ssl_session_save(). + * Unserialize session, see mbedtls_ssl_session_save(). * * This internal version is wrapped by a public function that cleans up in * case of error. @@ -10095,7 +10095,7 @@ static int ssl_session_load( mbedtls_ssl_session *session, } /* - * Unserialise session: public wrapper for error cleaning + * Unserialize session: public wrapper for error cleaning */ int mbedtls_ssl_session_load( mbedtls_ssl_session *session, const unsigned char *buf, diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 1fc86c5d79..0d7cb667eb 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -382,7 +382,7 @@ int main( void ) " reconnect=%%d number of reconnections using session resumption\n" \ " default: 0 (disabled)\n" \ " reco_delay=%%d default: 0 seconds\n" \ - " reco_mode=%%d 0: copy session, 1: serialise session\n" \ + " reco_mode=%%d 0: copy session, 1: serialize session\n" \ " default: 1\n" \ " reconnect_hard=%%d default: 0 (disabled)\n" \ USAGE_TICKETS \ diff --git a/tests/suites/test_suite_ssl.data b/tests/suites/test_suite_ssl.data index a3e640b7fc..01517c19c2 100644 --- a/tests/suites/test_suite_ssl.data +++ b/tests/suites/test_suite_ssl.data @@ -8753,94 +8753,94 @@ SSL TLS_PRF MBEDTLS_SSL_TLS_PRF_SHA256 SHA-256 not enabled depends_on:!MBEDTLS_SHA256_C ssl_tls_prf:MBEDTLS_SSL_TLS_PRF_SHA256:"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef":"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef":"test tls_prf label":"7f9998393198a02c8d731ccc2ef90b2c":MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE -Session serialisation, save-load: no ticket, no cert -ssl_serialise_session_save_load:0:"" +Session serialization, save-load: no ticket, no cert +ssl_serialize_session_save_load:0:"" -Session serialisation, save-load: small ticket, no cert +Session serialization, save-load: small ticket, no cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C -ssl_serialise_session_save_load:42:"" +ssl_serialize_session_save_load:42:"" -Session serialisation, save-load: large ticket, no cert +Session serialization, save-load: large ticket, no cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C -ssl_serialise_session_save_load:1023:"" +ssl_serialize_session_save_load:1023:"" -Session serialisation, save-load: no ticket, cert +Session serialization, save-load: no ticket, cert depends_on:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_save_load:0:"data_files/server5.crt" +ssl_serialize_session_save_load:0:"data_files/server5.crt" -Session serialisation, save-load: small ticket, cert +Session serialization, save-load: small ticket, cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_save_load:42:"data_files/server5.crt" +ssl_serialize_session_save_load:42:"data_files/server5.crt" -Session serialisation, save-load: large ticket, cert +Session serialization, save-load: large ticket, cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_save_load:1023:"data_files/server5.crt" +ssl_serialize_session_save_load:1023:"data_files/server5.crt" -Session serialisation, load-save: no ticket, no cert -ssl_serialise_session_load_save:0:"" +Session serialization, load-save: no ticket, no cert +ssl_serialize_session_load_save:0:"" -Session serialisation, load-save: small ticket, no cert +Session serialization, load-save: small ticket, no cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C -ssl_serialise_session_load_save:42:"" +ssl_serialize_session_load_save:42:"" -Session serialisation, load-save: large ticket, no cert +Session serialization, load-save: large ticket, no cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C -ssl_serialise_session_load_save:1023:"" +ssl_serialize_session_load_save:1023:"" -Session serialisation, load-save: no ticket, cert +Session serialization, load-save: no ticket, cert depends_on:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_load_save:0:"data_files/server5.crt" +ssl_serialize_session_load_save:0:"data_files/server5.crt" -Session serialisation, load-save: small ticket, cert +Session serialization, load-save: small ticket, cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_load_save:42:"data_files/server5.crt" +ssl_serialize_session_load_save:42:"data_files/server5.crt" -Session serialisation, load-save: large ticket, cert +Session serialization, load-save: large ticket, cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_load_save:1023:"data_files/server5.crt" +ssl_serialize_session_load_save:1023:"data_files/server5.crt" -Session serialisation, save buffer size: no ticket, no cert -ssl_serialise_session_save_buf_size:0:"" +Session serialization, save buffer size: no ticket, no cert +ssl_serialize_session_save_buf_size:0:"" -Session serialisation, save buffer size: small ticket, no cert +Session serialization, save buffer size: small ticket, no cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C -ssl_serialise_session_save_buf_size:42:"" +ssl_serialize_session_save_buf_size:42:"" -Session serialisation, save buffer size: large ticket, no cert +Session serialization, save buffer size: large ticket, no cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C -ssl_serialise_session_save_buf_size:1023:"" +ssl_serialize_session_save_buf_size:1023:"" -Session serialisation, save buffer size: no ticket, cert +Session serialization, save buffer size: no ticket, cert depends_on:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_save_buf_size:0:"data_files/server5.crt" +ssl_serialize_session_save_buf_size:0:"data_files/server5.crt" -Session serialisation, save buffer size: small ticket, cert +Session serialization, save buffer size: small ticket, cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_save_buf_size:42:"data_files/server5.crt" +ssl_serialize_session_save_buf_size:42:"data_files/server5.crt" -Session serialisation, save buffer size: large ticket, cert +Session serialization, save buffer size: large ticket, cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_save_buf_size:1023:"data_files/server5.crt" +ssl_serialize_session_save_buf_size:1023:"data_files/server5.crt" -Session serialisation, load buffer size: no ticket, no cert -ssl_serialise_session_load_buf_size:0:"" +Session serialization, load buffer size: no ticket, no cert +ssl_serialize_session_load_buf_size:0:"" -Session serialisation, load buffer size: small ticket, no cert +Session serialization, load buffer size: small ticket, no cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C -ssl_serialise_session_load_buf_size:42:"" +ssl_serialize_session_load_buf_size:42:"" -Session serialisation, load buffer size: large ticket, no cert +Session serialization, load buffer size: large ticket, no cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C -ssl_serialise_session_load_buf_size:1023:"" +ssl_serialize_session_load_buf_size:1023:"" -Session serialisation, load buffer size: no ticket, cert +Session serialization, load buffer size: no ticket, cert depends_on:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_load_buf_size:0:"data_files/server5.crt" +ssl_serialize_session_load_buf_size:0:"data_files/server5.crt" -Session serialisation, load buffer size: small ticket, cert +Session serialization, load buffer size: small ticket, cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_load_buf_size:42:"data_files/server5.crt" +ssl_serialize_session_load_buf_size:42:"data_files/server5.crt" -Session serialisation, load buffer size: large ticket, cert +Session serialization, load buffer size: large ticket, cert depends_on:MBEDTLS_SSL_SESSION_TICKETS:MBEDTLS_SSL_CLI_C:MBEDTLS_X509_USE_C:MBEDTLS_PEM_PARSE_C:MBEDTLS_ECDSA_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_SHA256_C:MBEDTLS_FS_IO -ssl_serialise_session_load_buf_size:1023:"data_files/server5.crt" +ssl_serialize_session_load_buf_size:1023:"data_files/server5.crt" diff --git a/tests/suites/test_suite_ssl.function b/tests/suites/test_suite_ssl.function index 2b755edf4e..5a32ac9a8c 100644 --- a/tests/suites/test_suite_ssl.function +++ b/tests/suites/test_suite_ssl.function @@ -268,7 +268,7 @@ cleanup: } /* - * Populate a session structure for serialisation tests. + * Populate a session structure for serialization tests. * Choose dummy values, mostly non-0 to distinguish from the init default. */ static int ssl_populate_session( mbedtls_ssl_session *session, @@ -669,7 +669,7 @@ exit: /* END_CASE */ /* BEGIN_CASE */ -void ssl_serialise_session_save_load( int ticket_len, char *crt_file ) +void ssl_serialize_session_save_load( int ticket_len, char *crt_file ) { mbedtls_ssl_session original, restored; unsigned char *buf = NULL; @@ -685,14 +685,14 @@ void ssl_serialise_session_save_load( int ticket_len, char *crt_file ) /* Prepare a dummy session to work on */ TEST_ASSERT( ssl_populate_session( &original, ticket_len, crt_file ) == 0 ); - /* Serialise it */ + /* Serialize it */ TEST_ASSERT( mbedtls_ssl_session_save( &original, NULL, 0, &len ) == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); TEST_ASSERT( ( buf = mbedtls_calloc( 1, len ) ) != NULL ); TEST_ASSERT( mbedtls_ssl_session_save( &original, buf, len, &len ) == 0 ); - /* Restore session from serialised data */ + /* Restore session from serialized data */ TEST_ASSERT( mbedtls_ssl_session_load( &restored, buf, len) == 0 ); /* @@ -755,7 +755,7 @@ exit: /* END_CASE */ /* BEGIN_CASE depends_on:MBEDTLS_SEE_FUTURE_PR */ -void ssl_serialise_session_load_save( int ticket_len, char *crt_file ) +void ssl_serialize_session_load_save( int ticket_len, char *crt_file ) { mbedtls_ssl_session session; unsigned char *buf1 = NULL, *buf2 = NULL; @@ -770,7 +770,7 @@ void ssl_serialise_session_load_save( int ticket_len, char *crt_file ) /* Prepare a dummy session to work on */ TEST_ASSERT( ssl_populate_session( &session, ticket_len, crt_file ) == 0 ); - /* Get desired buffer size for serialising */ + /* Get desired buffer size for serializing */ TEST_ASSERT( mbedtls_ssl_session_save( &session, NULL, 0, &len0 ) == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); @@ -778,22 +778,22 @@ void ssl_serialise_session_load_save( int ticket_len, char *crt_file ) buf1 = mbedtls_calloc( 1, len0 ); TEST_ASSERT( buf1 != NULL ); - /* Serialise to buffer and free live session */ + /* Serialize to buffer and free live session */ TEST_ASSERT( mbedtls_ssl_session_save( &session, buf1, len0, &len1 ) == 0 ); TEST_ASSERT( len0 == len1 ); mbedtls_ssl_session_free( &session ); - /* Restore session from serialised data */ + /* Restore session from serialized data */ TEST_ASSERT( mbedtls_ssl_session_load( &session, buf1, len1 ) == 0 ); - /* Allocate second buffer and serialise to it */ + /* Allocate second buffer and serialize to it */ buf2 = mbedtls_calloc( 1, len0 ); TEST_ASSERT( buf2 != NULL ); TEST_ASSERT( mbedtls_ssl_session_save( &session, buf2, len0, &len2 ) == 0 ); - /* Make sure both serialised versions are identical */ + /* Make sure both serialized versions are identical */ TEST_ASSERT( len1 == len2 ); TEST_ASSERT( memcmp( buf1, buf2, len1 ) == 0 ); @@ -805,7 +805,7 @@ exit: /* END_CASE */ /* BEGIN_CASE */ -void ssl_serialise_session_save_buf_size( int ticket_len, char *crt_file ) +void ssl_serialize_session_save_buf_size( int ticket_len, char *crt_file ) { mbedtls_ssl_session session; unsigned char *buf = NULL; @@ -817,7 +817,7 @@ void ssl_serialise_session_save_buf_size( int ticket_len, char *crt_file ) mbedtls_ssl_session_init( &session ); - /* Prepare dummy session and get serialised size */ + /* Prepare dummy session and get serialized size */ TEST_ASSERT( ssl_populate_session( &session, ticket_len, crt_file ) == 0 ); TEST_ASSERT( mbedtls_ssl_session_save( &session, NULL, 0, &good_len ) == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL ); @@ -841,7 +841,7 @@ exit: /* END_CASE */ /* BEGIN_CASE */ -void ssl_serialise_session_load_buf_size( int ticket_len, char *crt_file ) +void ssl_serialize_session_load_buf_size( int ticket_len, char *crt_file ) { mbedtls_ssl_session session; unsigned char *good_buf = NULL, *bad_buf = NULL; @@ -853,7 +853,7 @@ void ssl_serialise_session_load_buf_size( int ticket_len, char *crt_file ) mbedtls_ssl_session_init( &session ); - /* Prepare serialised session data */ + /* Prepare serialized session data */ TEST_ASSERT( ssl_populate_session( &session, ticket_len, crt_file ) == 0 ); TEST_ASSERT( mbedtls_ssl_session_save( &session, NULL, 0, &good_len ) == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );