summaryrefslogtreecommitdiff
path: root/external/libxmlsec
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-01-25 11:42:28 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-25 12:11:02 +0100
commit7fb16870bfe988661e3b1cb206ee6fed560e70a3 (patch)
tree9d76ef739831c43a1db69d925d7cd9fdb3bfcf6f /external/libxmlsec
parent86fb3f12eb07614880f51825f89ed4fb31af2d36 (diff)
libxmlsec: recognize OOXML RelationshipTransform
The transform itself doesn't do anything so far, but the verification is no longer aborted just because we see a transform that we don't know. Change-Id: Ife89157067f3af3326896df3053065c8302795d1
Diffstat (limited to 'external/libxmlsec')
-rw-r--r--external/libxmlsec/UnpackedTarball_xmlsec.mk1
-rw-r--r--external/libxmlsec/xmlsec1-ooxml.patch.1173
2 files changed, 174 insertions, 0 deletions
diff --git a/external/libxmlsec/UnpackedTarball_xmlsec.mk b/external/libxmlsec/UnpackedTarball_xmlsec.mk
index a72deed71d5d..e21c2c41c353 100644
--- a/external/libxmlsec/UnpackedTarball_xmlsec.mk
+++ b/external/libxmlsec/UnpackedTarball_xmlsec.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,xmlsec,\
external/libxmlsec/xmlsec1-1.2.14-ansi.patch \
external/libxmlsec/xmlsec1-customkeymanage.patch \
external/libxmlsec/xmlsec1-update-config.guess.patch.1 \
+ external/libxmlsec/xmlsec1-ooxml.patch.1 \
))
$(eval $(call gb_UnpackedTarball_add_file,xmlsec,include/xmlsec/mscrypto/akmngr.h,external/libxmlsec/include/akmngr_mscrypto.h))
diff --git a/external/libxmlsec/xmlsec1-ooxml.patch.1 b/external/libxmlsec/xmlsec1-ooxml.patch.1
new file mode 100644
index 000000000000..8a1dbe39ef31
--- /dev/null
+++ b/external/libxmlsec/xmlsec1-ooxml.patch.1
@@ -0,0 +1,173 @@
+From b7fb2699e3c383ae40f29369dc57afbd0d52004c Mon Sep 17 00:00:00 2001
+From: Miklos Vajna <vmiklos@collabora.co.uk>
+Date: Mon, 25 Jan 2016 09:50:03 +0100
+Subject: [PATCH] OOXML Relationship Transform skeleton
+
+---
+ include/xmlsec/strings.h | 3 ++
+ include/xmlsec/transforms.h | 4 +++
+ src/strings.c | 3 ++
+ src/transforms.c | 11 ++++++
+ src/xpath.c | 82 +++++++++++++++++++++++++++++++++++++++++++++
+ 5 files changed, 103 insertions(+)
+
+diff --git a/include/xmlsec/strings.h b/include/xmlsec/strings.h
+index 07afb9d..9c72d1b 100644
+--- a/include/xmlsec/strings.h
++++ b/include/xmlsec/strings.h
+@@ -551,6 +551,9 @@ XMLSEC_EXPORT_VAR const xmlChar xmlSecXPath2FilterUnion[];
+ XMLSEC_EXPORT_VAR const xmlChar xmlSecNameXPointer[];
+ XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeXPointer[];
+
++XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRelationship[];
++XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRelationship[];
++
+ /*************************************************************************
+ *
+ * Xslt strings
+diff --git a/include/xmlsec/transforms.h b/include/xmlsec/transforms.h
+index 4008cae..b0e31e4 100644
+--- a/include/xmlsec/transforms.h
++++ b/include/xmlsec/transforms.h
+@@ -961,6 +961,10 @@ XMLSEC_EXPORT int xmlSecTransformXPointerSetExpr (xmlSecTransformPtr transform
+ const xmlChar* expr,
+ xmlSecNodeSetType nodeSetType,
+ xmlNodePtr hereNode);
++
++#define xmlSecTransformRelationshipId xmlSecTransformRelationshipGetKlass()
++XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRelationshipGetKlass (void);
++
+ #ifndef XMLSEC_NO_XSLT
+ /**
+ * xmlSecTransformXsltId:
+diff --git a/src/strings.c b/src/strings.c
+index 9897198..546e993 100644
+--- a/src/strings.c
++++ b/src/strings.c
+@@ -543,6 +543,9 @@ const xmlChar xmlSecXPath2FilterUnion[] = "union";
+ const xmlChar xmlSecNameXPointer[] = "xpointer";
+ const xmlChar xmlSecNodeXPointer[] = "XPointer";
+
++const xmlChar xmlSecNameRelationship[] = "relationship";
++const xmlChar xmlSecHrefRelationship[] = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
++
+ /*************************************************************************
+ *
+ * Xslt strings
+diff --git a/src/transforms.c b/src/transforms.c
+index 2ed3fe8..9e5ad27 100644
+--- a/src/transforms.c
++++ b/src/transforms.c
+@@ -271,6 +271,17 @@ xmlSecTransformIdsRegisterDefault(void) {
+ return(-1);
+ }
+
++ if (xmlSecTransformIdsRegister(xmlSecTransformRelationshipId) < 0)
++ {
++ xmlSecError(XMLSEC_ERRORS_HERE,
++ NULL,
++ "xmlSecTransformIdsRegister",
++ XMLSEC_ERRORS_R_XMLSEC_FAILED,
++ "name=%s",
++ xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformRelationshipId)));
++ return -1;
++ }
++
+ #ifndef XMLSEC_NO_XSLT
+ if(xmlSecTransformIdsRegister(xmlSecTransformXsltId) < 0) {
+ xmlSecError(XMLSEC_ERRORS_HERE,
+diff --git a/src/xpath.c b/src/xpath.c
+index 8b0b4f8..63b02d4 100644
+--- a/src/xpath.c
++++ b/src/xpath.c
+@@ -1144,5 +1144,87 @@ xmlSecTransformVisa3DHackExecute(xmlSecTransformPtr transform, int last,
+ return(0);
+ }
+
++/* OOXML Relationship Transform. */
++typedef struct _xmlSecRelationshipCtx xmlSecRelationshipCtx, *xmlSecRelationshipCtxPtr;
++struct _xmlSecRelationshipCtx
++{
++ xmlParserCtxtPtr parserCtx;
++};
++#define xmlSecRelationshipSize (sizeof(xmlSecTransform) + sizeof(xmlSecRelationshipCtx))
++#define xmlSecRelationshipGetCtx(transform) ((xmlSecRelationshipCtxPtr)(((xmlSecByte*)(transform)) + sizeof(xmlSecTransform)))
++
++static int xmlSecRelationshipInitialize (xmlSecTransformPtr transform);
++static void xmlSecRelationshipFinalize (xmlSecTransformPtr transform);
++static int xmlSecRelationshipReadNode (xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx);
++static int xmlSecRelationshipExecute (xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx);
++
++static xmlSecTransformKlass xmlSecRelationshipKlass =
++{
++ /* klass/object sizes */
++ sizeof(xmlSecTransformKlass), /* xmlSecSize klassSize */
++ xmlSecRelationshipSize, /* xmlSecSize objSize */
++ xmlSecNameRelationship, /* const xmlChar* name; */
++ xmlSecHrefRelationship, /* const xmlChar* href; */
++ xmlSecTransformUsageDSigTransform, /* xmlSecAlgorithmUsage usage; */
++ xmlSecRelationshipInitialize, /* xmlSecTransformInitializeMethod initialize; */
++ xmlSecRelationshipFinalize, /* xmlSecTransformFinalizeMethod finalize; */
++ xmlSecRelationshipReadNode, /* xmlSecTransformNodeReadMethod readNode; */
++ NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
++ NULL, /* xmlSecTransformSetKeyReqMethod setKeyReq; */
++ NULL, /* xmlSecTransformSetKeyMethod setKey; */
++ NULL, /* xmlSecTransformValidateMethod validate; */
++ xmlSecTransformDefaultGetDataType, /* xmlSecTransformGetDataTypeMethod getDataType; */
++ xmlSecTransformDefaultPushBin, /* xmlSecTransformPushBinMethod pushBin; */
++ xmlSecTransformDefaultPopBin, /* xmlSecTransformPopBinMethod popBin; */
++ NULL, /* xmlSecTransformPushXmlMethod pushXml; */
++ NULL, /* xmlSecTransformPopXmlMethod popXml; */
++ xmlSecRelationshipExecute, /* xmlSecTransformExecuteMethod execute; */
++ NULL, /* void* reserved0; */
++ NULL, /* void* reserved1; */
++};
++
++xmlSecTransformId xmlSecTransformRelationshipGetKlass(void)
++{
++ return &xmlSecRelationshipKlass;
++}
++
++static int xmlSecRelationshipInitialize(xmlSecTransformPtr transform)
++{
++ xmlSecRelationshipCtxPtr ctx;
++
++ xmlSecAssert2(xmlSecTransformCheckId(transform, xmlSecTransformRelationshipId), -1);
++ xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecRelationshipSize), -1);
++
++ ctx = xmlSecRelationshipGetCtx(transform);
++ xmlSecAssert2(ctx != NULL, -1);
+
++ /* initialize context */
++ memset(ctx, 0, sizeof(xmlSecRelationshipCtx));
++ return 0;
++}
++
++static void xmlSecRelationshipFinalize(xmlSecTransformPtr transform)
++{
++ xmlSecRelationshipCtxPtr ctx;
++
++ xmlSecAssert(xmlSecTransformCheckId(transform, xmlSecTransformRelationshipId));
++ xmlSecAssert(xmlSecTransformCheckSize(transform, xmlSecRelationshipSize));
++
++ ctx = xmlSecRelationshipGetCtx(transform);
++ xmlSecAssert(ctx != NULL);
++
++ if (ctx->parserCtx != NULL)
++ xmlFreeParserCtxt(ctx->parserCtx);
+
++ memset(ctx, 0, sizeof(xmlSecRelationshipCtx));
++}
++
++static int xmlSecRelationshipReadNode(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx)
++{
++ return 0;
++}
++
++static int xmlSecRelationshipExecute(xmlSecTransformPtr transform, int last, xmlSecTransformCtxPtr transformCtx)
++{
++ return 0;
++}
+--
+2.6.2
+