PSA_ERROR_BAD_STATE macro
The requested action cannot be performed in the current state. Multipart operations return this error when one of the functions is called out of sequence. Refer to the function descriptions for permitted sequencing of functions. Implementations shall not return this error code to indicate that a key either exists or not, but shall instead return #PSA_ERROR_ALREADY_EXISTS or #PSA_ERROR_DOES_NOT_EXIST as applicable. Implementations shall not return this error code to indicate that a key identifier is invalid, but shall return #PSA_ERROR_INVALID_HANDLE