Kaydet (Commit) 27beb321 authored tarafından Miklos Vajna's avatar Miklos Vajna

xmlsecurity: stop linking to libxmlsec's mscrypto backend

This was only useful when the mscrypto to mscng porting was in progress.

Change-Id: I5a062cae744489e5ad311ab6b531d00ea21f4e0a
Reviewed-on: https://gerrit.libreoffice.org/57699
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 99a74aaf
......@@ -90,7 +90,6 @@ $(eval $(call gb_Library_add_defs,xsec_xmlsec,\
))
$(eval $(call gb_Library_add_libs,xsec_xmlsec,\
$(call gb_UnpackedTarball_get_dir,xmlsec)/win32/binaries/libxmlsec-mscrypto.lib \
$(call gb_UnpackedTarball_get_dir,xmlsec)/win32/binaries/libxmlsec-mscng.lib \
$(call gb_UnpackedTarball_get_dir,xmlsec)/win32/binaries/libxmlsec.lib \
))
......
......@@ -24,9 +24,6 @@
#include <xmlsec/transforms.h>
#include <xmlsec/errors.h>
#include <xmlsec/mscrypto/crypto.h>
#include <xmlsec/mscrypto/keysstore.h>
#include <xmlsec/mscrypto/x509.h>
#include <xmlsec/mscng/crypto.h>
#include <xmlsec/mscng/keysstore.h>
#include <xmlsec/mscng/x509.h>
......@@ -47,10 +44,7 @@ xmlSecKeysMngrPtr MSCryptoAppliedKeysMngrCreate()
xmlSecKeysMngrPtr keyMngr = nullptr ;
xmlSecKeyStorePtr keyStore = nullptr ;
if (!svl::crypto::isMSCng())
keyStore = xmlSecKeyStoreCreate(xmlSecMSCryptoKeysStoreId) ;
else
keyStore = xmlSecKeyStoreCreate(xmlSecMSCngKeysStoreId);
keyStore = xmlSecKeyStoreCreate(xmlSecMSCngKeysStoreId);
if (keyStore == nullptr)
{
xmlSecError(XMLSEC_ERRORS_HERE,
......@@ -102,33 +96,16 @@ xmlSecKeysMngrPtr MSCryptoAppliedKeysMngrCreate()
/*-
* Initialize crypto library specific data in keys manager
*/
if (!svl::crypto::isMSCng())
if (xmlSecMSCngKeysMngrInit(keyMngr) < 0)
{
if (xmlSecMSCryptoKeysMngrInit(keyMngr) < 0)
{
xmlSecError(XMLSEC_ERRORS_HERE,
nullptr,
"xmlSecMSCryptoKeysMngrInit",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE) ;
xmlSecKeysMngrDestroy(keyMngr) ;
return nullptr ;
}
}
else
{
if (xmlSecMSCngKeysMngrInit(keyMngr) < 0)
{
xmlSecError(XMLSEC_ERRORS_HERE,
nullptr,
"xmlSecMSCngKeysMngrInit",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
xmlSecKeysMngrDestroy(keyMngr);
return nullptr;
}
xmlSecError(XMLSEC_ERRORS_HERE,
nullptr,
"xmlSecMSCngKeysMngrInit",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
xmlSecKeysMngrDestroy(keyMngr);
return nullptr;
}
/*-
......@@ -157,10 +134,7 @@ MSCryptoAppliedKeysMngrAdoptKeyStore(
xmlSecAssert2(mngr != nullptr, -1) ;
xmlSecAssert2(keyStore != nullptr, -1) ;
if (!svl::crypto::isMSCng())
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCryptoX509StoreId) ;
else
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCngX509StoreId);
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCngX509StoreId);
if (x509Store == nullptr)
{
xmlSecError(XMLSEC_ERRORS_HERE,
......@@ -171,29 +145,14 @@ MSCryptoAppliedKeysMngrAdoptKeyStore(
return -1 ;
}
if (!svl::crypto::isMSCng())
if (xmlSecMSCngX509StoreAdoptKeyStore(x509Store, keyStore) < 0)
{
if (xmlSecMSCryptoX509StoreAdoptKeyStore(x509Store, keyStore) < 0)
{
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCryptoX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE) ;
return -1 ;
}
}
else
{
if (xmlSecMSCngX509StoreAdoptKeyStore(x509Store, keyStore) < 0)
{
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCngX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return -1;
}
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCngX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return -1;
}
return 0 ;
......@@ -210,10 +169,7 @@ MSCryptoAppliedKeysMngrAdoptTrustedStore(
xmlSecAssert2(mngr != nullptr, -1) ;
xmlSecAssert2(trustedStore != nullptr, -1) ;
if (!svl::crypto::isMSCng())
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCryptoX509StoreId) ;
else
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCngX509StoreId);
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCngX509StoreId);
if (x509Store == nullptr)
{
xmlSecError(XMLSEC_ERRORS_HERE,
......@@ -224,29 +180,14 @@ MSCryptoAppliedKeysMngrAdoptTrustedStore(
return -1 ;
}
if (!svl::crypto::isMSCng())
if (xmlSecMSCngX509StoreAdoptTrustedStore(x509Store, trustedStore) < 0)
{
if (xmlSecMSCryptoX509StoreAdoptTrustedStore(x509Store, trustedStore) < 0)
{
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCryptoX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE) ;
return -1 ;
}
}
else
{
if (xmlSecMSCngX509StoreAdoptTrustedStore(x509Store, trustedStore) < 0)
{
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCngX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return -1;
}
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCngX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return -1;
}
return 0 ;
......@@ -263,10 +204,7 @@ MSCryptoAppliedKeysMngrAdoptUntrustedStore(
xmlSecAssert2(mngr != nullptr, -1) ;
xmlSecAssert2(untrustedStore != nullptr, -1) ;
if (!svl::crypto::isMSCng())
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCryptoX509StoreId) ;
else
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCngX509StoreId);
x509Store = xmlSecKeysMngrGetDataStore(mngr, xmlSecMSCngX509StoreId);
if (x509Store == nullptr)
{
xmlSecError(XMLSEC_ERRORS_HERE,
......@@ -277,29 +215,14 @@ MSCryptoAppliedKeysMngrAdoptUntrustedStore(
return -1 ;
}
if (!svl::crypto::isMSCng())
if (xmlSecMSCngX509StoreAdoptUntrustedStore(x509Store, untrustedStore) < 0)
{
if (xmlSecMSCryptoX509StoreAdoptUntrustedStore(x509Store, untrustedStore) < 0)
{
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCryptoX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE) ;
return -1 ;
}
}
else
{
if (xmlSecMSCngX509StoreAdoptUntrustedStore(x509Store, untrustedStore) < 0)
{
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCngX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return -1;
}
xmlSecError(XMLSEC_ERRORS_HERE,
xmlSecErrorsSafeString(xmlSecKeyDataStoreGetName(x509Store)),
"xmlSecMSCngX509StoreAdoptKeyStore",
XMLSEC_ERRORS_R_XMLSEC_FAILED,
XMLSEC_ERRORS_NO_MESSAGE);
return -1;
}
return 0 ;
......
......@@ -23,7 +23,6 @@
#include "securityenvironment_mscryptimpl.hxx"
#include <xmlsec-wrapper.h>
#include <xmlsec/mscrypto/app.h>
#include <xmlsec/mscng/app.h>
#include <com/sun/star/xml/crypto/SecurityEnvironment.hpp>
#include <com/sun/star/xml/crypto/XMLSecurityContext.hpp>
......@@ -71,10 +70,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL
n_hStoreHandle = nullptr ;
}
if (!svl::crypto::isMSCng())
xmlSecMSCryptoAppInit( n_pCertStore ) ;
else
xmlSecMSCngAppInit(n_pCertStore);
xmlSecMSCngAppInit(n_pCertStore);
try {
/* Build Security Environment */
......@@ -90,10 +86,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL
CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ;
}
if (!svl::crypto::isMSCng())
xmlSecMSCryptoAppShutdown() ;
else
xmlSecMSCngAppShutdown();
xmlSecMSCngAppShutdown();
return nullptr;
}
......@@ -120,10 +113,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL
CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ;
}
if (!svl::crypto::isMSCng())
xmlSecMSCryptoAppShutdown() ;
else
xmlSecMSCngAppShutdown();
xmlSecMSCngAppShutdown();
return nullptr;
}
}
......@@ -154,10 +144,7 @@ void SAL_CALL SEInitializer_MSCryptImpl::freeSecurityContext( const uno::Referen
}
*/
if (!svl::crypto::isMSCng())
xmlSecMSCryptoAppShutdown() ;
else
xmlSecMSCngAppShutdown();
xmlSecMSCngAppShutdown();
}
/* XServiceInfo */
......
......@@ -15,7 +15,6 @@
#include <xmlsec-wrapper.h>
#include <svl/cryptosign.hxx>
#ifdef XMLSEC_CRYPTO_MSCRYPTO
#include <xmlsec/mscrypto/crypto.h>
#include <xmlsec/mscng/crypto.h>
#else
#include <xmlsec/nss/crypto.h>
......@@ -32,19 +31,9 @@ XSECXMLSEC_DLLPUBLIC void initXmlSec()
//Init xmlsec crypto engine library
#ifdef XMLSEC_CRYPTO_MSCRYPTO
if (!svl::crypto::isMSCng())
{
if( xmlSecMSCryptoInit() < 0 ) {
xmlSecShutdown() ;
throw RuntimeException() ;
}
}
else
{
if( xmlSecMSCngInit() < 0 ) {
xmlSecShutdown();
throw RuntimeException();
}
if( xmlSecMSCngInit() < 0 ) {
xmlSecShutdown();
throw RuntimeException();
}
#else
if( xmlSecNssInit() < 0 ) {
......@@ -56,12 +45,9 @@ XSECXMLSEC_DLLPUBLIC void initXmlSec()
//Enable external stream handlers
if( xmlEnableStreamInputCallbacks() < 0 ) {
#ifdef XMLSEC_CRYPTO_MSCRYPTO
if (!svl::crypto::isMSCng())
xmlSecMSCryptoShutdown();
else
xmlSecMSCngShutdown();
xmlSecMSCngShutdown();
#else
xmlSecNssShutdown();
xmlSecNssShutdown();
#endif
xmlSecShutdown() ;
throw RuntimeException() ;
......@@ -72,10 +58,7 @@ XSECXMLSEC_DLLPUBLIC void deInitXmlSec()
{
xmlDisableStreamInputCallbacks();
#ifdef XMLSEC_CRYPTO_MSCRYPTO
if (!svl::crypto::isMSCng())
xmlSecMSCryptoShutdown();
else
xmlSecMSCngShutdown();
xmlSecMSCngShutdown();
#else
xmlSecNssShutdown();
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment