# XML Security Init/Shutdown **API Group:** `xmlsec_core_helpers` Library initialisation, shutdown, configuration, and other helper functions and macros. Utility functions. Various utility functions. ## Macros ### `XMLSEC_DEPRECATED` *Defined as:* `__attribute__((deprecated))` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L32) Marks function as deprecated. --- ### `XMLSEC_SIZE_T_FMT` *Defined as:* `"%zu"` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L66) The printf format specifier for size_t. The only reason we need this is that MinGW doesn't recognize "%zu" despite the fact that MSVC runtime supports it for 10+ years. --- ### `XMLSEC_SIZE_MIN` *Defined as:* `((xmlSecSize)0)` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L77) The minimum value of `xmlSecSize` (0). --- ### `XMLSEC_SIZE_MAX` *Defined as:* `SIZE_MAX` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L81) The maximum value of `xmlSecSize`. --- ### `XMLSEC_SIZE_FMT` *Defined as:* `XMLSEC_SIZE_T_FMT` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L85) The printf format specifier for `xmlSecSize`. --- ### `xmlSecCheckVersionExact` *Defined as:* `xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionExactMatch)` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L134) Checks if loaded library version exactly matches. Macro. Returns 1 if the loaded xmlsec library version exactly matches the one used to compile the caller, 0 if it does not or a negative value if an error occurs. --- ### `xmlSecCheckVersion` *Defined as:* `xmlSecCheckVersionExt(XMLSEC_VERSION_MAJOR, XMLSEC_VERSION_MINOR, XMLSEC_VERSION_SUBMINOR, xmlSecCheckVersionABICompatible)` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L143) Checks if loaded library version is ABI compatible. Macro. Returns 1 if the loaded xmlsec library version ABI compatible with the one used to compile the caller, 0 if it does not or a negative value if an error occurs. --- ## Typedefs ### `xmlSecPtr` ```c typedef void* xmlSecPtr; ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L53) Void pointer. --- ### `xmlSecSize` ```c typedef size_t xmlSecSize; ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L72) Size of something. --- ### `xmlSecByte` ```c typedef unsigned char xmlSecByte; ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L90) One byte. --- ## Enumerations ### `xmlSecCheckVersionMode` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L149) The xmlsec library version mode. | Value | Initializer | Description | |-------|-------------|-------------| | `xmlSecCheckVersionExactMatch` | `= 0` | | | `xmlSecCheckVersionABICompatible` | `` | | --- ## Functions ### `xmlSecInit` ```c int xmlSecInit(void); ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L114) Initializes XML Security Library. Initializes XML Security Library. The depended libraries (LibXML and LibXSLT) must be initialized before. **Returns:** 0 on success or a negative value otherwise. --- ### `xmlSecShutdown` ```c int xmlSecShutdown(void); ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L115) Clean ups the XML Security Library. **Returns:** 0 on success or a negative value otherwise. --- ### `xmlSecGetDefaultCrypto` ```c const xmlChar * xmlSecGetDefaultCrypto(void); ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L116) Gets the default crypto engine for the XML Security Library. Gets the default crypto engine ("openssl", "nss", etc.) for the XML Security Library. **Returns:** the default crypto engine ("openssl", "nss", etc.). --- ### `xmlSecSetExternalEntityLoader` ```c void xmlSecSetExternalEntityLoader(xmlExternalEntityLoader entityLoader); ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L118) Wrapper for xmlSetExternalEntityLoader. **Parameters:** - `entityLoader` — the new entity resolver function, or NULL to restore libxml2's default handler --- ### `xmlSecStrlen` ```c xmlSecSize xmlSecStrlen(const xmlChar *str); ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L119) Calculates the length of the string. **Parameters:** - `str` — the string. **Returns:** the length of the string. --- ### `xmlSecCheckVersionExt` ```c int xmlSecCheckVersionExt(int major, int minor, int subminor, xmlSecCheckVersionMode mode); ``` *Source:* [include/xmlsec/xmlsec.h](https://github.com/lsh123/xmlsec/blob/1.3.11/include/xmlsec/xmlsec.h#L154) Checks if the loaded version of xmlsec library could be used. **Parameters:** - `major` — the major version number. - `minor` — the minor version number. - `subminor` — the subminor version number. - `mode` — the version check mode. **Returns:** 1 if the loaded xmlsec library version is OK to use 0 if it is not or a negative value if an error occurs. ---