diff --git a/.github/workflows/install_test.yml b/.github/workflows/install_test.yml
new file mode 100644
index 00000000..1ca42ed5
--- /dev/null
+++ b/.github/workflows/install_test.yml
@@ -0,0 +1,80 @@
+name: 'Check installable'
+
+on:
+ push:
+ branches: [ gisce ]
+ pull_request:
+ branches: [ gisce ]
+
+jobs:
+ check-package-installable:
+ strategy:
+ matrix:
+ python-version: [ "2.7.18", "3.11"]
+ os: [ ubuntu-latest, ubuntu-20.04, ubuntu-22.04 ]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Python 3
+ if: matrix.python-version == '3.11'
+ uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Install Python 2 on ubuntu 20
+ if: matrix.python-version == '2.7.18' && matrix.os == 'ubuntu-20.04'
+ run: |
+ sudo apt update
+ sudo apt install python2 python2-dev
+ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
+ sudo python2 get-pip.py
+ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
+ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
+ printf '1\n' | sudo update-alternatives --config python
+
+ - name: Install Python 2 on ubuntu >= 22
+ if: matrix.python-version == '2.7.18' && matrix.os == 'ubuntu-22.04'
+ run: |
+ sudo add-apt-repository ppa:deadsnakes/ppa -y
+ sudo apt update
+ sudo apt install python2 python2-dev python-pip
+ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
+ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
+ printf '1\n' | sudo update-alternatives --config python
+ cd /usr/bin
+ sudo ln -s /usr/bin/pip2 ./pip
+
+ - name: Install Python 2 on ubuntu latest
+ if: matrix.python-version == '2.7.18' && matrix.os == 'ubuntu-latest'
+ run: |
+ sudo apt update
+ sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev wget curl
+
+ wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
+ tar -xzf Python-2.7.18.tgz
+ cd Python-2.7.18
+ ./configure --enable-optimizations
+ make -j$(nproc)
+ sudo make altinstall
+ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
+ sudo python2.7 get-pip.py
+
+ sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python2.7 1
+ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
+ printf '1\n' | sudo update-alternatives --config python
+ cd ..
+ rm -rf Python-2.7.18 Python-2.7.18.tgz get-pip.py
+
+ - name: Set up virtual environment
+ run: |
+ python -m pip install --upgrade pip
+ pip install virtualenv
+ python -m virtualenv venv
+
+ - name: Install package
+ run: |
+ sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl opensc softhsm2 libengine-pkcs11-openssl
+ source venv/bin/activate
+ pip install --upgrade pip setuptools wheel build
+ pip install -e .
diff --git a/.github/workflows/macosx.yml b/.github/workflows/macosx.yml
deleted file mode 100644
index c8bfee95..00000000
--- a/.github/workflows/macosx.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-name: MacOS
-on: [push, pull_request]
-jobs:
- macosx:
- runs-on: macos-latest
- strategy:
- matrix:
- python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
- steps:
- - uses: actions/checkout@v1
- - name: Setup Python
- uses: actions/setup-python@v2
- with:
- python-version: ${{ matrix.python }}
- - name: Install build dependencies
- run: |
- pip install --upgrade pip setuptools wheel
- brew install libxml2 libxmlsec1 pkg-config
- - name: Build macosx_x86_64 wheel
- run: |
- python setup.py bdist_wheel
- - name: Set environment variables
- shell: bash
- run: |
- echo ::set-env name=PKGVER::$(python setup.py --version)
- echo ::set-env name=LLVM_PROFILE_FILE::"pyxmlsec-%p.profraw"
- - name: Install test dependencies
- env:
- CC: clang
- CFLAGS: "-fprofile-instr-generate -fcoverage-mapping"
- LDFLAGS: "-fprofile-instr-generate -fcoverage-mapping"
- run: |
- rm -rf build/
- pip install coverage --upgrade -r requirements-test.txt
- pip install --editable .
- - name: Run tests
- run: |
- coverage run -m pytest -v --color=yes
- - name: Report coverage to codecov
- run: |
- LIBFILE=$(python -c "import xmlsec; print(xmlsec.__file__)")
- /Library/Developer/CommandLineTools/usr/bin/llvm-profdata merge -sparse pyxmlsec-*.profraw -output pyxmlsec.profdata
- /Library/Developer/CommandLineTools/usr/bin/llvm-cov show ${LIBFILE} -instr-profile=pyxmlsec.profdata src > coverage.txt
- bash <(curl -s https://codecov.io/bash) -f coverage.txt
diff --git a/.github/workflows/manylinux2010.yml b/.github/workflows/manylinux2010.yml
deleted file mode 100644
index 637983d4..00000000
--- a/.github/workflows/manylinux2010.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-name: manylinux2010
-on: [push, pull_request]
-jobs:
- manylinux2010_x86_64:
- runs-on: ubuntu-latest
- container: quay.io/pypa/manylinux2010_x86_64
- strategy:
- matrix:
- python-abi: [cp27-cp27m, cp27-cp27mu, cp35-cp35m, cp36-cp36m, cp37-cp37m, cp38-cp38, cp39-cp39]
- steps:
- - uses: actions/checkout@v1
- - name: Install build dependencies
- run: |
- /opt/python/${{ matrix.python-abi }}/bin/pip install --upgrade pip setuptools wheel
- - name: Set environment variables
- shell: bash
- run: |
- echo ::set-env name=PKGVER::$(/opt/python/${{ matrix.python-abi }}/bin/python setup.py --version)
- - name: Build linux_x86_64 wheel
- env:
- PYXMLSEC_STATIC_DEPS: true
- run: |
- /opt/python/${{ matrix.python-abi }}/bin/python setup.py bdist_wheel
- - name: Label manylinux2010_x86_64 wheel
- run: |
- ls -la dist/
- auditwheel show dist/xmlsec-${PKGVER}-${{ matrix.python-abi }}-linux_x86_64.whl
- auditwheel repair dist/xmlsec-${PKGVER}-${{ matrix.python-abi }}-linux_x86_64.whl
- ls -l wheelhouse/
- auditwheel show wheelhouse/xmlsec-${PKGVER}-${{ matrix.python-abi }}-manylinux2010_x86_64.whl
- - name: Install test dependencies
- run: |
- /opt/python/${{ matrix.python-abi }}/bin/pip install --upgrade -r requirements-test.txt
- /opt/python/${{ matrix.python-abi }}/bin/pip install xmlsec --only-binary=xmlsec --no-index --find-links=wheelhouse/
- - name: Run tests
- run: |
- /opt/python/${{ matrix.python-abi }}/bin/pytest -v --color=yes
diff --git a/.github/workflows/sdist.yml b/.github/workflows/sdist.yml
deleted file mode 100644
index 5b5dac96..00000000
--- a/.github/workflows/sdist.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: sdist
-on: [push, pull_request]
-jobs:
- sdist:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v1
- - name: Set up Python 3.9
- uses: actions/setup-python@v2
- with:
- python-version: 3.9
- - name: Install build dependencies
- run: |
- pip install --upgrade pip setuptools wheel
- - name: Package source dist
- run: |
- python setup.py sdist
- - name: Install test dependencies
- env:
- PYXMLSEC_STATIC_DEPS: true
- run: |
- pip install --upgrade -r requirements-test.txt
- pip install dist/xmlsec-$(python setup.py --version).tar.gz
- - name: Run tests
- run: |
- pytest -v --color=yes
diff --git a/README.rst b/README.rst
index f01d467d..476f6ee3 100644
--- a/README.rst
+++ b/README.rst
@@ -1,215 +1,22 @@
python-xmlsec
=============
-.. image:: https://img.shields.io/pypi/v/xmlsec.svg?logo=python&logoColor=white
- :target: https://pypi.python.org/pypi/xmlsec
-.. image:: https://img.shields.io/travis/com/mehcode/python-xmlsec/master.svg?logo=travis&logoColor=white&label=Travis%20CI
- :target: https://travis-ci.org/mehcode/python-xmlsec
-.. image:: https://img.shields.io/appveyor/ci/hoefling/xmlsec/master.svg?logo=appveyor&logoColor=white&label=AppVeyor
- :target: https://ci.appveyor.com/project/hoefling/xmlsec
-.. image:: https://github.com/mehcode/python-xmlsec/workflows/manylinux2010/badge.svg
- :target: https://github.com/mehcode/python-xmlsec/actions?query=workflow%3A%22manylinux2010%22
-.. image:: https://github.com/mehcode/python-xmlsec/workflows/MacOS/badge.svg
- :target: https://github.com/mehcode/python-xmlsec/actions?query=workflow%3A%22MacOS%22
-.. image:: https://codecov.io/gh/mehcode/python-xmlsec/branch/master/graph/badge.svg
- :target: https://codecov.io/gh/mehcode/python-xmlsec
-.. image:: https://img.shields.io/readthedocs/xmlsec/latest?logo=read-the-docs
- :target: https://xmlsec.readthedocs.io/en/latest/?badge=latest
- :alt: Documentation Status
-
-Python bindings for the `XML Security Library `_.
-
-Documentation
-*************
-
-A documentation for ``xmlsec`` can be found at `xmlsec.readthedocs.io `_.
-
-Usage
-*****
-
-Check the `examples `_ section in the documentation to see various examples of signing and verifying using the library.
-
-Requirements
-************
-- ``libxml2 >= 2.9.1``
-- ``libxmlsec1 >= 1.2.18``
-
-Install
-*******
-
-``xmlsec`` is available on PyPI:
-
-.. code-block:: bash
-
- pip install xmlsec
-
-Depending on your OS, you may need to install the required native
-libraries first:
-
-Linux (Debian)
-^^^^^^^^^^^^^^
-
-.. code-block:: bash
-
- apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl
-
-
-Note: There is no required version of LibXML2 for Ubuntu Precise,
-so you need to download and install it manually.
-
-.. code-block:: bash
-
- wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz
- tar -xvf libxml2-2.9.1.tar.gz
- cd libxml2-2.9.1
- ./configure && make && make install
-
-
-Linux (CentOS)
-^^^^^^^^^^^^^^
-
-.. code-block:: bash
-
- yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
-
-
-Linux (Fedora)
-^^^^^^^^^^^^^^
-
-.. code-block:: bash
-
- dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
-
-
-Mac
-^^^
-
-.. code-block:: bash
-
- brew install libxml2 libxmlsec1 pkg-config
-
-
-Alpine
-^^^^^^
-
-.. code-block:: bash
-
- apk add build-base libressl libffi-dev libressl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec
-
-
-Troubleshooting
-***************
-
-Mac
-^^^
-
-If you get any fatal errors about missing ``.h`` files, update your
-``C_INCLUDE_PATH`` environment variable to include the appropriate
-files from the ``libxml2`` and ``libxmlsec1`` libraries.
-
-
-Windows
-^^^^^^^
-
-Starting with 1.3.7, prebuilt wheels are available for Windows,
-so running ``pip install xmlsec`` should suffice. If you want
-to build from source:
-
-#. Configure build environment, see `wiki.python.org `_ for more details.
-
-#. Install from source dist:
-
- .. code-block:: bash
-
- pip install xmlsec --no-binary=xmlsec
-
-
-Building from source
-********************
-
-#. Clone the ``xmlsec`` source code repository to your local computer.
-
- .. code-block:: bash
-
- git clone https://github.com/mehcode/python-xmlsec.git
-
-#. Change into the ``python-xmlsec`` root directory.
-
- .. code-block:: bash
-
- cd /path/to/xmlsec
-
-
-#. Install the project and all its dependencies using ``pip``.
-
- .. code-block:: bash
-
- pip install .
-
-
-Contributing
-************
-
-Setting up your environment
+Gisce tests (Ubuntu 20, 22 and latest / python 2.7 and 3.11)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#. Follow steps 1 and 2 of the `manual installation instructions <#building-from-source>`_.
-
+.. image:: https://github.com/gisce/python-xmlsec/actions/workflows/install_test.yml/badge.svg?logo=python&logoColor=white
+ :target: https://github.com/gisce/python-xmlsec/actions/workflows/install_test.yml
-#. Initialize a virtual environment to develop in.
- This is done so as to ensure every contributor is working with
- close-to-identicial versions of packages.
- .. code-block:: bash
-
- mkvirtualenv xmlsec
-
- The ``mkvirtualenv`` command is available from ``virtualenvwrapper`` package which can be installed by following `link `_.
-
-#. Activate the created virtual environment:
-
- .. code-block:: bash
-
- workon xmlsec
-
-#. Install ``xmlsec`` in development mode with testing enabled.
- This will download all dependencies required for running the unit tests.
-
- .. code-block:: bash
-
- pip install -r requirements-test.txt
- pip install -e "."
-
-
-Running the test suite
-^^^^^^^^^^^^^^^^^^^^^^
-
-#. `Set up your environment <#setting-up-your-environment>`_.
+Installation
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#. Run the unit tests.
+#. Install ``xmlsec`` patched version.
.. code-block:: bash
- pytest tests
-
-#. Tests configuration
-
- Env variable ``PYXMLSEC_TEST_ITERATIONS`` specifies number of
- test iterations to detect memory leaks.
-
-Reporting an issue
-^^^^^^^^^^^^^^^^^^
-
-Please attach the output of following information:
-
-* version of ``xmlsec``
-* version of ``libxmlsec1``
-* version of ``libxml2``
-* output from the command
-
- .. code-block:: bash
+ pip install git+https://github.com/gisce/python-xmlsec.git
- pkg-config --cflags xmlsec1
License
*******
diff --git a/src/constants.c b/src/constants.c
index 68f086e9..451858fd 100644
--- a/src/constants.c
+++ b/src/constants.c
@@ -452,7 +452,8 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
#ifndef XMLSEC_NO_DSA
PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataDsa, "DSA")
#endif
-#if XMLSEC_VERSION_HEX > 306
+#if XMLSEC_VERSION_HEX > 0x10212
+ // from version 1.2.19
PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataEcdsa, "ECDSA")
#endif
PYXMLSEC_ADD_KEYDATA_CONSTANT(KeyDataHmac, "HMAC")
@@ -502,7 +503,8 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformDsaSha1, "DSA_SHA1");
#endif
-#if XMLSEC_VERSION_HEX > 306
+#if XMLSEC_VERSION_HEX > 0x10212
+ // from version 1.2.19
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha1, "ECDSA_SHA1");
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha224, "ECDSA_SHA224");
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha256, "ECDSA_SHA256");
@@ -510,7 +512,10 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformEcdsaSha512, "ECDSA_SHA512");
#endif
+#ifndef XMLSEC_NO_MD5
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacMd5, "HMAC_MD5");
+#endif
+
#ifndef XMLSEC_NO_RIPEMD160
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacRipemd160, "HMAC_RIPEMD160");
#endif
@@ -520,7 +525,10 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacSha384, "HMAC_SHA384");
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformHmacSha512, "HMAC_SHA512");
+#ifndef XMLSEC_NO_MD5
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaMd5, "RSA_MD5");
+#endif
+
#ifndef XMLSEC_NO_RIPEMD160
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaRipemd160, "RSA_RIPEMD160");
#endif
@@ -532,7 +540,10 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaPkcs1, "RSA_PKCS1");
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRsaOaep, "RSA_OAEP");
+#ifndef XMLSEC_NO_MD5
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformMd5, "MD5");
+#endif
+
#ifndef XMLSEC_NO_RIPEMD160
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformRipemd160, "RIPEMD160");
#endif
@@ -543,7 +554,8 @@ int PyXmlSec_ConstantsModule_Init(PyObject* package) {
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformSha384, "SHA384");
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformSha512, "SHA512");
-#if XMLSEC_VERSION_HEX > 315
+#if XMLSEC_VERSION_HEX > 0x1021B
+ // from version 1.2.28
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes128Gcm, "AES128_GCM");
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes192Gcm, "AES192_GCM");
PYXMLSEC_ADD_TRANSFORM_CONSTANT(TransformAes256Gcm, "AES256_GCM");
diff --git a/src/enc.c b/src/enc.c
index aaf35ae5..b994f982 100644
--- a/src/enc.c
+++ b/src/enc.c
@@ -192,7 +192,7 @@ static void PyXmlSec_ClearReplacedNodes(xmlSecEncCtxPtr ctx, PyXmlSec_LxmlDocume
PYXMLSEC_DEBUGF("clear replaced node %p", n);
nn = n->next;
// if n has references, it will not be deleted
- elem = PyXmlSec_elementFactory(doc, n);
+ elem = (PyXmlSec_LxmlElementPtr*)PyXmlSec_elementFactory(doc, n);
if (NULL == elem)
xmlFreeNode(n);
else
diff --git a/src/exception.c b/src/exception.c
index 2ca5ab57..821570f3 100644
--- a/src/exception.c
+++ b/src/exception.c
@@ -22,8 +22,12 @@
PyObject* PyXmlSec_Error;
PyObject* PyXmlSec_InternalError;
PyObject* PyXmlSec_VerificationError;
-
+//#if PY_MINOR_VERSION >= 7
+#if PY_MINOR_VERSION >= 7 && PY_MAJOR_VERSION > 2
+static Py_tss_t PyXmlSec_LastErrorKey;
+#else
static int PyXmlSec_LastErrorKey = 0;
+#endif
static int PyXmlSec_PrintErrorMessage = 0;
@@ -71,16 +75,28 @@ static PyXmlSec_ErrorHolder* PyXmlSec_ExchangeLastError(PyXmlSec_ErrorHolder* e)
PyXmlSec_ErrorHolder* v;
int r;
+// #if PY_MINOR_VERSION >= 7
+ #if PY_MINOR_VERSION >= 7 && PY_MAJOR_VERSION > 2
+ if (PyThread_tss_is_created(&PyXmlSec_LastErrorKey) == 0) {
+ #else
if (PyXmlSec_LastErrorKey == 0) {
+ #endif
PYXMLSEC_DEBUG("WARNING: There is no error key.");
PyXmlSec_ErrorHolderFree(e);
return NULL;
}
// get_key_value and set_key_value are gil free
+// #if PY_MINOR_VERSION >= 7
+ #if PY_MINOR_VERSION >= 7 && PY_MAJOR_VERSION > 2
+ v = (PyXmlSec_ErrorHolder*)PyThread_tss_get(&PyXmlSec_LastErrorKey);
+ //PyThread_tss_delete(&PyXmlSec_LastErrorKey);
+ r = PyThread_tss_set(&PyXmlSec_LastErrorKey, (void*)e);
+ #else
v = (PyXmlSec_ErrorHolder*)PyThread_get_key_value(PyXmlSec_LastErrorKey);
PyThread_delete_key_value(PyXmlSec_LastErrorKey);
r = PyThread_set_key_value(PyXmlSec_LastErrorKey, (void*)e);
+ #endif
PYXMLSEC_DEBUGF("set_key_value returns %d", r);
return v;
}
@@ -165,6 +181,17 @@ void PyXmlSecEnableDebugTrace(int v) {
PyXmlSec_PrintErrorMessage = v;
}
+void PyXmlSec_InstallErrorCallback() {
+// #if PY_MINOR_VERSION >= 7
+ #if PY_MINOR_VERSION >= 7 && PY_MAJOR_VERSION > 2
+ if (PyThread_tss_is_created(&PyXmlSec_LastErrorKey) != 0) {
+ #else
+ if (PyXmlSec_LastErrorKey != 0) {
+ #endif
+ xmlSecErrorsSetCallback(PyXmlSec_ErrorCallback);
+ }
+}
+
// initializes errors module
int PyXmlSec_ExceptionsModule_Init(PyObject* package) {
PyXmlSec_Error = NULL;
@@ -184,10 +211,15 @@ int PyXmlSec_ExceptionsModule_Init(PyObject* package) {
if (PyModule_AddObject(package, "InternalError", PyXmlSec_InternalError) < 0) goto ON_FAIL;
if (PyModule_AddObject(package, "VerificationError", PyXmlSec_VerificationError) < 0) goto ON_FAIL;
- PyXmlSec_LastErrorKey = PyThread_create_key();
- if (PyXmlSec_LastErrorKey != 0) {
- xmlSecErrorsSetCallback(&PyXmlSec_ErrorCallback);
+// #if PY_MINOR_VERSION >= 7
+ #if PY_MINOR_VERSION >= 7 && PY_MAJOR_VERSION > 2
+ if (PyThread_tss_create(&PyXmlSec_LastErrorKey) == 0) {
+ PyXmlSec_InstallErrorCallback();
}
+ #else
+ PyXmlSec_LastErrorKey = PyThread_create_key();
+ PyXmlSec_InstallErrorCallback();
+ #endif
return 0;
diff --git a/src/keys.c b/src/keys.c
index 357cc9c7..8859e596 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -453,7 +453,7 @@ static int PyXmlSec_KeyNameSet(PyObject* self, PyObject* value, void* closure) {
}
if (value == NULL) {
- if (xmlSecKeySetName(key->handle, value) < 0) {
+ if (xmlSecKeySetName(key->handle, NULL) < 0) {
PyXmlSec_SetLastError("cannot delete name");
return -1;
}
diff --git a/src/main.c b/src/main.c
index 59989529..c097d7f5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,7 +27,7 @@ static int free_mode = _PYXMLSEC_FREE_NONE;
#ifndef XMLSEC_NO_CRYPTO_DYNAMIC_LOADING
static const xmlChar* PyXmlSec_GetCryptoLibName() {
-#if XMLSEC_VERSION_HEX > 308
+#if XMLSEC_VERSION_HEX > 0x10214
// xmlSecGetDefaultCrypto was introduced in version 1.2.21
const xmlChar* cryptoLib = xmlSecGetDefaultCrypto();
#else
diff --git a/src/platform.h b/src/platform.h
index 795062f2..01312a11 100644
--- a/src/platform.h
+++ b/src/platform.h
@@ -19,11 +19,11 @@
#include
#endif /* MS_WIN32 */
-#define XMLSEC_VERSION_HEX ((XMLSEC_VERSION_MAJOR << 8) | (XMLSEC_VERSION_MINOR << 4) | (XMLSEC_VERSION_SUBMINOR))
+#define XMLSEC_VERSION_HEX ((XMLSEC_VERSION_MAJOR << 16) | (XMLSEC_VERSION_MINOR << 8) | (XMLSEC_VERSION_SUBMINOR))
// XKMS support was removed in version 1.2.21
// https://mail.gnome.org/archives/commits-list/2015-February/msg10555.html
-#if XMLSEC_VERSION_HEX > 0x134
+#if XMLSEC_VERSION_HEX > 0x10214
#define XMLSEC_NO_XKMS 1
#endif