You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by sc...@apache.org on 2017/09/20 18:34:33 UTC

svn commit: r1809065 - in /santuario/xml-security-cpp/trunk/xsec: dsig/ enc/ enc/NSS/ enc/OpenSSL/ enc/WinCAPI/ transformers/ xenc/impl/

Author: scantor
Date: Wed Sep 20 18:34:33 2017
New Revision: 1809065

URL: http://svn.apache.org/viewvc?rev=1809065&view=rev
Log:
Move hash length macro into API and remove deprecated methods.

Modified:
    santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.cpp
    santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.hpp
    santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoHash.hpp
    santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.cpp
    santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.hpp
    santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.cpp
    santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp
    santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp
    santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp
    santuario/xml-security-cpp/trunk/xsec/enc/XSECCryptoProvider.hpp
    santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.cpp
    santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.hpp
    santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.cpp
    santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.hpp
    santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp

Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.cpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.cpp Wed Sep 20 18:34:33 2017
@@ -108,46 +108,44 @@ static const XMLCh s_unicodeStrRootNode[
 // --------------------------------------------------------------------------------
 
 
-DSIGReference::DSIGReference(const XSECEnv * env, DOMNode *dom) {
-
-	mp_referenceNode = dom;
-	mp_env = env;
+DSIGReference::DSIGReference(const XSECEnv * env, DOMNode *dom) :
+	mp_formatter(NULL),
+	mp_referenceNode(dom),
+	mp_preHash(NULL),
+	mp_manifestList(NULL),
+	mp_URI(NULL),
+	m_isManifest(false),
+	mp_transformsNode(NULL),
+	me_hashMethod(HASH_NONE),
+	mp_hashValueNode(NULL),
+	mp_env(env),
+	mp_transformList(NULL),
+	mp_algorithmURI(NULL),
+	m_loaded(false) {
 
 	// Should throw an exception if the node is not a REFERENCE element
 
 	XSECnew(mp_formatter, XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
 												XMLFormatter::UnRep_CharRef));
-
-	mp_preHash = NULL;
-	mp_manifestList = NULL;
-	me_hashMethod = HASH_NONE;
-	mp_transformsNode = NULL;
-	mp_transformList = NULL;
-	mp_URI = NULL;
-	m_isManifest = false;
-	mp_algorithmURI = NULL;
-	m_loaded = false;
-
 }
 
-DSIGReference::DSIGReference(const XSECEnv * env) {
-
-	mp_env = env;
-	mp_referenceNode = NULL;
-	mp_transformsNode = NULL;
-	mp_transformList = NULL;
+DSIGReference::DSIGReference(const XSECEnv * env) :
+	mp_formatter(NULL),
+	mp_referenceNode(NULL),
+	mp_preHash(NULL),
+	mp_manifestList(NULL),
+	mp_URI(NULL),
+	m_isManifest(false),
+	mp_transformsNode(NULL),
+	me_hashMethod(HASH_NONE),
+	mp_hashValueNode(NULL),
+	mp_env(env),
+	mp_transformList(NULL),
+	mp_algorithmURI(NULL),
+	m_loaded(false) {
 
 	XSECnew(mp_formatter, XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
 											XMLFormatter::UnRep_CharRef));
-
-	mp_preHash = NULL;		// By default no "special" transform
-	mp_manifestList = NULL;
-	me_hashMethod = HASH_NONE;
-	mp_URI = NULL;
-	m_isManifest = false;
-	mp_algorithmURI = NULL;
-	m_loaded = false;
-
 };
 
 DSIGReference::~DSIGReference() {
@@ -1186,13 +1184,15 @@ DSIGTransformList * DSIGReference::loadT
 
 void DSIGReference::setHash(void) {
 
+	unsigned int maxHashSize = XSECPlatformUtils::g_cryptoProvider->getMaxHashSize();
+
 	// First determine the hash value
-	XMLByte calculatedHashVal[CRYPTO_MAX_HASH_SIZE];	// The hash that we determined
+	XMLByte calculatedHashVal[maxHashSize];	// The hash that we determined
 	unsigned int calculatedHashLen;
-	XMLByte base64Hash [CRYPTO_MAX_HASH_SIZE * 2];
+	XMLByte base64Hash [maxHashSize * 2];
 	unsigned int base64HashLen;
 
-	calculatedHashLen = calculateHash(calculatedHashVal, CRYPTO_MAX_HASH_SIZE);
+	calculatedHashLen = calculateHash(calculatedHashVal, maxHashSize);
 
 	// Calculate the base64 value
 
@@ -1211,9 +1211,9 @@ void DSIGReference::setHash(void) {
 	base64HashLen = b64->encode(calculatedHashVal,
 								calculatedHashLen,
 								base64Hash,
-								CRYPTO_MAX_HASH_SIZE * 2);
+								maxHashSize * 2);
 	base64HashLen += b64->encodeFinish(&base64Hash[base64HashLen],
-										(CRYPTO_MAX_HASH_SIZE * 2) - base64HashLen);
+										(maxHashSize * 2) - base64HashLen);
 
 	// Ensure the string is terminated
 	if (base64Hash[base64HashLen-1] == '\n')
@@ -1426,15 +1426,17 @@ bool DSIGReference::checkHash() {
 
 	// First set up for input
 
-	XMLByte calculatedHashVal[CRYPTO_MAX_HASH_SIZE];		// The hash that we determined
-	XMLByte readHashVal[CRYPTO_MAX_HASH_SIZE];			// The hash in the element
+	unsigned int maxHashSize = XSECPlatformUtils::g_cryptoProvider->getMaxHashSize();
+
+	XMLByte calculatedHashVal[maxHashSize];		// The hash that we determined
+	XMLByte readHashVal[maxHashSize];			// The hash in the element
 
 	unsigned int calculatedHashSize, i;
 
-	if ((calculatedHashSize = calculateHash(calculatedHashVal, CRYPTO_MAX_HASH_SIZE)) == 0)
+	if ((calculatedHashSize = calculateHash(calculatedHashVal, maxHashSize)) == 0)
 		return false;
 
-	if (readHash(readHashVal, CRYPTO_MAX_HASH_SIZE) != calculatedHashSize)
+	if (readHash(readHashVal, maxHashSize) != calculatedHashSize)
 		return false;
 
 	for (i = 0; i < calculatedHashSize; ++i) {

Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.hpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGReference.hpp Wed Sep 20 18:34:33 2017
@@ -552,7 +552,6 @@ private:
 
 
 	XSECSafeBufferFormatter		* mp_formatter;
-	bool formatterLocal;
 	XERCES_CPP_NAMESPACE_QUALIFIER DOMNode						
 								* mp_referenceNode;		// Points to start of document where reference node is
 	TXFMBase					* mp_preHash;			// To be used pre-hash

Modified: santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoHash.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoHash.hpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoHash.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoHash.hpp Wed Sep 20 18:34:33 2017
@@ -37,6 +37,8 @@
 #include <pk11func.h>
 #include <nss.h>
 
+#define NSS_MAX_HASH_SIZE	128
+
 /**
  * @ingroup nsscrypto
  * @{
@@ -147,7 +149,7 @@ private:
 	// Not implemented constructors
 	NSSCryptoHash();
 
-	unsigned char				m_mdValue[XSEC_MAX_HASH_SIZE];		// Final output
+	unsigned char				m_mdValue[NSS_MAX_HASH_SIZE];		// Final output
 	unsigned int				m_mdLen;
 
 	HashType	          m_hashType;

Modified: santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.cpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.cpp Wed Sep 20 18:34:33 2017
@@ -129,20 +129,11 @@ const XMLCh * NSSCryptoProvider::getProv
 
 }
 
-// --------------------------------------------------------------------------------
-//           Hash SHA1
-// --------------------------------------------------------------------------------
-
-XSECCryptoHash	* NSSCryptoProvider::hashSHA1() const {
-
-	NSSCryptoHash * ret;
-
-	XSECnew(ret, NSSCryptoHash(XSECCryptoHash::HASH_SHA1));
-
-	return ret;
-
+unsigned int NSSCryptoProvider::getMaxHashSize() const {
+	return NSS_MAX_HASH_SIZE;
 }
 
+
 // --------------------------------------------------------------------------------
 //           Hash SHA
 // --------------------------------------------------------------------------------
@@ -167,20 +158,6 @@ XSECCryptoHash	* NSSCryptoProvider::hash
 
 	return ret;
 
-}
-
-// --------------------------------------------------------------------------------
-//           Hash HMAC SHA1
-// --------------------------------------------------------------------------------
-
-XSECCryptoHash * NSSCryptoProvider::hashHMACSHA1() const {
-
-	NSSCryptoHashHMAC * ret;
-
-	XSECnew(ret, NSSCryptoHashHMAC(XSECCryptoHash::HASH_SHA1));
-
-	return ret;
-
 }
 
 // --------------------------------------------------------------------------------

Modified: santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.hpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/NSS/NSSCryptoProvider.hpp Wed Sep 20 18:34:33 2017
@@ -80,50 +80,34 @@ public :
 	//@{
 
 	/**
-	 * \brief Return a SHA1 implementation.
+	 * \brief Get the provider's maximum digest length.
 	 *
-	 * Call used by the library to obtain a SHA1 object from the 
-	 * provider.
+	 * Call used by the library to max out the buffer sizes it uses.
 	 *
-	 * @returns A pointer to an NSS Hash object that implements SHA1
-	 * @see NSSCryptoHash
+	 * @returns maximum size to allow for
 	 */
-
-	virtual XSECCryptoHash * hashSHA1() const;
+	virtual unsigned int getMaxHashSize() const;
 
   /**
-	 * \brief Return a SHA1 implementation.
+	 * \brief Return a SHA implementation.
 	 *
-	 * Call used by the library to obtain a SHA1 object from the 
+	 * Call used by the library to obtain a SHA object from the
 	 * provider.
 	 *
-	 * @returns A pointer to an NSS Hash object that implements SHA1
+	 * @returns A pointer to an NSS Hash object that implements SHA
 	 * @see NSSCryptoHash
 	 */
 
 	virtual XSECCryptoHash * hashSHA(int length = 160) const;
 
-	/**
-	 * \brief Return a HMAC SHA1 implementation.
-	 *
-	 * Call used by the library to obtain a HMAC SHA1 object from the 
-	 * provider.  The caller will need to set the key in the hash
-	 * object with an XSECCryptoKeyHMAC using NSSCryptoHash::setKey()
-	 *
-	 * @returns A pointer to a Hash object that implements HMAC-SHA1
-	 * @see NSSCryptoHash
-	 */
-
-	virtual XSECCryptoHash * hashHMACSHA1() const;
-
   /**
-	 * \brief Return a HMAC SHA1 implementation.
+	 * \brief Return a HMAC SHA implementation.
 	 *
-	 * Call used by the library to obtain a HMAC SHA1 object from the 
+	 * Call used by the library to obtain a HMAC SHA object from the
 	 * provider.  The caller will need to set the key in the hash
 	 * object with an XSECCryptoKeyHMAC using NSSCryptoHash::setKey()
 	 *
-	 * @returns A pointer to a Hash object that implements HMAC-SHA1
+	 * @returns A pointer to a Hash object that implements HMAC-SHA
 	 * @see NSSCryptoHash
 	 */
 

Modified: santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.cpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.cpp Wed Sep 20 18:34:33 2017
@@ -175,24 +175,8 @@ const XMLCh * OpenSSLCryptoProvider::get
 }
     // Hashing classes
 
-XSECCryptoHash  * OpenSSLCryptoProvider::hashSHA1() const {
-
-    OpenSSLCryptoHash * ret;
-
-    XSECnew(ret, OpenSSLCryptoHash(XSECCryptoHash::HASH_SHA1));
-
-    return ret;
-
-}
-
-XSECCryptoHash * OpenSSLCryptoProvider::hashHMACSHA1() const {
-
-    OpenSSLCryptoHashHMAC * ret;
-
-    XSECnew(ret, OpenSSLCryptoHashHMAC(XSECCryptoHash::HASH_SHA1));
-
-    return ret;
-
+unsigned int OpenSSLCryptoProvider::getMaxHashSize() const {
+	return 128;
 }
 
 XSECCryptoHash  * OpenSSLCryptoProvider::hashSHA(int length) const {

Modified: santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp Wed Sep 20 18:34:33 2017
@@ -73,16 +73,13 @@ public :
 	//@{
 
 	/**
-	 * \brief Return a SHA1 implementation.
+	 * \brief Get the provider's maximum digest length.
 	 *
-	 * Call used by the library to obtain a SHA1 object from the 
-	 * provider.
+	 * Call used by the library to max out the buffer sizes it uses.
 	 *
-	 * @returns A pointer to an OpenSSL Hash object that implements SHA1
-	 * @see XSECCryptoHash
+	 * @returns maximum size to allow for
 	 */
-
-	virtual XSECCryptoHash			* hashSHA1() const;
+	virtual unsigned int getMaxHashSize() const;
 
 	/**
 	 * \brief Return a SHA implementation.
@@ -98,19 +95,6 @@ public :
 	virtual XSECCryptoHash			* hashSHA(int length = 160) const;
 
 	/**
-	 * \brief Return a HMAC SHA1 implementation.
-	 *
-	 * Call used by the library to obtain a HMAC SHA1 object from the 
-	 * provider.  The caller will need to set the key in the hash
-	 * object with an XSECCryptoKeyHMAC using OpenSSLCryptoHash::setKey()
-	 *
-	 * @returns A pointer to a Hash object that implements HMAC-SHA1
-	 * @see OpenSSLCryptoHash
-	 */
-
-	virtual XSECCryptoHash			* hashHMACSHA1() const;
-
-	/**
 	 * \brief Return a HMAC SHA(1-512) implementation.
 	 *
 	 * Call used by the library to obtain a HMAC SHA object from the 

Modified: santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp Wed Sep 20 18:34:33 2017
@@ -178,39 +178,34 @@ const XMLCh * WinCAPICryptoProvider::get
 
 // Hashing classes
 
-XSECCryptoHash	* WinCAPICryptoProvider::hashSHA1() const {
-
-	WinCAPICryptoHash * ret;
-
-	XSECnew(ret, WinCAPICryptoHash(m_provDSS, XSECCryptoHash::HASH_SHA1));
-
-	return ret;
-
+unsigned int WinCAPICryptoProvider::getMaxHashSize() const {
+	return WINCAPI_MAX_HASH_SIZE;
 }
 
-XSECCryptoHash * WinCAPICryptoProvider::hashHMACSHA1() const {
-
-	WinCAPICryptoHashHMAC * ret;
-
-	XSECnew(ret, WinCAPICryptoHashHMAC(m_provDSS, XSECCryptoHash::HASH_SHA1));
 
-	return ret;
+XSECCryptoHash	* WinCAPICryptoProvider::hashSHA(int length) const {
 
-}
 
-XSECCryptoHash	* WinCAPICryptoProvider::hashSHA(int length) const {
+	if (length == 160) {
+		WinCAPICryptoHash * ret;
 
+		XSECnew(ret, WinCAPICryptoHash(m_provDSS, XSECCryptoHash::HASH_SHA1));
 
-	if (length == 160)
-		return hashSHA1();
+		return ret;
+	}
 
 	else return NULL;
 }
 
 XSECCryptoHash * WinCAPICryptoProvider::hashHMACSHA(int length) const {
 
-	if (length == 160)
-		return hashHMACSHA1();
+	if (length == 160) {
+		WinCAPICryptoHashHMAC * ret;
+
+		XSECnew(ret, WinCAPICryptoHashHMAC(m_provDSS, XSECCryptoHash::HASH_SHA1));
+
+		return ret;
+	}
 
 	else return NULL;
 

Modified: santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp Wed Sep 20 18:34:33 2017
@@ -117,16 +117,13 @@ public :
 	//@{
 
 	/**
-	 * \brief Return a SHA1 implementation.
+	 * \brief Get the provider's maximum digest length.
 	 *
-	 * Call used by the library to obtain a SHA1 object from the 
-	 * provider.
+	 * Call used by the library to max out the buffer sizes it uses.
 	 *
-	 * @returns A pointer to an WinCAPI Hash object that implements SHA1
-	 * @see WinCAPICryptoHash
+	 * @returns maximum size to allow for
 	 */
-
-	virtual XSECCryptoHash			* hashSHA1() const;
+	virtual unsigned int getMaxHashSize() const;
 
 	/**
 	 * \brief Return a SHA implementation.
@@ -142,19 +139,6 @@ public :
 	virtual XSECCryptoHash			* hashSHA(int length = 160) const;
 	
 	/**
-	 * \brief Return a HMAC SHA1 implementation.
-	 *
-	 * Call used by the library to obtain a HMAC SHA1 object from the 
-	 * provider.  The caller will need to set the key in the hash
-	 * object with an XSECCryptoKeyHMAC using WinCAPICryptoHash::setKey()
-	 *
-	 * @returns A pointer to a Hash object that implements HMAC-SHA1
-	 * @see WinCAPICryptoHash
-	 */
-
-	virtual XSECCryptoHash			* hashHMACSHA1() const;
-
-	/**
 	 * \brief Return a HMAC SHA(1-512) implementation.
 	 *
 	 * Call used by the library to obtain a HMAC SHA object from the 

Modified: santuario/xml-security-cpp/trunk/xsec/enc/XSECCryptoProvider.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/XSECCryptoProvider.hpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/XSECCryptoProvider.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/XSECCryptoProvider.hpp Wed Sep 20 18:34:33 2017
@@ -109,18 +109,6 @@
 // Some constants
 
 /**
- *\brief Maximum length (in bytes) of any expected Digest results.
- *
- * This constant defines the maximum length (in bytes) of HASH returns.
- * We have defined it far and above the size we would normally expect.
- *
- * @todo This should really come from each of the providers and should
- * be implemented as a function call to *CryptoProvider
- */
-
-#define CRYPTO_MAX_HASH_SIZE		128
-
-/**
  *\brief OID For DSA
  */
 
@@ -129,7 +117,7 @@
 /**
  *\brief The base class that all *CryptoProviders need to implement.
  *
- * The instatiations of this class are used by the core library to
+ * The instantiations of this class are used by the core library to
  * create cryptographic objects necessary for the library to do its work
  * without actually knowing any details at all about the provider library
  *
@@ -154,17 +142,13 @@ public :
 	//@{
 
 	/**
-	 * \brief Return a SHA1 implementation.
+	 * \brief Get the provider's maximum digest length.
 	 *
-	 * Call used by the library to obtain a SHA1 object from the 
-	 * provider.
+	 * Call used by the library to max out the buffer sizes it uses.
 	 *
-	 * @returns A pointer to a Hash object that implements SHA1
-	 * @see XSECCryptoHash
-	 * @deprecated Use hashSHA instead
+	 * @returns maximum size to allow for
 	 */
-	 
-	virtual XSECCryptoHash			* hashSHA1() const = 0;
+	virtual unsigned int getMaxHashSize() const = 0;
 
 	/**
 	 * \brief Return a SHA implementation.
@@ -172,7 +156,7 @@ public :
 	 * Call used by the library to obtain a SHA object from the 
 	 * provider.  Size of hash determined by length argument (160 = SHA1)
 	 *
-	 * @returns A pointer to a Hash object that implements SHA1
+	 * @returns A pointer to a Hash object that implements SHA.
 	 * @param length - length of hash.  E.g. 160 for SHA1 or 256 for SHA256
 	 * @see XSECCryptoHash
 	 */
@@ -180,27 +164,13 @@ public :
 	virtual XSECCryptoHash			* hashSHA(int length = 160) const = 0;
 
 	/**
-	 * \brief Return a HMAC SHA1 implementation.
-	 *
-	 * Call used by the library to obtain a HMAC SHA1 object from the 
-	 * provider.  The caller will need to set the key in the hash
-	 * object with an XSECCryptoKeyHMAC using XSECCryptoHash::setKey()
-	 *
-	 * @returns A pointer to a Hash object that implements HMAC-SHA1
-	 * @see XSECCryptoHash
-	 * @deprecated use hashHMACSHA instead
-	 */
-
-	virtual XSECCryptoHash			* hashHMACSHA1() const = 0;
-
-	/**
 	 * \brief Return a HMAC SHA(1-512) implementation.
 	 *
 	 * Call used by the library to obtain a HMAC SHA object from the 
 	 * provider.  The caller will need to set the key in the hash
 	 * object with an XSECCryptoKeyHMAC using XSECCryptoHash::setKey()
 	 *
-	 * @returns A pointer to a Hash object that implements HMAC-SHA1
+	 * @returns A pointer to a Hash object that implements HMAC-SHA.
 	 * @param length Length of hash output (160 = SHA1, 256, 512 etc)
 	 * @see XSECCryptoHash
 	 */

Modified: santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.cpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.cpp Wed Sep 20 18:34:33 2017
@@ -36,10 +36,8 @@ XERCES_CPP_NAMESPACE_USE
 
 // Standarad includes 
 
-TXFMMD5::TXFMMD5(DOMDocument *doc,
-									 XSECCryptoKey * key) : TXFMBase (doc) {
-
-	toOutput = 0;					// Nothing yet to output
+TXFMMD5::TXFMMD5(DOMDocument *doc, XSECCryptoKey * key) :
+	TXFMBase (doc), mp_h(NULL), md_value(NULL), md_len(0), toOutput(0) {
 
 	if (key == NULL)
 		// Get a MD5 worker
@@ -59,7 +57,12 @@ TXFMMD5::TXFMMD5(DOMDocument *doc,
 				"Error requesting MD5 object from Crypto Provider");
 
 	}
-									
+
+	md_value = new unsigned char[XSECPlatformUtils::g_cryptoProvider->getMaxHashSize()];
+	if (!md_value) {
+		delete mp_h;
+	}
+
 };
 
 TXFMMD5::~TXFMMD5() {
@@ -111,7 +114,7 @@ void TXFMMD5::setInput(TXFMBase * inputT
 	
 	// Finalise
 
-	md_len = mp_h->finish(md_value, CRYPTO_MAX_HASH_SIZE);
+	md_len = mp_h->finish(md_value, XSECPlatformUtils::g_cryptoProvider->getMaxHashSize());
 
 	toOutput = md_len;
 

Modified: santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.hpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/transformers/TXFMMD5.hpp Wed Sep 20 18:34:33 2017
@@ -45,8 +45,8 @@ class XSEC_EXPORT TXFMMD5 : public TXFMB
 
 private:
 
-	XSECCryptoHash		* mp_h;							// To hold the hash
-	unsigned char		md_value[CRYPTO_MAX_HASH_SIZE];	// Final output
+	XSECCryptoHash	* mp_h;							// To hold the hash
+	unsigned char*	md_value;						// Final output
 	unsigned int		md_len;							// Length of digest
 
 	unsigned int		toOutput;						// Amount still to output

Modified: santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.cpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.cpp Wed Sep 20 18:34:33 2017
@@ -34,10 +34,9 @@
 
 XERCES_CPP_NAMESPACE_USE
 
-TXFMSHA1::TXFMSHA1(DOMDocument *doc, hashMethod hm,
-									 XSECCryptoKey * key) : TXFMBase (doc) {
+TXFMSHA1::TXFMSHA1(DOMDocument *doc, hashMethod hm, XSECCryptoKey * key) :
+	TXFMBase (doc), mp_h(NULL), md_value(NULL), md_len(0), toOutput(0) {
 
-	toOutput = 0;					// Nothing yet to output
 	int hashLen = 0;
 
 	switch (hm) {
@@ -71,7 +70,6 @@ TXFMSHA1::TXFMSHA1(DOMDocument *doc, has
 
 		}
 		mp_h->setKey(key);
-
 	}
 
 	
@@ -81,7 +79,11 @@ TXFMSHA1::TXFMSHA1(DOMDocument *doc, has
 				"Error requesting SHA1 object from Crypto Provider");
 
 	}
-									
+
+	md_value = new unsigned char[XSECPlatformUtils::g_cryptoProvider->getMaxHashSize()];
+	if (!md_value) {
+		delete mp_h;
+	}
 };
 
 TXFMSHA1::~TXFMSHA1() {
@@ -90,6 +92,8 @@ TXFMSHA1::~TXFMSHA1() {
 	if (mp_h)
 		delete mp_h;
 
+	if (md_value)
+		delete[] md_value;
 };
 
 	// Methods to set the inputs
@@ -140,7 +144,7 @@ void TXFMSHA1::setInput(TXFMBase * input
 	
 	// Finalise
 
-	md_len = mp_h->finish(md_value, CRYPTO_MAX_HASH_SIZE);
+	md_len = mp_h->finish(md_value, XSECPlatformUtils::g_cryptoProvider->getMaxHashSize());
 
 	toOutput = md_len;
 

Modified: santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.hpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/transformers/TXFMSHA1.hpp Wed Sep 20 18:34:33 2017
@@ -40,8 +40,8 @@ class XSEC_EXPORT TXFMSHA1 : public TXFM
 
 private:
 
-	XSECCryptoHash		* mp_h;							// To hold the hash
-	unsigned char		md_value[CRYPTO_MAX_HASH_SIZE];	// Final output
+	XSECCryptoHash		* mp_h;						// To hold the hash
+	unsigned char		*md_value;					// Final output
 	unsigned int		md_len;							// Length of digest
 
 	unsigned int		toOutput;						// Amount still to output

Modified: santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp?rev=1809065&r1=1809064&r2=1809065&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/xenc/impl/XENCAlgorithmHandlerDefault.cpp Wed Sep 20 18:34:33 2017
@@ -427,7 +427,7 @@ unsigned int XENCAlgorithmHandlerDefault
 	offset += sk->decryptFinish(&buf[offset], _MY_MAX_KEY_SIZE - offset);
 
 	// Calculate the CMS Key Checksum
-	XSECCryptoHash * sha1 = XSECPlatformUtils::g_cryptoProvider->hashSHA1();
+	XSECCryptoHash * sha1 = XSECPlatformUtils::g_cryptoProvider->hashSHA();
 	if (!sha1) {
 
 		throw XSECException(XSECException::CryptoProviderError, 
@@ -485,7 +485,7 @@ bool XENCAlgorithmHandlerDefault::wrapKe
 	// Do the first encrypt
 	XMLByte buf2[_MY_MAX_KEY_SIZE + 16];
 
-	XSECCryptoHash * sha1 = XSECPlatformUtils::g_cryptoProvider->hashSHA1();
+	XSECCryptoHash * sha1 = XSECPlatformUtils::g_cryptoProvider->hashSHA();
 	if (!sha1) {
 
 		throw XSECException(XSECException::CryptoProviderError,