diff options
Diffstat (limited to 'src/nss/globals.h')
-rw-r--r-- | src/nss/globals.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/nss/globals.h b/src/nss/globals.h index 065c3e8f..c3dec2d8 100644 --- a/src/nss/globals.h +++ b/src/nss/globals.h @@ -21,4 +21,48 @@ #define IN_XMLSEC_CRYPTO #define XMLSEC_PRIVATE +/* Include common error helper macros. */ +#include "../errors_helpers.h" + +/** + * xmlSecNssError: + * @errorFunction: the failed function name. + * @errorObject: the error specific error object (e.g. transform, key data, etc). + * + * Macro. The XMLSec library macro for reporting NSS crypro errors. + */ +#define xmlSecNssError(errorFunction, errorObject) \ + { \ + PRInt32 error_code = PR_GetError(); \ + xmlSecError(XMLSEC_ERRORS_HERE, \ + (const char*)(errorObject), \ + (errorFunction), \ + XMLSEC_ERRORS_R_CRYPTO_FAILED, \ + "NSS error: %ld", \ + (long int)error_code \ + ); \ + } + +/** + * xmlSecNssError2: + * @errorFunction: the failed function name. + * @errorObject: the error specific error object (e.g. transform, key data, etc). + * @msg: the extra message. + * @param: the extra message param. + * + * Macro. The XMLSec library macro for reporting NSS crypro errors. + */ +#define xmlSecNssError2(errorFunction, errorObject, msg, param) \ + { \ + PRInt32 error_code = PR_GetError(); \ + xmlSecError(XMLSEC_ERRORS_HERE, \ + (const char*)(errorObject), \ + (errorFunction), \ + XMLSEC_ERRORS_R_CRYPTO_FAILED, \ + msg "; NSS error: %ld", \ + (param), \ + (long int)error_code \ + ); \ + } + #endif /* ! __XMLSEC_GLOBALS_H__ */ |