pub unsafe extern "C" fn psa_interruptible_set_max_ops(max_ops: u32)
Expand description

\brief Set the maximum number of ops allowed to be executed by an interruptible function in a single call.

\warning This is a beta API, and thus subject to change at any point. It is not bound by the usual interface stability promises.

\note The time taken to execute a single op is implementation specific and depends on software, hardware, the algorithm, key type and curve chosen. Even within a single operation, successive ops can take differing amounts of time. The only guarantee is that lower values for \p max_ops means functions will block for a lesser maximum amount of time. The functions \c psa_sign_interruptible_get_num_ops() and \c psa_verify_interruptible_get_num_ops() are provided to help with tuning this value.

\note This value defaults to #PSA_INTERRUPTIBLE_MAX_OPS_UNLIMITED, which means the whole operation will be done in one go, regardless of the number of ops required.

\note If more ops are needed to complete a computation, #PSA_OPERATION_INCOMPLETE will be returned by the function performing the computation. It is then the caller’s responsibility to either call again with the same operation context until it returns 0 or an error code; or to call the relevant abort function if the answer is no longer required.

\note The interpretation of \p max_ops is also implementation defined. On a hard real time system, this can indicate a hard deadline, as a real-time system needs a guarantee of not spending more than X time, however care must be taken in such an implementation to avoid the situation whereby calls just return, not being able to do any actual work within the allotted time. On a non-real-time system, the implementation can be more relaxed, but again whether this number should be interpreted as as hard or soft limit or even whether a less than or equals as regards to ops executed in a single call is implementation defined.

\note For keys in local storage when no accelerator driver applies, please see also the documentation for \c mbedtls_ecp_set_max_ops(), which is the internal implementation in these cases.

\warning With implementations that interpret this number as a hard limit, setting this number too small may result in an infinite loop, whereby each call results in immediate return with no ops done (as there is not enough time to execute any), and thus no result will ever be achieved.

\note This only applies to functions whose documentation mentions they may return #PSA_OPERATION_INCOMPLETE.

\param max_ops The maximum number of ops to be executed in a single call. This can be a number from 0 to #PSA_INTERRUPTIBLE_MAX_OPS_UNLIMITED, where 0 is the least amount of work done per call.