Function esp_idf_hal::sys::psa_pake_set_peer
source · pub unsafe extern "C" fn psa_pake_set_peer(
operation: *mut psa_pake_operation_s,
peer_id: *const u8,
peer_id_len: usize,
) -> i32
Expand description
Set the peer ID for a password-authenticated key exchange.
Call this function in addition to psa_pake_set_user() for PAKE algorithms that associate a user identifier with each side of the session. For PAKE algorithms that associate a single user identifier with the session, call psa_pake_set_user() only.
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 set the peer ID 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 peer ID hasn’t been set (psa_pake_set_peer() hasn’t been called yet). \param[in] peer_id The peer’s ID to authenticate. \param peer_id_len Size of the \p peer_id buffer in bytes.
\retval #PSA_SUCCESS Success. \retval #PSA_ERROR_INVALID_ARGUMENT \p peer_id is not valid for the \p operation’s algorithm and cipher suite. \retval #PSA_ERROR_NOT_SUPPORTED The algorithm doesn’t associate a second identity with the session. \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription \retval #PSA_ERROR_BAD_STATE Calling psa_pake_set_peer() is invalid with the \p operation’s algorithm, 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.