[prev in list] [next in list] [prev in thread] [next in thread]
List: gnupg-commit-watchers
Subject: [gnutls-commits]cvs: opencdk /src ChangeLog stream.c verify.c /tests t-stream.c
From: "Timo Schulz" <twoaday () gnutls ! org>
Date: 2002-10-31 16:04:42
[Download RAW message or body]
twoaday Thu Oct 31 17:04:42 2002 EDT
Modified files:
/opencdk/src ChangeLog stream.c verify.c
/opencdk/tests t-stream.c
Log:
2002-10-31 Timo Schulz <ts@winpt.org>
* verify.c (cdk_verify_cleartext): Fixed md calculation.
Index: opencdk/src/ChangeLog
diff -u opencdk/src/ChangeLog:1.22 opencdk/src/ChangeLog:1.23
--- opencdk/src/ChangeLog:1.22 Wed Oct 30 15:04:03 2002
+++ opencdk/src/ChangeLog Thu Oct 31 17:04:42 2002
@@ -1,3 +1,7 @@
+2002-10-31 Timo Schulz <ts@winpt.org>
+
+ * verify.c (cdk_verify_cleartext): Fixed md calculation.
+
2002-10-30 Timo Schulz <ts@winpt.org>
* sig-check.c (hash_mpi_array): New.
Index: opencdk/src/stream.c
diff -u opencdk/src/stream.c:1.17 opencdk/src/stream.c:1.18
--- opencdk/src/stream.c:1.17 Wed Oct 30 01:08:36 2002
+++ opencdk/src/stream.c Thu Oct 31 17:04:42 2002
@@ -20,7 +20,6 @@
#include <stdio.h>
#include <sys/stat.h>
-#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -840,7 +839,7 @@
buf[i++] = c;
count--;
}
- return i;
+ return i;
}
Index: opencdk/src/verify.c
diff -u opencdk/src/verify.c:1.14 opencdk/src/verify.c:1.15
--- opencdk/src/verify.c:1.14 Wed Oct 30 15:04:03 2002
+++ opencdk/src/verify.c Thu Oct 31 17:04:42 2002
@@ -131,12 +131,26 @@
}
+static int
+stream_peek (CDK_STREAM inp, char *s, size_t count)
+{
+ unsigned off;
+ int nbytes;
+
+ off = cdk_stream_tell (inp);
+ nbytes = _cdk_stream_gets (inp, s, count);
+ cdk_stream_seek (inp, off);
+
+ return nbytes;
+}
+
+
int
cdk_verify_cleartext (CDK_HD hd, const char *file)
{
CDK_STREAM inp = NULL, tmp = NULL;
GCRY_MD_HD md = NULL;
- char buf[512];
+ char buf[512], chk[512];
const char *s;
int rc = 0;
int i, is_signed = 0;
@@ -190,20 +204,26 @@
goto leave;
}
+ s = "-----BEGIN PGP SIGNATURE-----";
while (!cdk_stream_eof (inp))
{
nbytes = _cdk_stream_gets (inp, buf, sizeof buf-1);
if (!nbytes)
break;
- if (!strncmp (buf, "- ", 2))
- memmove (buf, buf + 2, nbytes - 2);
- if (!strncmp (buf, "-----BEGIN PGP SIGNATURE-----", 28))
+ if (!strncmp (buf, s, strlen (s)))
break;
else
{
- _cdk_trim_string (buf, 0);
+ stream_peek (inp, chk, sizeof chk-1);
+ i = strncmp (chk, s, strlen (s));
+ if (strlen (buf) == 0 && i == 0)
+ continue; /* skip last '\n' */
+
+ _cdk_trim_string (buf, i == 0? 0 : 1);
gcry_md_write (md, buf, strlen (buf));
}
+ if (!strncmp (buf, "- ", 2))
+ memmove (buf, buf + 2, nbytes - 2);
}
tmp = cdk_stream_tmp ();
Index: opencdk/tests/t-stream.c
diff -u opencdk/tests/t-stream.c:1.14 opencdk/tests/t-stream.c:1.15
--- opencdk/tests/t-stream.c:1.14 Wed Oct 30 15:04:03 2002
+++ opencdk/tests/t-stream.c Thu Oct 31 17:04:42 2002
@@ -453,7 +453,7 @@
#if 0
if (argc > 1)
stream_clearsign (argv[1]);
- #endif
+ #endif
if (argc > 1)
stream_verify (argv[1]);
#if 0
_______________________________________________
Gnutls-commits mailing list
Gnutls-commits@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnutls-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic