Vladimir Kotal wrote: > ... > >> 2) What is the performance impact of all this extra checking ? >> No performance regression is acceptable for kcf here. > > Let's see: for each operation the new function will perform mech_info > lookup via KCF_TO_PROV_MECHINFO macro which is direct access to an > array. Then it will do a integer comparison and some arithmetics to > see the units and finally it will do 2 integer comparisons to see if > the key length fits the interval. > > I'd say other than the function call performance impact is negligible > (see how kcf_get_hardware_provider() works, e.g.).
I recommend running a micro benchmark to measure the performance impact. I will send you the the ones I have. One thing to note is that KCF already provides the same functionality as this fix because it retries the operation on another provider (See IS_RECOVERABLE() macro) when it gets CRYPTO_KEY_SIZE_RANGE error. The only reason for this fix then is to avoid the overhead of calling a provider which is going to return that error. FWIW, there are no kernel clients that cause this error to be returned. This makes it all the more important to check for any performance impact. Regards, -Krishna > > That said, I can easily convert the function to a macro of make it > inline. >