1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-05-10 00:49:04 +08:00

Merge pull request #7019 from tom-cosgrove-arm/dont-use-cast-assignment-in-ssl_server2.c

Don't use cast-assignment in ssl_server.c
This commit is contained in:
Dave Rodgman 2023-02-06 12:13:08 +00:00 committed by GitHub
commit f31c9e441b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1374,6 +1374,11 @@ int report_cid_usage(mbedtls_ssl_context *ssl,
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */ #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
#if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_HAVE_TIME) #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_HAVE_TIME)
static inline void put_unaligned_uint32(void *p, uint32_t x)
{
memcpy(p, &x, sizeof(x));
}
/* Functions for session ticket tests */ /* Functions for session ticket tests */
int dummy_ticket_write(void *p_ticket, const mbedtls_ssl_session *session, int dummy_ticket_write(void *p_ticket, const mbedtls_ssl_session *session,
unsigned char *start, const unsigned char *end, unsigned char *start, const unsigned char *end,
@ -1387,7 +1392,7 @@ int dummy_ticket_write(void *p_ticket, const mbedtls_ssl_session *session,
if (end - p < 4) { if (end - p < 4) {
return MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL; return MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL;
} }
*((uint32_t *) p) = 7 * 24 * 3600; put_unaligned_uint32(p, 7 * 24 * 3600);
*ticket_lifetime = 7 * 24 * 3600; *ticket_lifetime = 7 * 24 * 3600;
p += 4; p += 4;