Index: xmlsecurity/prj/build.lst =================================================================== --- xmlsecurity/prj/build.lst (revision 1704173) +++ xmlsecurity/prj/build.lst (working copy) @@ -1,4 +1,4 @@ -xs xmlsecurity : L10N:l10n xmloff unotools offapi unoil svx LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NULL +xs xmlsecurity : L10N:l10n xmloff unotools offapi unoil svx LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt OPENSSL:openssl NULL xs xmlsecurity usr1 - all xs_mkout NULL xs xmlsecurity\inc nmake - all xs_inc NULL xs xmlsecurity\source\framework nmake - all xs_fw xs_inc NULL Index: xmlsecurity/source/xmlsec/nss/digestcontext.cxx =================================================================== --- xmlsecurity/source/xmlsec/nss/digestcontext.cxx (revision 1704173) +++ xmlsecurity/source/xmlsec/nss/digestcontext.cxx (working copy) @@ -23,7 +23,6 @@ #include -#include #include "digestcontext.hxx" using namespace ::com::sun::star; @@ -32,7 +31,7 @@ { if ( m_pContext ) { - PK11_DestroyContext( m_pContext, PR_TRUE ); + EVP_MD_CTX_destroy( m_pContext ); m_pContext = NULL; } } @@ -54,9 +53,9 @@ if ( m_b1KData && m_nDigested + aData.getLength() > 1024 ) aToDigest.realloc( 1024 - m_nDigested ); - if ( PK11_DigestOp( m_pContext, reinterpret_cast< const unsigned char* >( aToDigest.getConstArray() ), aToDigest.getLength() ) != SECSuccess ) + if ( EVP_DigestUpdate( m_pContext, reinterpret_cast< const unsigned char* >( aToDigest.getConstArray() ), aToDigest.getLength() ) != 1 ) { - PK11_DestroyContext( m_pContext, PR_TRUE ); + EVP_MD_CTX_destroy( m_pContext ); m_pContext = NULL; m_bBroken = true; throw uno::RuntimeException(); @@ -79,15 +78,15 @@ uno::Sequence< sal_Int8 > aResult( m_nDigestLength ); unsigned int nResultLen = 0; - if ( PK11_DigestFinal( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength() ) != SECSuccess ) + if ( EVP_DigestFinal_ex( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen ) != 1 ) { - PK11_DestroyContext( m_pContext, PR_TRUE ); + EVP_MD_CTX_destroy( m_pContext ); m_pContext = NULL; m_bBroken = true; throw uno::RuntimeException(); } - PK11_DestroyContext( m_pContext, PR_TRUE ); + EVP_MD_CTX_destroy( m_pContext ); m_pContext = NULL; m_bDisposed = true; Index: xmlsecurity/source/xmlsec/nss/digestcontext.hxx =================================================================== --- xmlsecurity/source/xmlsec/nss/digestcontext.hxx (revision 1704173) +++ xmlsecurity/source/xmlsec/nss/digestcontext.hxx (working copy) @@ -28,6 +28,7 @@ #include #include +#include class ODigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext > { @@ -34,7 +35,7 @@ private: ::osl::Mutex m_aMutex; - PK11Context* m_pContext; + EVP_MD_CTX* m_pContext; sal_Int32 m_nDigestLength; bool m_b1KData; sal_Int32 m_nDigested; @@ -43,7 +44,7 @@ bool m_bBroken; public: - ODigestContext( PK11Context* pContext, sal_Int32 nDigestLength, bool b1KData ) + ODigestContext( EVP_MD_CTX* pContext, sal_Int32 nDigestLength, bool b1KData ) : m_pContext( pContext ) , m_nDigestLength( nDigestLength ) , m_b1KData( b1KData ) Index: xmlsecurity/source/xmlsec/nss/makefile.mk =================================================================== --- xmlsecurity/source/xmlsec/nss/makefile.mk (revision 1704173) +++ xmlsecurity/source/xmlsec/nss/makefile.mk (working copy) @@ -37,6 +37,10 @@ CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS) .ENDIF +.IF "$(SYSTEM_OPENSSL)" == "YES" +CFLAGS+= $(OPENSSL_CFLAGS) +.ENDIF + .IF "$(ENABLE_NSS_MODULE)"!="YES" @all: @echo "No nss -> no libxmlsec -> no xmlsecurity/nss" Index: xmlsecurity/source/xmlsec/nss/nssinitializer.cxx =================================================================== --- xmlsecurity/source/xmlsec/nss/nssinitializer.cxx (revision 1704173) +++ xmlsecurity/source/xmlsec/nss/nssinitializer.cxx (working copy) @@ -408,21 +408,18 @@ css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer::getDigestContext( ::sal_Int32 nDigestID, const css::uno::Sequence< css::beans::NamedValue >& aParams ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException) { - SECOidTag nNSSDigestID = SEC_OID_UNKNOWN; - sal_Int32 nDigestLength = 0; + const EVP_MD *digestType; bool b1KData = false; if ( nDigestID == css::xml::crypto::DigestID::SHA256 || nDigestID == css::xml::crypto::DigestID::SHA256_1K ) { - nNSSDigestID = SEC_OID_SHA256; - nDigestLength = 32; + digestType = EVP_sha256(); b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA256_1K ); } else if ( nDigestID == css::xml::crypto::DigestID::SHA1 || nDigestID == css::xml::crypto::DigestID::SHA1_1K ) { - nNSSDigestID = SEC_OID_SHA1; - nDigestLength = 20; + digestType = EVP_sha1(); b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA1_1K ); } else @@ -432,11 +429,13 @@ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments provided for digest creation." ) ), css::uno::Reference< css::uno::XInterface >(), 2 ); css::uno::Reference< css::xml::crypto::XDigestContext > xResult; - if( initNSS( mxMSF ) ) + EVP_MD_CTX *pContext = EVP_MD_CTX_create(); + if ( pContext ) { - PK11Context* pContext = PK11_CreateDigestContext( nNSSDigestID ); - if ( pContext && PK11_DigestBegin( pContext ) == SECSuccess ) - xResult = new ODigestContext( pContext, nDigestLength, b1KData ); + if ( EVP_DigestInit_ex( pContext, digestType, NULL ) ) + xResult = new ODigestContext( pContext, EVP_MD_CTX_size( pContext ), b1KData ); + else + EVP_MD_CTX_destroy( pContext ); } return xResult; Index: xmlsecurity/util/makefile.mk =================================================================== --- xmlsecurity/util/makefile.mk (revision 1704173) +++ xmlsecurity/util/makefile.mk (working copy) @@ -122,6 +122,11 @@ SHL2STDLIBS+= $(NSSCRYPTOLIBS) .ENDIF +.IF "$(SYSTEM_OPENSSL)" == "YES" +SHL2STDLIBS+= $(OPENSSLLIB) +.ELSE +SHL1STDLIBS+= $(OPENSSLLIBST) +.ENDIF SHL2IMPLIB = $(SHL2TARGET) SHL2DEF = $(MISC)$/$(SHL2TARGET).def