mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-04 21:56:21 +01:00
Add context-using functions for Hello extensions
Also re-order functions in the header so that they appear in the order they're use, ie free() last.
This commit is contained in:
parent
7af8bc1007
commit
4e8bc78ad9
2 changed files with 134 additions and 34 deletions
|
|
@ -52,13 +52,6 @@ typedef struct
|
|||
*/
|
||||
void mbedtls_ecjpake_init( mbedtls_ecjpake_context *ctx );
|
||||
|
||||
/*
|
||||
* \brief Free a context's content
|
||||
*
|
||||
* \param ctx context to free
|
||||
*/
|
||||
void mbedtls_ecjpake_free( mbedtls_ecjpake_context *ctx );
|
||||
|
||||
/*
|
||||
* \brief Set up a context for use
|
||||
*
|
||||
|
|
@ -76,6 +69,79 @@ int mbedtls_ecjpake_setup( mbedtls_ecjpake_context *ctx,
|
|||
mbedtls_md_type_t hash,
|
||||
mbedtls_ecp_group_id curve );
|
||||
|
||||
/*
|
||||
* \brief Generate and write contents of ClientHello extension
|
||||
* (excluding extension type and length bytes)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Buffer to write the contents to
|
||||
* \param len Buffer size
|
||||
* \param olen Will be updated with the number of bytes written
|
||||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_tls_write_client_ext( mbedtls_ecjpake_context *ctx,
|
||||
unsigned char *buf, size_t len, size_t *olen,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng );
|
||||
/*
|
||||
* \brief Read and process contents of the ClientHello extension
|
||||
* (excluding extension type and length bytes)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Pointer to extension contents
|
||||
* \param len Extension length
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_tls_read_client_ext( mbedtls_ecjpake_context *ctx,
|
||||
const unsigned char *buf,
|
||||
size_t len );
|
||||
|
||||
/*
|
||||
* \brief Generate and write contents of ServerHello extension
|
||||
* (excluding extension type and length bytes)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Buffer to write the contents to
|
||||
* \param len Buffer size
|
||||
* \param olen Will be updated with the number of bytes written
|
||||
* \param f_rng RNG function
|
||||
* \param p_rng RNG parameter
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_tls_write_server_ext( mbedtls_ecjpake_context *ctx,
|
||||
unsigned char *buf, size_t len, size_t *olen,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng );
|
||||
/*
|
||||
* \brief Read and process contents of the ServerHello extension
|
||||
* (excluding extension type and length bytes)
|
||||
*
|
||||
* \param ctx Context to use
|
||||
* \param buf Pointer to extension contents
|
||||
* \param len Extension length
|
||||
*
|
||||
* \return 0 if successfull,
|
||||
* a negative error code otherwise
|
||||
*/
|
||||
int mbedtls_ecjpake_tls_read_server_ext( mbedtls_ecjpake_context *ctx,
|
||||
const unsigned char *buf,
|
||||
size_t len );
|
||||
|
||||
/*
|
||||
* \brief Free a context's content
|
||||
*
|
||||
* \param ctx context to free
|
||||
*/
|
||||
void mbedtls_ecjpake_free( mbedtls_ecjpake_context *ctx );
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
/**
|
||||
* \brief Checkup routine
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue