summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-02-18 16:31:13 +0200
committerTor Lillqvist <tml@collabora.com>2015-02-18 16:56:30 +0200
commit4ece31faef6279cdb0d7eafa26f696e393649fd4 (patch)
tree64d233f82d0af2a254f55f2c2b64c5b4a8386a3f
parent845dc023352c77d7579c25c1a1f1932ad0d9d9c1 (diff)
tdf#84881: WiP: Handle TimeStampReq::extensions correctly
Also, pass dest as NULL to SEC_ASN1EncodeItem(). Now we can call SECITEM_FreeItem(item, PR_TRUE) on its return value. Change-Id: Ia30b70990971aba15158f97528524d879a04da3c
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index e87aa0a03a38..edd69c9950c0 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6058,7 +6058,7 @@ Extension ::= SEQUENCE {
typedef struct {
SECItem extnID;
- bool critical;
+ SECItem critical;
SECItem extnValue;
} Extension;
@@ -6096,7 +6096,7 @@ typedef struct {
SECItem reqPolicy;
SECItem nonce;
SECItem certReq;
- SECItem extensions;
+ Extension *extensions;
} TimeStampReq;
SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate)
@@ -6271,7 +6271,6 @@ bool PDFWriterImpl::finalizeSignature()
HASH_End(hc.get(), digest.data, &digest.len, SHA1_LENGTH);
hc.clear();
- SECItem dest;
TimeStampReq src;
unsigned char cOne = 1;
@@ -6302,13 +6301,11 @@ bool PDFWriterImpl::finalizeSignature()
src.certReq.data = &cFalse;
src.certReq.len = sizeof(cFalse);
- src.extensions.type = siBuffer;
- src.extensions.data = NULL;
- src.extensions.len = 0;
+ src.extensions = NULL;
- SECItem* item = SEC_ASN1EncodeItem(NULL, &dest, &src, TimeStampReq_Template);
- // SAL_ DEBUG("====> item=" << item << " data=" << (item ? (void*)item->data : nullptr) << " len=" << (item ? item->len : -1));
- (void)item;// SECITEM_FreeItem(item, PR_TRUE); // crashes for some reason
+ SECItem* item = SEC_ASN1EncodeItem(NULL, NULL, &src, TimeStampReq_Template);
+ SAL_INFO("vcl.pdfwriter", "item=" << item << " data=" << (item ? (void*)item->data : nullptr) << " len=" << (item ? item->len : -1));
+ SECITEM_FreeItem(item, PR_TRUE);
NSSCMSMessage *cms_msg = NSS_CMSMessage_Create(NULL);
if (!cms_msg)