PolarSSL is now part of ARM Official announcement and rebranded as mbed TLS.

Debug optimisation


Feb 4, 2013 08:59
Zdenek OGAR Skalak

Current implementation of f_dbg() has prototype of void (*f_dbg)(void *, int, const char *) and user can filter out the output by the second argument level.

But the implementation of debug_print_buf(), debug_print_mpi() and debug_print_crt() is a bit inefficient, because although the user don't want debug at this level, the f_dbg() is called for all the stuff.

Should we change the prototype to int (*f_dbg)(void *, int, const char *) to allow to notify the caller, that we don't want debug at this level, and to bail out earlier, after the header? And we could even allow to call it with the last argument being NULL, to check the current user debug level.

 
Feb 12, 2013 10:21
Paul Bakker

I agree with you that this can be improved.

We've been looking into some similar changes.. For the 1.2 branch we don't want to incur such an API change (as it requires people to update their existing code).. For the upcoming 1.3 branch this (or something to the same effect) is under consideration.