diff --git a/include/psa/crypto.h b/include/psa/crypto.h index 515e65f3d..8059ab9e2 100644 --- a/include/psa/crypto.h +++ b/include/psa/crypto.h @@ -3122,6 +3122,15 @@ psa_status_t psa_generator_import_key(psa_key_slot_t key, */ psa_status_t psa_generator_abort(psa_crypto_generator_t *generator); +/** Use the maximum possible capacity for a generator. + * + * Use this value as the capacity argument when setting up a generator + * to indicate that the generator should have the maximum possible capacity. + * The value of the maximum possible capacity depends on the generator + * algorithm. + */ +#define PSA_GENERATOR_UNBRIDLED_CAPACITY ((size_t)(-1)) + /**@}*/ /** \defgroup derivation Key derivation diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 202552391..3c1cec930 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -3539,6 +3539,8 @@ static psa_status_t psa_key_derivation_internal( if( capacity <= max_capacity ) generator->capacity = capacity; + else if( capacity == PSA_GENERATOR_UNBRIDLED_CAPACITY ) + generator->capacity = max_capacity; else return( PSA_ERROR_INVALID_ARGUMENT );