Function esp_idf_svc::hal::sys::psa_pake_set_role

source ·
pub unsafe extern "C" fn psa_pake_set_role(
    operation: *mut psa_pake_operation_s,
    role: u8,
) -> i32
Expand description

Set the application role for a password-authenticated key exchange.

Not all PAKE algorithms need to differentiate the communicating entities. It is optional to call this function for PAKEs that don’t require a role to be specified. For such PAKEs the application role parameter is ignored, or #PSA_PAKE_ROLE_NONE can be passed as \c role.

Refer to the documentation of individual PAKE algorithm types (PSA_ALG_XXX values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true) for more information.

\param[in,out] operation The operation object to specify the application’s role for. It must have been set up by psa_pake_setup() and not yet in use (neither psa_pake_output() nor psa_pake_input() has been called yet). It must be on operation for which the application’s role hasn’t been specified (psa_pake_set_role() hasn’t been called yet). \param role A value of type ::psa_pake_role_t indicating the application’s role in the PAKE the algorithm that is being set up. For more information see the documentation of \c PSA_PAKE_ROLE_XXX constants.

\retval #PSA_SUCCESS Success. \retval #PSA_ERROR_INVALID_ARGUMENT The \p role is not a valid PAKE role in the \p operation’s algorithm. \retval #PSA_ERROR_NOT_SUPPORTED The \p role for this algorithm is not supported or is not valid. \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription \retval #PSA_ERROR_BAD_STATE The operation state is not valid, or the library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.