[cpp-xmltooling] branch master updated: Eliminate extra data copying.

Scott Cantor cantor.2 at osu.edu
Thu Mar 8 00:23:29 EST 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository cpp-xmltooling.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=2e07197271bc4d36d4501104cfa1284b60d7144a

The following commit(s) were added to refs/heads/master by this push:
       new  2e07197   Eliminate extra data copying.
2e07197 is described below

commit 2e07197271bc4d36d4501104cfa1284b60d7144a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Mar 8 00:23:16 2018 -0500

    Eliminate extra data copying.
---
 xmltooling/security/impl/DataSealer.cpp | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/xmltooling/security/impl/DataSealer.cpp b/xmltooling/security/impl/DataSealer.cpp
index 2df326a..74008d7 100644
--- a/xmltooling/security/impl/DataSealer.cpp
+++ b/xmltooling/security/impl/DataSealer.cpp
@@ -39,7 +39,7 @@
 #include <xsec/framework/XSECException.hpp>
 #include <xsec/transformers/TXFMChain.hpp>
 #include <xsec/transformers/TXFMBase64.hpp>
-#include <xsec/transformers/TXFMSB.hpp>
+#include <xsec/transformers/TXFMChar.hpp>
 #include <xsec/xenc/XENCEncryptionMethod.hpp>
 
 using namespace xmltooling;
@@ -130,6 +130,7 @@ string DataSealer::wrap(const char* s, time_t exp) const
     char* deflated = XMLHelper::deflate(const_cast<char*>(sb.c_str()), sb.length(), &len);
     if (!deflated || !len)
         throw IOException("Failed to deflate data.");
+	auto_arrayptr<char> arrayjan(deflated);
 
     // Finally we encrypt the data. We have to hack this a bit to reuse the xmlsec routines.
 
@@ -137,12 +138,9 @@ string DataSealer::wrap(const char* s, time_t exp) const
 	Janitor<DOMDocument> docjan(dummydoc);
 	auto_ptr<XSECEnv> env(new XSECEnv(dummydoc));
 
-    safeBuffer plaintext;
-    plaintext.sbMemcpyIn(deflated, len);
-    delete[] deflated;
-    TXFMSB* sbt = new TXFMSB(dummydoc);
-    sbt->setInput(plaintext, len);
-    TXFMChain tx(sbt);
+    TXFMChar* ct = new TXFMChar(dummydoc);
+    ct->setInput(deflated, len);
+    TXFMChain tx(ct);
 
 	safeBuffer ciphertext;
 	try {
@@ -205,11 +203,9 @@ string DataSealer::unwrap(const char* s) const
 	Janitor<DOMDocument> docjan(dummydoc);
 	auto_ptr<XSECEnv> env(new XSECEnv(dummydoc));
 
-	safeBuffer ciphertext;
-	ciphertext.sbStrcpyIn(++delim);
-	TXFMSB* sbt = new TXFMSB(dummydoc);
-	sbt->setInput(ciphertext, ciphertext.sbStrlen());
-	TXFMChain tx(sbt);
+	TXFMChar* ct = new TXFMChar(dummydoc);
+	ct->setInput(++delim);
+	TXFMChain tx(ct);
 	TXFMBase64* b64 = new TXFMBase64(dummydoc, true); // decodes
 	tx.appendTxfm(b64);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list