Merge branch iotssl-521-keylen-check
This commit is contained in:
commit
5f7c34b8b0
31 changed files with 2871 additions and 74 deletions
|
@ -352,6 +352,8 @@
|
|||
|
||||
#define MBEDTLS_TLS_EXT_SESSION_TICKET 35
|
||||
|
||||
#define MBEDTLS_TLS_EXT_ECJPAKE_KKPP 256 /* experimental */
|
||||
|
||||
#define MBEDTLS_TLS_EXT_RENEGOTIATION_INFO 0xFF01
|
||||
|
||||
/*
|
||||
|
@ -390,6 +392,9 @@ union mbedtls_ssl_premaster_secret
|
|||
unsigned char _pms_ecdhe_psk[4 + MBEDTLS_ECP_MAX_BYTES
|
||||
+ MBEDTLS_PSK_MAX_LEN]; /* RFC 5489 2 */
|
||||
#endif
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
unsigned char _pms_ecjpake[32]; /* Thread spec: SHA-256 output */
|
||||
#endif
|
||||
};
|
||||
|
||||
#define MBEDTLS_PREMASTER_SIZE sizeof( union mbedtls_ssl_premaster_secret )
|
||||
|
@ -542,6 +547,13 @@ struct mbedtls_ssl_config
|
|||
void *p_ticket; /*!< context for the ticket callbacks */
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
|
||||
|
||||
#if defined(MBEDTLS_SSL_EXPORT_KEYS)
|
||||
/** Callback to export key block and master secret */
|
||||
int (*f_export_keys)( void *, const unsigned char *,
|
||||
const unsigned char *, size_t, size_t, size_t );
|
||||
void *p_export_keys; /*!< context for key export callback */
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
const mbedtls_x509_crt_profile *cert_profile; /*!< verification profile */
|
||||
mbedtls_ssl_key_cert *key_cert; /*!< own certificate/key pair(s) */
|
||||
|
@ -1069,6 +1081,35 @@ typedef int mbedtls_ssl_ticket_write_t( void *p_ticket,
|
|||
size_t *tlen,
|
||||
uint32_t *lifetime );
|
||||
|
||||
#if defined(MBEDTLS_SSL_EXPORT_KEYS)
|
||||
/**
|
||||
* \brief Callback type: Export key block and master secret
|
||||
*
|
||||
* \note This is required for certain uses of TLS, e.g. EAP-TLS
|
||||
* (RFC 5216) and Thread. The key pointers are ephemeral and
|
||||
* therefore must not be stored. The master secret and keys
|
||||
* should not be used directly except as an input to a key
|
||||
* derivation function.
|
||||
*
|
||||
* \param p_expkey Context for the callback
|
||||
* \param ms Pointer to master secret (fixed length: 48 bytes)
|
||||
* \param kb Pointer to key block, see RFC 5246 section 6.3
|
||||
* (variable length: 2 * maclen + 2 * keylen + 2 * ivlen).
|
||||
* \param maclen MAC length
|
||||
* \param keylen Key length
|
||||
* \param ivlen IV length
|
||||
*
|
||||
* \return 0 if successful, or
|
||||
* a specific MBEDTLS_ERR_XXX code.
|
||||
*/
|
||||
typedef int mbedtls_ssl_export_keys_t( void *p_expkey,
|
||||
const unsigned char *ms,
|
||||
const unsigned char *kb,
|
||||
size_t maclen,
|
||||
size_t keylen,
|
||||
size_t ivlen );
|
||||
#endif /* MBEDTLS_SSL_EXPORT_KEYS */
|
||||
|
||||
/**
|
||||
* \brief Callback type: parse and load session ticket
|
||||
*
|
||||
|
@ -1118,6 +1159,22 @@ void mbedtls_ssl_conf_session_tickets_cb( mbedtls_ssl_config *conf,
|
|||
void *p_ticket );
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS && MBEDTLS_SSL_SRV_C */
|
||||
|
||||
#if defined(MBEDTLS_SSL_EXPORT_KEYS)
|
||||
/**
|
||||
* \brief Configure key export callback.
|
||||
* (Default: none.)
|
||||
*
|
||||
* \note See \c mbedtls_ssl_export_keys_t.
|
||||
*
|
||||
* \param conf SSL configuration context
|
||||
* \param f_export_keys Callback for exporting keys
|
||||
* \param p_export_keys Context for the callback
|
||||
*/
|
||||
void mbedtls_ssl_conf_export_keys_cb( mbedtls_ssl_config *conf,
|
||||
mbedtls_ssl_export_keys_t *f_export_keys,
|
||||
void *p_export_keys );
|
||||
#endif /* MBEDTLS_SSL_EXPORT_KEYS */
|
||||
|
||||
/**
|
||||
* \brief Callback type: generate a cookie
|
||||
*
|
||||
|
@ -1681,6 +1738,29 @@ void mbedtls_ssl_conf_sni( mbedtls_ssl_config *conf,
|
|||
void *p_sni );
|
||||
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
|
||||
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
/**
|
||||
* \brief Set the EC J-PAKE password for current handshake.
|
||||
*
|
||||
* \note An internal copy is made, and destroyed as soon as the
|
||||
* handshake is completed, or when the SSL context is reset or
|
||||
* freed.
|
||||
*
|
||||
* \note The SSL context needs to be already set up. The right place
|
||||
* to call this function is between \c mbedtls_ssl_setup() or
|
||||
* \c mbedtls_ssl_reset() and \c mbedtls_ssl_handshake().
|
||||
*
|
||||
* \param ssl SSL context
|
||||
* \param pw EC J-PAKE password (pre-shared secret)
|
||||
* \param pw_len length of pw in bytes
|
||||
*
|
||||
* \return 0 on success, or a negative error code.
|
||||
*/
|
||||
int mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,
|
||||
const unsigned char *pw,
|
||||
size_t pw_len );
|
||||
#endif /*MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */
|
||||
|
||||
#if defined(MBEDTLS_SSL_ALPN)
|
||||
/**
|
||||
* \brief Set the supported Application Layer Protocols.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue