[svn] ksba - r273 - in trunk: . src
svn author wk
cvs at cvs.gnupg.org
Mon May 14 10:29:44 CEST 2007
Author: wk
Date: 2007-05-14 10:29:14 +0200 (Mon, 14 May 2007)
New Revision: 273
Modified:
trunk/NEWS
trunk/TODO
trunk/src/ChangeLog
trunk/src/cert.c
trunk/src/crl.c
trunk/src/keyinfo.c
trunk/src/ksba.m4
trunk/src/sexp-parse.h
trunk/src/util.h
Log:
src/
* sexp-parse.h (smklen): New.
* cert.c: Include sexp-parse.h.
(get_name): Use smklen to avoid the snprintf.
* ksba.m4: Print found version on success.
* crl.c (do_hash): Cast BUFFER to char* for arithmetics.
* ksba.h (ksba_stop_reason_t): Remove trailing comma.
* asn1-parse.y (CONST_IMPLICIT): Ditto. Reported by Peter
O'Gorman.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/NEWS 2007-05-14 08:29:14 UTC (rev 273)
@@ -7,7 +7,9 @@
* Experimental support for ECDSA.
+ * Minor portability fixes.
+
Noteworthy changes in version 1.0.1 (2006-11-29)
------------------------------------------------
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/TODO 2007-05-14 08:29:14 UTC (rev 273)
@@ -14,8 +14,8 @@
** should work on a stripped down parse tree
-** Allow to specify the desired top element. Or a list so that it
- can detect the needed tree itself
+** Allow to specify the desired top element.
+ Or a list so that it can detect the needed tree itself
* src/der-encoder.c
** Setting default values is missing
@@ -64,3 +64,8 @@
** Allow fetching of all entry extensions.
+
+
+
+
+
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/src/ChangeLog 2007-05-14 08:29:14 UTC (rev 273)
@@ -1,3 +1,13 @@
+2007-05-14 Werner Koch <wk at g10code.com>
+
+ * sexp-parse.h (smklen): New.
+ * cert.c: Include sexp-parse.h.
+ (get_name): Use smklen to avoid the snprintf.
+
+2007-05-09 Werner Koch <wk at g10code.com>
+
+ * ksba.m4: Print found version on success.
+
2007-05-01 Werner Koch <wk at g10code.com>
* crl.c (do_hash): Cast BUFFER to char* for arithmetics.
Modified: trunk/src/cert.c
===================================================================
--- trunk/src/cert.c 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/src/cert.c 2007-05-14 08:29:14 UTC (rev 273)
@@ -31,8 +31,10 @@
#include "ber-help.h"
#include "convert.h"
#include "keyinfo.h"
+#include "sexp-parse.h"
#include "cert.h"
+
static const char oidstr_subjectKeyIdentifier[] = "2.5.29.14";
static const char oidstr_keyUsage[] = "2.5.29.15";
static const char oidstr_subjectAltName[] = "2.5.29.17";
@@ -664,15 +666,16 @@
}
else if (ti.tag == 2 || ti.tag == 6)
{ /* dNSName or URI - this are implicit IA5_STRINGs */
- char numbuf[30];
+ char numbuf[20], *numbufp;
+ size_t numbuflen;
- snprintf (numbuf, DIM(numbuf), "%lu:", ti.length);
- p = xtrymalloc (11 + strlen (numbuf) + ti.length + 3);
+ numbufp = smklen (numbuf, DIM(numbuf), ti.length, &numbuflen);
+ p = xtrymalloc (11 + numbuflen + ti.length + 3);
if (!p)
return gpg_error (GPG_ERR_ENOMEM);
*result = p;
p = stpcpy (p, ti.tag == 2? "(8:dns-name" : "(3:uri");
- p = stpcpy (p, numbuf);
+ p = stpcpy (p, numbufp);
memcpy (p, der, ti.length);
p += ti.length;
*p++ = ')';
Modified: trunk/src/crl.c
===================================================================
--- trunk/src/crl.c 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/src/crl.c 2007-05-14 08:29:14 UTC (rev 273)
@@ -59,7 +59,7 @@
crl->hashbuf.buffer, crl->hashbuf.used);
crl->hashbuf.used = 0;
}
- buffer += n;
+ buffer = (const char *)buffer + n;
length -= n;
}
}
Modified: trunk/src/keyinfo.c
===================================================================
--- trunk/src/keyinfo.c 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/src/keyinfo.c 2007-05-14 08:29:14 UTC (rev 273)
@@ -20,8 +20,8 @@
*/
/* Instead of using the ASN parser - which is easily possible - we use
- a simple handcoded one to speed the oepration up and make it more
- robust. */
+ a simple handcoded one to speed up the operation and to make it
+ more robust. */
#include <config.h>
#include <stdio.h>
Modified: trunk/src/ksba.m4
===================================================================
--- trunk/src/ksba.m4 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/src/ksba.m4 2007-05-14 08:29:14 UTC (rev 273)
@@ -75,7 +75,7 @@
fi
fi
if test $ok = yes; then
- AC_MSG_RESULT(yes)
+ AC_MSG_RESULT([yes ($ksba_config_version)])
else
AC_MSG_RESULT(no)
fi
Modified: trunk/src/sexp-parse.h
===================================================================
--- trunk/src/sexp-parse.h 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/src/sexp-parse.h 2007-05-14 08:29:14 UTC (rev 273)
@@ -1,5 +1,5 @@
/* sexp-parse.h - S-expression helper functions for canonical encodings.
- * Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ * Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -97,4 +97,34 @@
return 1;
}
+
+/* Format VALUE for use as the length indicatior of an S-expression.
+ The caler needs to provide a buffer HELP_BUFFER wth a length of
+ HELP_BUFLEN. The return value is a pointer into HELP_BUFFER with
+ the formatted length string. The colon and a trailing nul are
+ appended. HELP_BUFLEN must be at least 3 - a more useful value is
+ 15. If LENGTH is not NULL, the LENGTH of the resulting string
+ (excluding the terminating nul) is stored at that address. */
+static inline char *
+smklen (char *help_buffer, size_t help_buflen, size_t value, size_t *length)
+{
+ char *p = help_buffer + help_buflen;
+
+ if (help_buflen >= 3)
+ {
+ *--p = 0;
+ *--p = ':';
+ do
+ {
+ *--p = '0' + (value % 10);
+ value /= 10;
+ }
+ while (value && p > help_buffer);
+ }
+
+ if (length)
+ *length = (help_buffer + help_buflen) - p;
+ return p;
+}
+
#endif /*SEXP_PARSE_H*/
Modified: trunk/src/util.h
===================================================================
--- trunk/src/util.h 2007-05-01 16:25:43 UTC (rev 272)
+++ trunk/src/util.h 2007-05-14 08:29:14 UTC (rev 273)
@@ -50,11 +50,12 @@
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
#define DIMof(type,member) DIM(((type *)0)->member)
#ifndef STR
- #define STR(v) #v
+# define STR(v) #v
#endif
-#define STR2(v) STR(v)
+#ifndef STR2
+# define STR2(v) STR(v)
+#endif
-
#define return_if_fail(expr) do { \
if (!(expr)) { \
fprintf (stderr, "%s:%d: assertion `%s' failed\n", \
@@ -100,9 +101,3 @@
#endif /* UTIL_H */
-
-
-
-
-
-
More information about the Gnupg-commits
mailing list