[svn] ksba - r287 - in trunk: . src
svn author wk
cvs at cvs.gnupg.org
Thu Feb 21 11:22:30 CET 2008
Author: wk
Date: 2008-02-21 11:22:28 +0100 (Thu, 21 Feb 2008)
New Revision: 287
Modified:
trunk/NEWS
trunk/THANKS
trunk/src/ChangeLog
trunk/src/cms.c
trunk/src/der-encoder.c
Log:
* der-encoder.c (_ksba_der_write_algorithm_identifier): Add hack
to allow not writing the parameter.
* cms.c (store_smime_capability_sequence): Use this hack.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2008-02-12 16:45:46 UTC (rev 286)
+++ trunk/src/ChangeLog 2008-02-21 10:22:28 UTC (rev 287)
@@ -1,3 +1,9 @@
+2008-02-21 Werner Koch <wk at g10code.com>
+
+ * der-encoder.c (_ksba_der_write_algorithm_identifier): Add hack
+ to allow not writing the parameter.
+ * cms.c (store_smime_capability_sequence): Use this hack.
+
2008-02-01 Werner Koch <wk at g10code.com>
* cert.c (get_name): Fix for unknown tags.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2008-02-12 16:45:46 UTC (rev 286)
+++ trunk/NEWS 2008-02-21 10:22:28 UTC (rev 287)
@@ -1,7 +1,9 @@
Noteworthy changes in version 1.0.4
------------------------------------------------
+ * Write smimeCapabilities according to RFC3851 to help Mozilla.
+
Noteworthy changes in version 1.0.3 (2008-02-12)
------------------------------------------------
Modified: trunk/THANKS
===================================================================
--- trunk/THANKS 2008-02-12 16:45:46 UTC (rev 286)
+++ trunk/THANKS 2008-02-21 10:22:28 UTC (rev 287)
@@ -5,6 +5,7 @@
Brad Hards bradh at frogmouth.net
Daiki Ueno ueno at unixuser.org
Peter O'Gorman gnupg-devel at mlists.thewrittenword.com
+Robert Spillner Robert.Spillner at post.rwth-aachen.de
Stéphane Corthésy stephane at sente.ch
Thomas Koester tkoester at intevation.de
Modified: trunk/src/cms.c
===================================================================
--- trunk/src/cms.c 2008-02-12 16:45:46 UTC (rev 286)
+++ trunk/src/cms.c 2008-02-21 10:22:28 UTC (rev 287)
@@ -1,5 +1,5 @@
/* cms.c - cryptographic message syntax main functions
- * Copyright (C) 2001, 2003, 2004 g10 Code GmbH
+ * Copyright (C) 2001, 2003, 2004, 2008 g10 Code GmbH
*
* This file is part of KSBA.
*
@@ -2258,8 +2258,13 @@
}
if (cap2 == cap)
{
+ /* RFC3851 requires that a missing parameter must not be
+ encoded as NULL. This is in contrast to all other usages
+ of the algorithm identifier where ist is allowed and in
+ some profiles (e.g. tmttv2) even explicitly suggested to
+ use NULL. */
err = _ksba_der_write_algorithm_identifier
- (tmpwrt, cap->oid, cap->parmlen?cap->parm:NULL, cap->parmlen);
+ (tmpwrt, cap->oid, cap->parmlen?cap->parm:"", cap->parmlen);
if (err)
{
ksba_writer_release (tmpwrt);
Modified: trunk/src/der-encoder.c
===================================================================
--- trunk/src/der-encoder.c 2008-02-12 16:45:46 UTC (rev 286)
+++ trunk/src/der-encoder.c 2008-02-21 10:22:28 UTC (rev 287)
@@ -1,5 +1,5 @@
/* der-decoder.c - Distinguished Encoding Rules Encoder
- * Copyright (C) 2001, 2004 g10 Code GmbH
+ * Copyright (C) 2001, 2004, 2008 g10 Code GmbH
*
* This file is part of KSBA.
*
@@ -126,7 +126,8 @@
}
where parameters will be set to NULL if parm is NULL or to an octet
- string conating the given parm */
+ string with the given parm. As a special hack parameter will not be
+ written if PARM is given but parmlen is 0. */
gpg_error_t
_ksba_der_write_algorithm_identifier (ksba_writer_t w, const char *oid,
const void *parm, size_t parmlen)
@@ -134,6 +135,7 @@
gpg_error_t err;
unsigned char *buf;
size_t len;
+ int no_null = (parm && !parmlen);
err = ksba_oid_from_str (oid, &buf, &len);
if (err)
@@ -142,9 +144,9 @@
/* write the sequence */
/* fixme: the the length to encode the TLV values are actually not
just 2 byte each but depend on the length of the values - for
- our purposes the static values do work */
+ our purposes the static values do work. */
err = _ksba_ber_write_tl (w, TYPE_SEQUENCE, CLASS_UNIVERSAL, 1,
- 4 + len + (parm? parmlen:0));
+ (no_null? 2:4) + len + (parm? parmlen:0));
if (err)
goto leave;
@@ -156,7 +158,9 @@
goto leave;
/* Write the parameter */
- if (parm)
+ if (no_null)
+ ;
+ else if (parm)
{
err = _ksba_ber_write_tl (w, TYPE_OCTET_STRING, CLASS_UNIVERSAL,
0, parmlen);
More information about the Gnupg-commits
mailing list