Fix documentation and tests
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
fde112830f
commit
c0e6250ff9
5 changed files with 34 additions and 35 deletions
|
@ -379,16 +379,16 @@ psa_status_t psa_crypto_driver_pake_get_user_len(
|
|||
size_t *user_len);
|
||||
|
||||
psa_status_t psa_crypto_driver_pake_get_user(
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
uint8_t *buffer, size_t buffer_size, size_t *buffer_length);
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
uint8_t *user_id, size_t user_id_size, size_t *user_id_len);
|
||||
|
||||
psa_status_t psa_crypto_driver_pake_get_peer_len(
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
size_t *peer_len);
|
||||
|
||||
psa_status_t psa_crypto_driver_pake_get_peer(
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
uint8_t *buffer, size_t buffer_size, size_t *buffer_length);
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length);
|
||||
|
||||
psa_status_t psa_crypto_driver_pake_get_role(
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
|
|
|
@ -1300,10 +1300,10 @@ typedef struct psa_jpake_computation_stage_s psa_jpake_computation_stage_t;
|
|||
*/
|
||||
static psa_pake_operation_t psa_pake_operation_init(void);
|
||||
|
||||
/** Get the lengths of the password in bytes from given inputs.
|
||||
/** Get the length of the password in bytes from given inputs.
|
||||
*
|
||||
* \param[in] inputs Operation inputs.
|
||||
* \param[out] password_len Return buffer for password length.
|
||||
* \param[out] password_len Password length.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* Success.
|
||||
|
@ -1344,10 +1344,10 @@ psa_status_t psa_crypto_driver_pake_get_role(
|
|||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
psa_pake_role_t *role);
|
||||
|
||||
/** Get the lengths of the user id in bytes from given inputs.
|
||||
/** Get the length of the user id in bytes from given inputs.
|
||||
*
|
||||
* \param[in] inputs Operation inputs.
|
||||
* \param[out] user_len Return buffer for user id length.
|
||||
* \param[out] user_len User id length.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* Success.
|
||||
|
@ -1358,10 +1358,10 @@ psa_status_t psa_crypto_driver_pake_get_user_len(
|
|||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
size_t *user_len);
|
||||
|
||||
/** Get the lengths of the peer id in bytes from given inputs.
|
||||
/** Get the length of the peer id in bytes from given inputs.
|
||||
*
|
||||
* \param[in] inputs Operation inputs.
|
||||
* \param[out] peer_len Return buffer for peer id length.
|
||||
* \param[out] peer_len Peer id length.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* Success.
|
||||
|
@ -1375,38 +1375,38 @@ psa_status_t psa_crypto_driver_pake_get_peer_len(
|
|||
/** Get the user id from given inputs.
|
||||
*
|
||||
* \param[in] inputs Operation inputs.
|
||||
* \param[out] buffer Return buffer for user id.
|
||||
* \param buffer_size Size of the return buffer in bytes.
|
||||
* \param[out] buffer_length Actual size of the password in bytes.
|
||||
* \param[out] user_id User id.
|
||||
* \param user_id_size Size of \p user_id in bytes.
|
||||
* \param[out] user_id_len Size of the user id in bytes.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* Success.
|
||||
* \retval #PSA_ERROR_BAD_STATE
|
||||
* User id hasn't been set yet.
|
||||
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||
* The size of the \p buffer is too small.
|
||||
* The size of the \p user_id is too small.
|
||||
*/
|
||||
psa_status_t psa_crypto_driver_pake_get_user(
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
uint8_t *buffer, size_t buffer_size, size_t *buffer_length);
|
||||
uint8_t *user_id, size_t user_id_size, size_t *user_id_len);
|
||||
|
||||
/** Get the peer id from given inputs.
|
||||
*
|
||||
* \param[in] inputs Operation inputs.
|
||||
* \param[out] buffer Return buffer for user id.
|
||||
* \param buffer_size Size of the return buffer in bytes.
|
||||
* \param[out] buffer_length Actual size of the password in bytes.
|
||||
* \param[out] peer_id Peer id.
|
||||
* \param peer_id_size Size of \p peer_id in bytes.
|
||||
* \param[out] peer_id_length Size of the peer id in bytes.
|
||||
*
|
||||
* \retval #PSA_SUCCESS
|
||||
* Success.
|
||||
* \retval #PSA_ERROR_BAD_STATE
|
||||
* Peer id hasn't been set yet.
|
||||
* \retval #PSA_ERROR_BUFFER_TOO_SMALL
|
||||
* The size of the \p buffer is too small.
|
||||
* The size of the \p peer_id is too small.
|
||||
*/
|
||||
psa_status_t psa_crypto_driver_pake_get_peer(
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
uint8_t *buffer, size_t buffer_size, size_t *buffer_length);
|
||||
uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length);
|
||||
|
||||
/** Get the cipher suite from given inputs.
|
||||
*
|
||||
|
|
|
@ -7228,18 +7228,18 @@ psa_status_t psa_crypto_driver_pake_get_user_len(
|
|||
|
||||
psa_status_t psa_crypto_driver_pake_get_user(
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
uint8_t *buffer, size_t buffer_size, size_t *buffer_length)
|
||||
uint8_t *user_id, size_t user_id_size, size_t *user_id_len)
|
||||
{
|
||||
if (inputs->user_len == 0) {
|
||||
return PSA_ERROR_BAD_STATE;
|
||||
}
|
||||
|
||||
if (buffer_size < inputs->user_len) {
|
||||
if (user_id_size < inputs->user_len) {
|
||||
return PSA_ERROR_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
memcpy(buffer, inputs->user, inputs->user_len);
|
||||
*buffer_length = inputs->user_len;
|
||||
memcpy(user_id, inputs->user, inputs->user_len);
|
||||
*user_id_len = inputs->user_len;
|
||||
|
||||
return PSA_SUCCESS;
|
||||
}
|
||||
|
@ -7259,18 +7259,18 @@ psa_status_t psa_crypto_driver_pake_get_peer_len(
|
|||
|
||||
psa_status_t psa_crypto_driver_pake_get_peer(
|
||||
const psa_crypto_driver_pake_inputs_t *inputs,
|
||||
uint8_t *buffer, size_t buffer_size, size_t *buffer_length)
|
||||
uint8_t *peer_id, size_t peer_id_size, size_t *peer_id_length)
|
||||
{
|
||||
if (inputs->peer_len == 0) {
|
||||
return PSA_ERROR_BAD_STATE;
|
||||
}
|
||||
|
||||
if (buffer_size < inputs->peer_len) {
|
||||
if (peer_id_size < inputs->peer_len) {
|
||||
return PSA_ERROR_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
memcpy(buffer, inputs->peer, inputs->peer_len);
|
||||
*buffer_length = inputs->peer_len;
|
||||
memcpy(peer_id, inputs->peer, inputs->peer_len);
|
||||
*peer_id_length = inputs->peer_len;
|
||||
|
||||
return PSA_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1949,7 +1949,6 @@ void mbedtls_ssl_set_verify(mbedtls_ssl_context *ssl,
|
|||
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED)
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
/* The only two JPAKE user/peer identifiers supported for the time being. */
|
||||
static const uint8_t jpake_server_id[] = { 's', 'e', 'r', 'v', 'e', 'r' };
|
||||
static const uint8_t jpake_client_id[] = { 'c', 'l', 'i', 'e', 'n', 't' };
|
||||
|
||||
|
|
|
@ -1060,13 +1060,13 @@ exit:
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:PSA_WANT_ALG_JPAKE:PSA_ALG_SHA_256 */
|
||||
/* BEGIN_CASE depends_on:PSA_WANT_ALG_JPAKE */
|
||||
void pake_input_getters_user()
|
||||
{
|
||||
psa_pake_cipher_suite_t cipher_suite = psa_pake_cipher_suite_init();
|
||||
psa_pake_operation_t operation = psa_pake_operation_init();
|
||||
const uint8_t user[] = "server";
|
||||
const size_t user_len = strlen("server");
|
||||
const uint8_t user[] = { 's', 'e', 'r', 'v', 'e', 'r' };
|
||||
const size_t user_len = sizeof(user);
|
||||
uint8_t user_ret[20] = { 0 }; // max user length is 20 bytes
|
||||
size_t user_len_ret = 0;
|
||||
size_t buffer_len_ret = 0;
|
||||
|
@ -1118,13 +1118,13 @@ exit:
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:PSA_WANT_ALG_JPAKE:PSA_ALG_SHA_256 */
|
||||
/* BEGIN_CASE depends_on:PSA_WANT_ALG_JPAKE */
|
||||
void pake_input_getters_peer()
|
||||
{
|
||||
psa_pake_cipher_suite_t cipher_suite = psa_pake_cipher_suite_init();
|
||||
psa_pake_operation_t operation = psa_pake_operation_init();
|
||||
const uint8_t peer[] = "server";
|
||||
const size_t peer_len = strlen("server");
|
||||
const uint8_t peer[] = { 's', 'e', 'r', 'v', 'e', 'r' };
|
||||
const size_t peer_len = sizeof(peer);
|
||||
uint8_t peer_ret[20] = { 0 }; // max peer length is 20 bytes
|
||||
size_t peer_len_ret = 0;
|
||||
size_t buffer_len_ret = 0;
|
||||
|
|
Loading…
Reference in a new issue