View | Details | Raw Unified | Return to issue 125431
Collapse All | Expand All

(-)xmlsecurity/prj/build.lst (-1 / +1 lines)
Lines 1-4 Link Here
1
xs	xmlsecurity	:    L10N:l10n xmloff unotools offapi unoil svx LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NULL
1
xs	xmlsecurity	:    L10N:l10n xmloff unotools offapi unoil svx LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt OPENSSL:openssl NULL
2
xs	xmlsecurity                                                        usr1	 -	all	xs_mkout	NULL
2
xs	xmlsecurity                                                        usr1	 -	all	xs_mkout	NULL
3
xs	xmlsecurity\inc				                                       nmake -	all	xs_inc NULL
3
xs	xmlsecurity\inc				                                       nmake -	all	xs_inc NULL
4
xs	xmlsecurity\source\framework                                       nmake -	all	xs_fw xs_inc NULL
4
xs	xmlsecurity\source\framework                                       nmake -	all	xs_fw xs_inc NULL
(-)xmlsecurity/source/xmlsec/nss/digestcontext.cxx (-7 / +6 lines)
Lines 23-29 Link Here
23
23
24
#include <precompiled_xmlsecurity.hxx>
24
#include <precompiled_xmlsecurity.hxx>
25
25
26
#include <pk11pub.h>
27
#include "digestcontext.hxx"
26
#include "digestcontext.hxx"
28
27
29
using namespace ::com::sun::star;
28
using namespace ::com::sun::star;
Lines 32-38 Link Here
32
{
31
{
33
    if ( m_pContext )
32
    if ( m_pContext )
34
    {
33
    {
35
        PK11_DestroyContext( m_pContext, PR_TRUE );
34
        EVP_MD_CTX_destroy( m_pContext );
36
        m_pContext = NULL;
35
        m_pContext = NULL;
37
    }
36
    }
38
}
37
}
Lines 54-62 Link Here
54
        if ( m_b1KData && m_nDigested + aData.getLength() > 1024 )
53
        if ( m_b1KData && m_nDigested + aData.getLength() > 1024 )
55
            aToDigest.realloc( 1024 - m_nDigested );
54
            aToDigest.realloc( 1024 - m_nDigested );
56
55
57
        if ( PK11_DigestOp( m_pContext, reinterpret_cast< const unsigned char* >( aToDigest.getConstArray() ), aToDigest.getLength() ) != SECSuccess )
56
        if ( EVP_DigestUpdate( m_pContext, reinterpret_cast< const unsigned char* >( aToDigest.getConstArray() ), aToDigest.getLength() ) != 1 )
