diff options
Diffstat (limited to 'include/xmlsec/private.h')
-rw-r--r-- | include/xmlsec/private.h | 121 |
1 files changed, 106 insertions, 15 deletions
diff --git a/include/xmlsec/private.h b/include/xmlsec/private.h index 0a9d74a0..f35690d9 100644 --- a/include/xmlsec/private.h +++ b/include/xmlsec/private.h @@ -1,4 +1,4 @@ -/** +/* * XML Security Library (http://www.aleksey.com/xmlsec). * * These are internal private declarations. You don't want to use this file @@ -16,10 +16,6 @@ #error "xmlsec/private.h file contains private xmlsec definitions and should not be used outside xmlsec or xmlsec-$crypto libraries" #endif /* XMLSEC_PRIVATE */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include <libxml/tree.h> #include <libxml/xmlIO.h> @@ -29,6 +25,19 @@ extern "C" { #include <xmlsec/keysmngr.h> #include <xmlsec/transforms.h> +#ifdef __GNUC__ +#ifdef HAVE_ANSIDECL_H +#include <ansidecl.h> +#endif +#endif + +#ifdef WIN32 +#include <windows.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ /***************************************************************************** * @@ -343,9 +352,12 @@ typedef int (*xmlSecCryptoAppKeyCertLoadMemoryMethod)(xmlSec * @keyDataX509GetKlass: the method to get pointer to X509 key data klass. * @keyDataRawX509CertGetKlass: the method to get pointer to raw X509 cert key data klass. * @x509StoreGetKlass: the method to get pointer to X509 key data store. - * @transformAes128CbcGetKlass: the method to get pointer to AES 128 encryption transform. - * @transformAes192CbcGetKlass: the method to get pointer to AES 192 encryption transform. - * @transformAes256CbcGetKlass: the method to get pointer to AES 256 encryption transform. + * @transformAes128CbcGetKlass: the method to get pointer to AES 128 CBC encryption transform. + * @transformAes192CbcGetKlass: the method to get pointer to AES 192 CBC encryption transform. + * @transformAes256CbcGetKlass: the method to get pointer to AES 256 CBC encryption transform. + * @transformAes128GcmGetKlass: the method to get pointer to AES 128 GCM encryption transform. + * @transformAes192GcmGetKlass: the method to get pointer to AES 192 GCM encryption transform. + * @transformAes256GcmGetKlass: the method to get pointer to AES 256 GCM encryption transform. * @transformKWAes128GetKlass: the method to get pointer to AES 128 key wrapper transform. * @transformKWAes192GetKlass: the method to get pointer to AES 192 key wrapper transform. * @transformKWAes256GetKlass: the method to get pointer to AES 256 key wrapper transform. @@ -431,6 +443,9 @@ struct _xmlSecCryptoDLFunctions { xmlSecCryptoTransformGetKlassMethod transformAes128CbcGetKlass; xmlSecCryptoTransformGetKlassMethod transformAes192CbcGetKlass; xmlSecCryptoTransformGetKlassMethod transformAes256CbcGetKlass; + xmlSecCryptoTransformGetKlassMethod transformAes128GcmGetKlass; + xmlSecCryptoTransformGetKlassMethod transformAes192GcmGetKlass; + xmlSecCryptoTransformGetKlassMethod transformAes256GcmGetKlass; xmlSecCryptoTransformGetKlassMethod transformKWAes128GetKlass; xmlSecCryptoTransformGetKlassMethod transformKWAes192GetKlass; xmlSecCryptoTransformGetKlassMethod transformKWAes256GetKlass; @@ -491,21 +506,97 @@ struct _xmlSecCryptoDLFunctions { void* cryptoAppDefaultPwdCallback; }; -#include <libxml/xmlstring.h> +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ +#ifdef __GNUC__ +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED +#endif +#else +#define ATTRIBUTE_UNUSED +#endif /** - * xmlSecStrPrintf: + * UNREFERENCED_PARAMETER: * - * Prints a string (see @xmlStrPrintf). + * Macro used to signal to MSVC unused function parameters */ -#define xmlSecStrPrintf xmlStrPrintf +#ifndef UNREFERENCED_PARAMETER +#define UNREFERENCED_PARAMETER(x) +#endif /* UNREFERENCED_PARAMETER */ + +/*********************************************************************** + * + * Helpers to convert from void* to function pointer, this silence + * gcc warning + * + * warning: ISO C forbids conversion of object pointer to function + * pointer type + * + * The workaround is to declare a union that does the conversion. This is + * guaranteed (ISO/IEC 9899:1990 "C89"/"C90") to match exactly. + * + ***********************************************************************/ + +/** + * XMLSEC_PTR_TO_FUNC_IMPL: + * @func_type: the function type. + * + * Macro declares helper functions to convert from "void *" pointer to + * function pointer. + */ +#define XMLSEC_PTR_TO_FUNC_IMPL(func_type) \ + union xmlSecPtrToFuncUnion_ ##func_type { \ + void *ptr; \ + func_type * func; \ + } ; \ + static func_type * xmlSecPtrToFunc_ ##func_type(void * ptr) { \ + union xmlSecPtrToFuncUnion_ ##func_type x; \ + x.ptr = ptr; \ + return (x.func); \ + } /** - * xmlSecStrVPrintf: + * XMLSEC_PTR_TO_FUNC: + * @func_type: the function type. + * @ptr: the "void*" pointer to be converted. * - * Prints a string (see @xmlStrVPrintf). + * Macro converts from "void*" pointer to "func_type" function pointer. */ -#define xmlSecStrVPrintf xmlStrVPrintf +#define XMLSEC_PTR_TO_FUNC(func_type, ptr) \ + xmlSecPtrToFunc_ ##func_type((ptr)) + +/** + * XMLSEC_FUNC_TO_PTR_IMPL: + * @func_type: the function type. + * + * Macro declares helper functions to convert from function pointer to + * "void *" pointer; + */ +#define XMLSEC_FUNC_TO_PTR_IMPL(func_type) \ + union xmlSecFuncToPtrUnion_ ##func_type { \ + void *ptr; \ + func_type * func; \ + } ; \ + static void * xmlSecFuncToPtr_ ##func_type(func_type * func) { \ + union xmlSecFuncToPtrUnion_ ##func_type x; \ + x.func = func; \ + return (x.ptr); \ + } + +/** + * XMLSEC_FUNC_TO_PTR: + * @func_type: the function type. + * @func: the "func_type" function pointer to be converted. + * + * Macro converts from "func_type" function pointer to "void*" pointer. + */ +#define XMLSEC_FUNC_TO_PTR(func_type, func) \ + xmlSecFuncToPtr_ ##func_type((func)) + #ifdef __cplusplus } |