Let's say I'm using several crypto functions from a 3rd party lib and those crypto functions should never fail because my code, and not a user, is sending all the arguments (buffers, sizes, etc..) so if the function fails it's due to some "internal error". Let's say I have an rsa function and a hash function, my question is:
If those functions fail, should my code return
internal_error error code for both failures? Or should it return
internal_error reveals that an internal error and no more so it's harder to debug if my code can return
internal_error from several places in one function.
On the other hand, returning a specific error code for each type of failure makes it easier to debug, but also reveals more information to the user.
Which practice is better?
Does returning specific internal error codes can help attackers in their penetrations attempts?
EDIT: This is an embedded systems so we are cheap on logs. Since this error should not occur (it's not dependent on input or something) we usually don't log those errors.