mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-25 19:51:12 +00:00
Add mbedtls_ssl_set_hs_ecjpake_password()
This commit is contained in:
parent
76cfd3f97f
commit
7002f4a560
|
@ -1671,6 +1671,29 @@ void mbedtls_ssl_conf_sni( mbedtls_ssl_config *conf,
|
||||||
void *p_sni );
|
void *p_sni );
|
||||||
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
|
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECJPAKE_C)
|
||||||
|
/**
|
||||||
|
* \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_ECJPAKE_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_ALPN)
|
#if defined(MBEDTLS_SSL_ALPN)
|
||||||
/**
|
/**
|
||||||
* \brief Set the supported Application Layer Protocols.
|
* \brief Set the supported Application Layer Protocols.
|
||||||
|
|
|
@ -5451,6 +5451,32 @@ void mbedtls_ssl_set_hs_authmode( mbedtls_ssl_context *ssl,
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
|
#endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ECJPAKE_C)
|
||||||
|
/*
|
||||||
|
* Set EC J-PAKE password for current handshake
|
||||||
|
*/
|
||||||
|
int mbedtls_ssl_set_hs_ecjpake_password( mbedtls_ssl_context *ssl,
|
||||||
|
const unsigned char *pw,
|
||||||
|
size_t pw_len )
|
||||||
|
{
|
||||||
|
mbedtls_ecjpake_role role;
|
||||||
|
|
||||||
|
if( ssl->handshake == NULL && ssl->conf == NULL )
|
||||||
|
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||||
|
|
||||||
|
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER )
|
||||||
|
role = MBEDTLS_ECJPAKE_SERVER;
|
||||||
|
else
|
||||||
|
role = MBEDTLS_ECJPAKE_CLIENT;
|
||||||
|
|
||||||
|
return( mbedtls_ecjpake_setup( &ssl->handshake->ecjpake_ctx,
|
||||||
|
role,
|
||||||
|
MBEDTLS_MD_SHA256,
|
||||||
|
MBEDTLS_ECP_DP_SECP256R1,
|
||||||
|
pw, pw_len ) );
|
||||||
|
}
|
||||||
|
#endif /* MBEDTLS_ECJPAKE_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
||||||
int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,
|
int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,
|
||||||
const unsigned char *psk, size_t psk_len,
|
const unsigned char *psk, size_t psk_len,
|
||||||
|
|
Loading…
Reference in a new issue