mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-05-14 07:38:16 +02:00
Introduce SSL helper function to mark pending alerts
This commit is contained in:
@@ -366,6 +366,7 @@
|
||||
#define MBEDTLS_SSL_ALERT_MSG_UNRECOGNIZED_NAME 112 /* 0x70 */
|
||||
#define MBEDTLS_SSL_ALERT_MSG_UNKNOWN_PSK_IDENTITY 115 /* 0x73 */
|
||||
#define MBEDTLS_SSL_ALERT_MSG_NO_APPLICATION_PROTOCOL 120 /* 0x78 */
|
||||
#define MBEDTLS_SSL_ALERT_MSG_NONE 255 /* internal */
|
||||
|
||||
#define MBEDTLS_SSL_HS_HELLO_REQUEST 0
|
||||
#define MBEDTLS_SSL_HS_CLIENT_HELLO 1
|
||||
@@ -1234,6 +1235,9 @@ struct mbedtls_ssl_context
|
||||
{
|
||||
const mbedtls_ssl_config *conf; /*!< configuration information */
|
||||
|
||||
unsigned char pend_alert_level;
|
||||
unsigned char pend_alert_msg;
|
||||
|
||||
/*
|
||||
* Miscellaneous
|
||||
*/
|
||||
|
||||
@@ -1724,4 +1724,15 @@ static inline unsigned int mbedtls_ssl_conf_get_ems_enforced(
|
||||
|
||||
#endif /* MBEDTLS_SSL_CONF_SINGLE_SIG_HASH */
|
||||
|
||||
__attribute__((always_inline)) static inline int mbedtls_ssl_pend_alert_message(
|
||||
mbedtls_ssl_context *ssl,
|
||||
unsigned char level,
|
||||
unsigned char message )
|
||||
{
|
||||
if( level != MBEDTLS_SSL_ALERT_LEVEL_FATAL )
|
||||
ssl->pend_alert_level = level;
|
||||
ssl->pend_alert_msg = message;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#endif /* ssl_internal.h */
|
||||
|
||||
Reference in New Issue
Block a user