Hi all,


Well I took the time to do a patch for the problem of MFC. As I dont have
the CVS version arround yet (I will download it now) I send the patch in
here (not merge usable, sorry this time).



Another couple of interface improvements that I have spotted are
inconsistent use of const values in XSECCrypto interfaces... for instance in
XSECCryptoKeyRSA:



virtual unsigned int signSHAPKCS1Base64Signature ( unsigned int * hashBuffer
 unsigned int hashLen, ...... ).



while in verifySHAPKCS1Base64Signature the hashBuffer do have the const
value. My take is to put a const in sign as the hashBuffers is an input
value only.



or others where they lack the const values in its entirely.



For example in: XSECCryptoHash class



virtual void hash ( unsigned char* data, unsigned int length ); 



it should be better to have



virtual void hash ( const unsigned char* data, unsigned int length );





Well hope this comments help to improve this excelent library.



Greetings

Federico Andres Lois
/*
 * Copyright 2002-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * imitations under the License.
 */

/*
 * XSEC
 * 
 * Configuration file for Windows platform
 *
 * Needs to be modified by hand
 *
 * Author(s): Berin Lautenbach
 *
 * $Id: XSECW32Config.hpp,v 1.19 2004/03/14 03:50:24 blautenb Exp $
 *
 */

#include <xercesc/util/XercesVersion.hpp>

#define XSEC_VERSION         "1.1.0"
#define XSEC_VERSION_MAJOR   1
#define XSEC_VERSION_MEDIUM  1
#define XSEC_VERSION_MINOR   0

/*
 * Because we don't have a configure script, we need to rely on version
 * numbers to understand library idiosycracies
 */

#if (XERCES_VERSION_MAJOR >= 2) && (XERCES_VERSION_MINOR >= 3)
/* 
 * As of version 2.3, xerces requires a version parameter in XMLFormatter
 * constructors
 */
#       define XSEC_XERCES_FORMATTER_REQUIRES_VERSION 1

 /* 2.3 and above use a user defined Memory Manager.  In some cases, this
   actually needs to be passed to functions
*/

#       define XSEC_XERCES_REQUIRES_MEMMGR 1

#else
/*
 * In version 2.2, the XMLUri class was broken for relative URI de-referencing
 */
#       define XSEC_XERCES_BROKEN_XMLURI 1
#endif



/*
* The following defines whether Xalan integration is required.
*
* Xalan is used for XSLT and complex XPath processing.
* Activate this #define if Xalan is not required (or desired)
*/

#define XSEC_NO_XALAN

/*
 * Define presence of cryptographic providers
 */

#define HAVE_OPENSSL 1

#define HAVE_WINCAPI 1

/*
* The following defines whether MFC integration is required on windows systems.
*
* Activate this #define if MFC is not required (or desired)
*/

#define XSEC_NO_MFC

/*
 * Some settings for OpenSSL if we have it
 *
 */

#if defined (HAVE_OPENSSL)

#       include <openssl/opensslv.h>
#       if (OPENSSL_VERSION_NUMBER >= 0x00907000)

#               define XSEC_OPENSSL_CONST_BUFFERS
#               define XSEC_OPENSSL_HAVE_AES
#               define XSEC_OPENSSL_CANSET_PADDING
#       endif

#endif

/*
 * Macros used to determine what header files exist on this
 * system
 */

/* Posix unistd.h */
/* #define HAVE_UNISTD_H */

/* Windows direct.h */
#define HAVE_DIRECT_H 1


/*
 * Copyright 2002-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * imitations under the License.
 */

/*
 * XSEC
 *
 * XSECDefs := File for general XSEC definitions
 *
 * Author(s): Berin Lautenbach
 *
 * $Id: XSECDefs.hpp,v 1.9 2004/02/08 10:24:23 blautenb Exp $
 *
 */

// Use Xerces to do the "hard work in determining compilers etc." for us

#ifndef XSECDEFS_HEADER
#define XSECDEFS_HEADER

// Include the generated include file
     
#if defined (_WIN32)
#       include <xsec/framework/XSECW32Config.hpp>
#       if defined (_DEBUG)

#     if defined (XSEC_NO_MFC)
#                  define WIN32_LEAN_AND_MEAN
#                  include <windows.h>
#        define DEBUG_NEW new
#     else   
#                  include <afx.h>
#                  include <crtdbg.h>
#     endif

#       else
#               define WIN32_LEAN_AND_MEAN
#               include <windows.h>
#       endif
#else
#       include <xsec/framework/XSECConfig.hpp>
#endif

// General includes

#include <assert.h>
#include <stdlib.h>

// Xalan

//#include <Include/PlatformDefinitions.hpp>

// Xerces

#include <xercesc/util/XercesDefs.hpp>

// --------------------------------------------------------------------------------
//           Namespace Handling
// --------------------------------------------------------------------------------

// Use an approach similar to that used in Xalan to process Xerces namespaces

#if defined(XERCES_HAS_CPP_NAMESPACE)
#       define XSEC_USING_XERCES(NAME) using XERCES_CPP_NAMESPACE :: NAME
#       define XSEC_DECLARE_XERCES_CLASS(NAME) namespace XERCES_CPP_NAMESPACE { class 
NAME; }
#       define XSEC_DECLARE_XERCES_STRUCT(NAME) namespace XERCES_CPP_NAMESPACE { 
struct NAME; }
#else
#       define XERCES_CPP_NAMESPACE_QUALIFIER
#       define XERCES_CPP_NAMESPACE_BEGIN
#       define XERCES_CPP_NAMESPACE_END
#       define XERCES_CPP_NAMESPACE_USE
#       define XSEC_USING_XERCES(NAME)
#       define XSEC_DECLARE_XERCES_CLASS(NAME) class NAME;
#       define XSEC_DECLARE_XERCES_STRUCT(NAME) struct NAME;
#endif


// --------------------------------------------------------------------------------
//           Project Library Handling
// --------------------------------------------------------------------------------

#if defined (PROJ_CANON)

#define CANON_EXPORT PLATFORM_EXPORT
#else
#define CANON_EXPORT PLATFORM_IMPORT
#endif

#if defined (PROJ_DSIG)

#define DSIG_EXPORT PLATFORM_EXPORT
#else
#define DSIG_EXPORT PLATFORM_IMPORT
#endif

// Platform includes.  Much of this is taken from Xalan

#if defined(_MSC_VER)

// Microsoft VC++

#       pragma warning(disable: 4127 4251 4511 4512 4514 4702 4710 4711 4786 4097; 
error: 4150 4172 4238 4239 4715)
#       define XSEC_NO_COVARIANT_RETURN_TYPE
/*
 * Removed to allow any compiler to compile - might not work, but ....
 * #elif defined(__GNUC__)
 * #elif defined(__INTEL_COMPILER)
 * #else
 * #error Unknown compiler.
 */
#endif


// Configuration includes

// We want to use XPath calculated transforms

//#define XSEC_USE_XPATH_ENVELOPE


// Given the configuration - what should we set?

#ifdef XSEC_NO_XALAN

// Xalan is not available!

#       define XSEC_NO_XPATH
#       define XSEC_NO_XSLT

#endif  /* XSEC_NO_XALAN */

#ifdef XSEC_NO_XPATH

#       ifdef XSEC_USE_XPATH_ENVELOPE
#               undef XSEC_USE_XPATH_ENVELOPE
#       endif

#endif

#endif /* XSECDEFS_HEADER */

Reply via email to