58
        {
57
        {
59
            PK11_DestroyContext( m_pContext, PR_TRUE );
58
            EVP_MD_CTX_destroy( m_pContext );
60
            m_pContext = NULL;
59
            m_pContext = NULL;
61
            m_bBroken = true;
60
            m_bBroken = true;
62
            throw uno::RuntimeException();
61
            throw uno::RuntimeException();
Lines 79-93 Link Here
79
78
80
    uno::Sequence< sal_Int8 > aResult( m_nDigestLength );
79
    uno::Sequence< sal_Int8 > aResult( m_nDigestLength );
81
    unsigned int nResultLen = 0;
80
    unsigned int nResultLen = 0;
82
    if ( PK11_DigestFinal( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength() ) != SECSuccess )
81
    if ( EVP_DigestFinal_ex( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen ) != 1 )
83
    {
82
    {
84
        PK11_DestroyContext( m_pContext, PR_TRUE );
83
        EVP_MD_CTX_destroy( m_pContext );
85
        m_pContext = NULL;
84
        m_pContext = NULL;
86
        m_bBroken = true;
85
        m_bBroken = true;
87
        throw uno::RuntimeException();
86
        throw uno::RuntimeException();
88
    }
87
    }
89
88
90
    PK11_DestroyContext( m_pContext, PR_TRUE );
89
    EVP_MD_CTX_destroy( m_pContext );
91
    m_pContext = NULL;
90
    m_pContext = NULL;
92
    m_bDisposed = true;
91
    m_bDisposed = true;
93
92
(-)xmlsecurity/source/xmlsec/nss/digestcontext.hxx (-2 / +3 lines)
Lines 28-33 Link Here
28
28
29
#include <cppuhelper/implbase1.hxx>
29
#include <cppuhelper/implbase1.hxx>
30
#include <osl/mutex.hxx>
30
#include <osl/mutex.hxx>
31
#include <openssl/evp.h>
31
32
32
class ODigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
33
class ODigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
33
{
34
{
Lines 34-40 Link Here
34
private:
35
private:
35
    ::osl::Mutex m_aMutex;
36
    ::osl::Mutex m_aMutex;
36
37
37
    PK11Context* m_pContext;
38
    EVP_MD_CTX* m_pContext;
38
    sal_Int32 m_nDigestLength;
39
    sal_Int32 m_nDigestLength;
39
    bool m_b1KData;
40
    bool m_b1KData;
40
    sal_Int32 m_nDigested;
41
    sal_Int32 m_nDigested;
Lines 43-49 Link Here
43
    bool m_bBroken;
44
    bool m_bBroken;
44
    
45
    
45
public:
46
public:
46
    ODigestContext( PK11Context* pContext, sal_Int32 nDigestLength, bool b1KData )
47
    ODigestContext( EVP_MD_CTX* pContext, sal_Int32 nDigestLength, bool b1KData )
47
    : m_pContext( pContext )
48
    : m_pContext( pContext )
48
    , m_nDigestLength( nDigestLength )
49
    , m_nDigestLength( nDigestLength )
49
    , m_b1KData( b1KData )
50
    , m_b1KData( b1KData )
(-)xmlsecurity/source/xmlsec/nss/makefile.mk (+4 lines)
Lines 37-42 Link Here
37
CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
37
CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
38
.ENDIF
38
.ENDIF
39
39
40
.IF "$(SYSTEM_OPENSSL)" == "YES"
41
CFLAGS+= $(OPENSSL_CFLAGS)
42
.ENDIF
43
40
.IF "$(ENABLE_NSS_MODULE)"!="YES"
44
.IF "$(ENABLE_NSS_MODULE)"!="YES"
41
@all:
45
@all:
42
	@echo "No nss -> no libxmlsec -> no xmlsecurity/nss"
46
	@echo "No nss -> no libxmlsec -> no xmlsecurity/nss"
(-)xmlsecurity/source/xmlsec/nss/nssinitializer.cxx (-10 / +9 lines)
Lines 408-428 Link Here
408
css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer::getDigestContext( ::sal_Int32 nDigestID, const css::uno::Sequence< css::beans::NamedValue >& aParams )
408
css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer::getDigestContext( ::sal_Int32 nDigestID, const css::uno::Sequence< css::beans::NamedValue >& aParams )
409
    throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
409
    throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
410
{
410
{
411
    SECOidTag nNSSDigestID = SEC_OID_UNKNOWN;
411
    const EVP_MD *digestType;
412
    sal_Int32 nDigestLength = 0;
413
    bool b1KData = false;
412
    bool b1KData = false;
414
    if ( nDigestID == css::xml::crypto::DigestID::SHA256
413
    if ( nDigestID == css::xml::crypto::DigestID::SHA256
415
      || nDigestID == css::xml::crypto::DigestID::SHA256_1K )
414
      || nDigestID == css::xml::crypto::DigestID::SHA256_1K )
416
    {
415
    {
417
        nNSSDigestID = SEC_OID_SHA256;
416
        digestType = EVP_sha256();
418
        nDigestLength = 32;
419
        b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA256_1K );
417
        b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA256_1K );
420
    }
418
    }
421
    else if ( nDigestID == css::xml::crypto::DigestID::SHA1
419
    else if ( nDigestID == css::xml::crypto::DigestID::SHA1
422
           || nDigestID == css::xml::crypto::DigestID::SHA1_1K )
420
           || nDigestID == css::xml::crypto::DigestID::SHA1_1K )
423
    {
421
    {
424
        nNSSDigestID = SEC_OID_SHA1;
422
        digestType = EVP_sha1();
425
        nDigestLength = 20;
426
        b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA1_1K );
423
        b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA1_1K );
427
    }
424
    }
428
    else
425
    else
Lines 432-442 Link Here
432
        throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments provided for digest creation." ) ), css::uno::Reference< css::uno::XInterface >(), 2 );
429
        throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments provided for digest creation." ) ), css::uno::Reference< css::uno::XInterface >(), 2 );
433
430
434
    css::uno::Reference< css::xml::crypto::XDigestContext > xResult;
431
    css::uno::Reference< css::xml::crypto::XDigestContext > xResult;
435
    if( initNSS( mxMSF ) )
432
    EVP_MD_CTX *pContext = EVP_MD_CTX_create();
433
    if ( pContext )
436
    {
434
    {
437
        PK11Context* pContext = PK11_CreateDigestContext( nNSSDigestID );
435
        if ( EVP_DigestInit_ex( pContext, digestType, NULL ) )
438
        if ( pContext && PK11_DigestBegin( pContext ) == SECSuccess )
436
            xResult = new ODigestContext( pContext, EVP_MD_CTX_size( pContext ), b1KData );
439
            xResult = new ODigestContext( pContext, nDigestLength, b1KData );
437
        else
438
            EVP_MD_CTX_destroy( pContext );
440
    }
439
    }
441
440
442
    return xResult;
441
    return xResult;
(-)xmlsecurity/util/makefile.mk (+5 lines)
Lines 122-127 Link Here
122
SHL2STDLIBS+= $(NSSCRYPTOLIBS)
122
SHL2STDLIBS+= $(NSSCRYPTOLIBS)
123
.ENDIF
123
.ENDIF
124
124
125
.IF "$(SYSTEM_OPENSSL)" == "YES"
126
SHL2STDLIBS+= $(OPENSSLLIB)
127
.ELSE
128
SHL1STDLIBS+= $(OPENSSLLIBST)
129
.ENDIF
125
130
126
SHL2IMPLIB = $(SHL2TARGET)
131
SHL2IMPLIB = $(SHL2TARGET)
127
SHL2DEF = $(MISC)$/$(SHL2TARGET).def
132
SHL2DEF = $(MISC)$/$(SHL2TARGET).def

Return to issue 125431