00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef DST_PKCS11_H
00018 #define DST_PKCS11_H 1
00019 
00020 #include <isc/lang.h>
00021 #include <isc/log.h>
00022 #include <isc/result.h>
00023 
00024 ISC_LANG_BEGINDECLS
00025 
00026 isc_result_t
00027 dst__pkcs11_toresult(const char *funcname, const char *file, int line,
00028                      isc_result_t fallback, CK_RV rv);
00029 
00030 #define PK11_CALL(func, args, fallback) \
00031         ((void) (((rv = (func) args) == CKR_OK) || \
00032                  ((ret = dst__pkcs11_toresult(#func, __FILE__, __LINE__, \
00033                                               fallback, rv)), 0)))
00034 
00035 #define PK11_RET(func, args, fallback) \
00036         ((void) (((rv = (func) args) == CKR_OK) || \
00037                  ((ret = dst__pkcs11_toresult(#func, __FILE__, __LINE__, \
00038                                               fallback, rv)), 0)));     \
00039         if (rv != CKR_OK) goto err;
00040 
00041 ISC_LANG_ENDDECLS
00042 
00043 #endif