diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-10-26 19:36:33 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-10-27 09:38:37 +0200 |
commit | 19e998aa98d966cffca98bed9408d5758d91d9be (patch) | |
tree | ca847e1e091a456adb0cdddca471bcb5e7162504 /xmlsecurity/source | |
parent | dc85be45c7e2efc0512e823d08e2edba0d4c0e76 (diff) |
Update libxmlsec to 1.2.35
- backport 2 patches to fix the build
- replace calls to the now deprecated xmlSecBase64Decode()
Change-Id: Ib3254002fff5e49bb6dd4eb1bf62e7d2ee7be83e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141865
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'xmlsecurity/source')
4 files changed, 16 insertions, 8 deletions
diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx index da2310765315..dcddca194762 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx @@ -162,7 +162,9 @@ Reference< XCertificate > SecurityEnvironmentGpg::getCertificate( const OUString //xmlChar* pSignatureValue=xmlNodeGetContent(cur); OString ostr = OUStringToOString( keyId , RTL_TEXTENCODING_UTF8 ); const xmlChar* strKeyId = reinterpret_cast<const xmlChar*>(ostr.getStr()); - if(xmlSecBase64Decode(strKeyId, const_cast<xmlSecByte*>(strKeyId), xmlStrlen(strKeyId)) < 0) + xmlSecSize nWritten; + int nRet = xmlSecBase64Decode_ex(strKeyId, const_cast<xmlSecByte*>(strKeyId), xmlStrlen(strKeyId), &nWritten); + if(nRet < 0) throw RuntimeException("Base64 decode failed"); m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx index 3b4e138aebee..dd7a4a14873f 100644 --- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx +++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx @@ -190,7 +190,9 @@ SAL_CALL XMLSignature_GpgImpl::generate( rCtx.setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); GpgME::Error err; xmlChar* pKey=xmlNodeGetContent(cur); - if(xmlSecBase64Decode(pKey, reinterpret_cast<xmlSecByte*>(pKey), xmlStrlen(pKey)) < 0) + xmlSecSize nWritten; + int nRet = xmlSecBase64Decode_ex(pKey, reinterpret_cast<xmlSecByte*>(pKey), xmlStrlen(pKey), &nWritten); + if(nRet < 0) throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); if( rCtx.addSigningKey( rCtx.key( @@ -358,8 +360,9 @@ SAL_CALL XMLSignature_GpgImpl::validate( if(!xmlSecCheckNodeName(cur, xmlSecNodeSignatureValue, xmlSecDSigNs)) throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); xmlChar* pSignatureValue=xmlNodeGetContent(cur); - int nSigSize = xmlSecBase64Decode(pSignatureValue, reinterpret_cast<xmlSecByte*>(pSignatureValue), xmlStrlen(pSignatureValue)); - if( nSigSize < 0) + xmlSecSize nSigSize; + int nRet = xmlSecBase64Decode_ex(pSignatureValue, reinterpret_cast<xmlSecByte*>(pSignatureValue), xmlStrlen(pSignatureValue), &nSigSize); + if( nRet < 0) throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); GpgME::Data data_signature( @@ -410,8 +413,9 @@ SAL_CALL XMLSignature_GpgImpl::validate( // got a key packet, import & re-validate xmlChar* pKeyPacket=xmlNodeGetContent(cur); - int nKeyLen = xmlSecBase64Decode(pKeyPacket, reinterpret_cast<xmlSecByte*>(pKeyPacket), xmlStrlen(pKeyPacket)); - if( nKeyLen < 0) + xmlSecSize nKeyLen; + nRet = xmlSecBase64Decode_ex(pKeyPacket, reinterpret_cast<xmlSecByte*>(pKeyPacket), xmlStrlen(pKeyPacket), &nKeyLen); + if( nRet < 0) throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); GpgME::Data data_key( diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index f198f839f76b..80ddff58c624 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -706,7 +706,8 @@ uno::Reference< XCertificate > SecurityEnvironment_MSCryptImpl::createCertificat xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), static_cast<int>(oscert.getLength()) ) ; - xmlSecSize certSize = xmlSecBase64Decode( chCert, chCert, xmlStrlen( chCert ) ) ; + xmlSecSize certSize; + xmlSecBase64Decode_ex( chCert, chCert, xmlStrlen( chCert ), &certSize ) ; uno::Sequence< sal_Int8 > rawCert( certSize ) ; auto rawCertRange = asNonConstRange(rawCert); diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index f6c35257f80f..97f2ce3b4ea7 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -474,7 +474,8 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromAsci { OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ; xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), static_cast<int>(oscert.getLength()) ) ; - int certSize = xmlSecBase64Decode( chCert, reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ) ) ; + xmlSecSize certSize; + xmlSecBase64Decode_ex( chCert, reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ), &certSize ) ; if (certSize == 0) return nullptr; |