summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1999-07-26 07:44:40 +0000
committerWerner Koch <wk@gnupg.org>1999-07-26 07:44:40 +0000
commit2418cd21a2ee8c455c8839a45a2a3817dbe5c39b (patch)
tree52e74f6a86be214dd54c6f5cbb22c38c776200e4
parent57424d4195767b0eaf86bf0f997be0a9d9e2eaf9 (diff)
downloadlibgcrypt-2418cd21a2ee8c455c8839a45a2a3817dbe5c39b.tar.gz
See ChangeLog: Mon Jul 26 09:34:46 CEST 1999 Werner Koch
-rw-r--r--ChangeLog7
-rw-r--r--Makefile.am7
-rw-r--r--THANKS1
-rw-r--r--acinclude.m41
-rw-r--r--cipher/ChangeLog5
-rw-r--r--cipher/md5.c5
-rw-r--r--src/gcrypt.h2
-rw-r--r--src/sexp.c109
8 files changed, 127 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 302812aa..b92ca4be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Jul 26 09:34:46 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
+
+
+ * acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): remove init of ac_cv_...
+
+ * Makefile.am (DISCLEANFILES): New
+
Fri Jul 23 13:53:03 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
diff --git a/Makefile.am b/Makefile.am
index 0868a48c..e3add598 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,13 +2,18 @@
if COMPILE_LIBGCRYPT
gcrypt = gcrypt
+my_clean_gcrypt =
else
gcrypt =
+my_clean_gcrypt = gcrypt/Makefile
endif
SUBDIRS = intl zlib util mpi cipher tools g10 po doc checks ${gcrypt}
EXTRA_DIST = VERSION PROJECTS BUGS
-
+# gettext never gets it right, so we take here care of deleting the
+# symlink. my_clean_gcrypt is just a kludge until we can include
+# libgcrypt.
+DISTCLEANFILES = g10defs.h intl/libintl.h ${my_clean_gcrypt}
dist-hook:
@set -e; \
diff --git a/THANKS b/THANKS
index d69fc4ef..c078d197 100644
--- a/THANKS
+++ b/THANKS
@@ -3,6 +3,7 @@ reporting problems, suggesting various improvements or submitting actual
code. Here is a list of those people. Help me keep it complete and free of
errors.
+Allan Clark allanc@sco.com
Anand Kumria wildfire@progsoc.uts.edu.au
Ariel T Glenn ariel@columbia.edu
Bodo Moeller Bodo_Moeller@public.uni-hamburg.de
diff --git a/acinclude.m4 b/acinclude.m4
index 7e549143..5b00dc0b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -575,7 +575,6 @@ case "${target}" in
esac
if test "$tmp_do_check" = "yes"; then
-ac_cv_sys_symbol_underscore=""
AC_REQUIRE([GNUPG_PROG_NM])dnl
AC_REQUIRE([GNUPG_SYS_NM_PARSE])dnl
AC_MSG_CHECKING([for _ prefix in compiled symbols])
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index ae4b51e7..5c6f4a5e 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jul 26 09:34:46 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
+
+
+ * md5.c (md5_final): Fix for a SCO cpp bug.
+
Thu Jul 15 10:15:35 CEST 1999 Werner Koch <wk@isil.d.shuttle.de>
diff --git a/cipher/md5.c b/cipher/md5.c
index a3725466..035eaf11 100644
--- a/cipher/md5.c
+++ b/cipher/md5.c
@@ -301,7 +301,10 @@ md5_final( MD5_CONTEXT *hd )
#define X(a) do { *p++ = hd->##a ; *p++ = hd->##a >> 8; \
*p++ = hd->##a >> 16; *p++ = hd->##a >> 24; } while(0)
#else /* little endian */
- #define X(a) do { *(u32*)p = hd->##a ; p += 4; } while(0)
+ /*#define X(a) do { *(u32*)p = hd->##a ; p += 4; } while(0)*/
+ /* Unixware's cpp doesn't like the above construct so we do it his way:
+ * (reported by Allan Clark) */
+ #define X(a) do { *(u32*)p = (*hd).a ; p += 4; } while(0)
#endif
X(A);
X(B);
diff --git a/src/gcrypt.h b/src/gcrypt.h
index f26e34c8..5172be62 100644
--- a/src/gcrypt.h
+++ b/src/gcrypt.h
@@ -94,7 +94,7 @@ size_t gcry_sexp_sprint( GCRY_SEXP sexp, int mode, char *buffer,
#ifndef GCRYPT_NO_SEXP_MACROS
#define SEXP GCRY_SEXP
-#define SEXP_NEW(a,b) gcry_sexp_new( (a), (b) )
+#define SEXP_NEW(a,b) gcry_sexp_new_data( (a), (b) )
#define SEXP_RELEASE(a) do { gcry_sexp_release( (a) ); (a)=NULL; } while(0)
#define SEXP_CONS(a,b) gcry_sexp_cons((a),(b))
#endif /*GCRYPT_NO_SEXP_MACROS*/
diff --git a/src/sexp.c b/src/sexp.c
index 4b131744..ac2b0f35 100644
--- a/src/sexp.c
+++ b/src/sexp.c
@@ -1,4 +1,4 @@
-/* sexp.c - Sex^H^H-Expression handling
+/* sexp.c - S-Expression handling
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
@@ -138,13 +138,16 @@ dump_sexp( NODE node )
GCRY_SEXP
gcry_sexp_new_data( const char *buffer, size_t length )
{
- NODE node;
+ NODE list, node;
node = m_alloc_clear( sizeof *node + length );
node->type = ntDATA;
node->u.data.len = length;
memcpy(node->u.data.d, buffer, length );
- return node;
+ list = m_alloc_clear( sizeof *list );
+ list->type = ntLIST;
+ list->u.list = node;
+ return list;
}
/****************
@@ -159,24 +162,49 @@ gcry_sexp_release( GCRY_SEXP sexp )
/****************
- * Make a pair from items a and b
+ * Make a pair from lists a and b, don't use a or b alter on.
+ * Special behaviour: If one is a single element list we put the
+ * element straingt into the new pair.
*/
GCRY_SEXP
gcry_sexp_cons( GCRY_SEXP a, GCRY_SEXP b )
{
NODE head;
+ if( a->type != ntLIST ) {
+ fputs("sexp_cons: arg 1 is not a list\n", stderr );
+ return NULL;
+ }
+ if( b->type != ntLIST ) {
+ fputs("sexp_cons: arg 2 is not a list\n", stderr );
+ return NULL;
+ }
+
+
head = m_alloc_clear( sizeof *head );
head->type = ntLIST;
+ if( !a->u.list->next ) { /* a has only one item */
+ NODE tmp = a;
+ a = a->u.list;
+ /* fixme: release tmp here */
+ }
+ if( !b->u.list->next ) { /* b has only one item */
+ NODE tmp = b;
+ b = b->u.list;
+ /* fixme: release tmp here */
+ }
+
head->u.list = a;
a->up = head;
a->next = b;
b->up = head;
+
return head;
}
/****************
* Make a list from all items, the end of list is indicated by a NULL
+ * donī use the passed lists lateron, they are void.
*/
GCRY_SEXP
gcry_sexp_vlist( GCRY_SEXP a, ... )
@@ -184,14 +212,32 @@ gcry_sexp_vlist( GCRY_SEXP a, ... )
NODE head, tail, node;
va_list arg_ptr ;
+ if( a->type != ntLIST ) {
+ fputs("sexp_vlist: arg 1 is not a list\n", stderr );
+ return NULL;
+ }
head = m_alloc_clear( sizeof *node );
head->type = ntLIST;
+ if( !a->u.list->next ) { /* a has only one item */
+ NODE tmp = a;
+ a = a->u.list;
+ /* fixme: release tmp here */
+ }
head->u.list = a;
a->up = head;
tail = a;
va_start( arg_ptr, a ) ;
while( (node = va_arg( arg_ptr, NODE )) ) {
+ if( node->type != ntLIST ) {
+ fputs("sexp_vlist: an arg is not a list\n", stderr );
+ return NULL; /* fixme: we should release alread allocated nodes */
+ }
+ if( !node->u.list->next ) { /* node has only one item */
+ NODE tmp = node;
+ node = node->u.list;
+ /* fixme: release tmp here */
+ }
tail->next = node;
node->up = head;
tail = node;
@@ -286,6 +332,15 @@ gcry_sexp_enum( GCRY_SEXP list, void **context, int mode )
/****************
+ * Get the CAR
+ */
+GCRY_SEXP
+gcry_sexp_car( GCRY_SEXP list )
+{
+ return list;
+}
+
+/****************
* Get data from the car
*/
const char *
@@ -300,6 +355,17 @@ gcry_sexp_car_data( GCRY_SEXP list, size_t *datalen )
}
/****************
+ * Get the CDR
+ */
+GCRY_SEXP
+gcry_sexp_cdr( GCRY_SEXP list )
+{
+ if( list && (list = list->next) )
+ return list;
+ return NULL;
+}
+
+/****************
* Get data from the cdr assuming this is a pair
*/
const char *
@@ -618,7 +684,7 @@ main(int argc, char **argv)
FILE *fp;
GCRY_SEXP s_pk, s_dsa, s_p, s_q, s_g, sexp;
- #if 1
+ #if 0
fp = stdin;
n = fread(buffer, 1, 5000, fp );
rc = gcry_sexp_sscan( &sexp, buffer, n, &erroff );
@@ -661,7 +727,38 @@ main(int argc, char **argv)
if( argc > 2 ) /* get the MPI out of the list */
- #if 0
+ #if 1
+ {
+ GCRY_SEXP s2;
+ const char *p;
+ size_t n;
+
+ p = gcry_sexp_car_data( s1, &n );
+ if( !p ) {
+ fputs("no CAR\n", stderr );
+ exit(1);
+ }
+ fprintf(stderr, "CAR=`%.*s'\n", (int)n, p );
+
+ p = gcry_sexp_cdr_data( s1, &n );
+ if( !p ) {
+ s2 = gcry_sexp_cdr( s1 );
+ if( !s2 ) {
+ fputs("no CDR at all\n", stderr );
+ exit(1);
+ }
+ p = gcry_sexp_car_data( s2, &n );
+ }
+ if( !p ) {
+ fputs("no CDR data\n", stderr );
+ exit(1);
+ }
+ fprintf(stderr, "CDR=`%.*s'\n", (int)n, p );
+
+
+
+ }
+ #elif 0
{
GCRY_SEXP s2;
MPI a;