chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] possible bug in simple-sha1


From: Kristian Lein-Mathisen
Subject: Re: [Chicken-hackers] possible bug in simple-sha1
Date: Mon, 3 Jun 2019 10:11:07 +0200


That fixes it Vasilij! Thanks a lot.

Felix, can you get this fix upstream? These steps worked for me:

1005 address@hidden ~/.c/c/simple-sha1  ➤ wget https://raw.githubusercontent.com/clibs/sha1/master/sha1.h
1005 address@hidden ~/.c/c/simple-sha1  ➤ mv sha1.h.1 sha1.h
1005 address@hidden ~/.c/c/simple-sha1  ➤ wget https://raw.githubusercontent.com/clibs/sha1/master/sha1.c
1005 address@hidden ~/.c/c/simple-sha1  ➤ mv sha1.c sha1-base.c
1005 address@hidden ~/.c/c/simple-sha1  ➤ mg simple-sha1.scm # edit to look like this:
1009 address@hidden ~/.c/c/simple-sha1  ➤ git diff -U0 simple-sha1.scm
diff --git a/simple-sha1.scm b/simple-sha1.scm
index 2289bb1..3991eb3 100644
--- a/simple-sha1.scm
+++ b/simple-sha1.scm
@@ -23 +23 @@
-(define finish (foreign-lambda void "SHA1Final" c-pointer scheme-pointer))
+(define finish (foreign-lambda void "SHA1Final" scheme-pointer c-pointer))
@@ -40 +40 @@
-    (finish ctxt digest)
+    (finish digest ctxt)
@@ -76 +76 @@
-        (finish ctxt digest)
+        (finish digest ctxt)


Thanks, everyone :-)
K.

On Sun, Jun 2, 2019 at 6:13 PM Vasilij Schneidermann <address@hidden> wrote:
Hello Kristian,

I cannot reproduce the bug if I use sha1-base.c directly with a C
program that feeds small chunks instead of doing it in one go.  florz
pointed out a dodgy piece of code in the SHA1Update function, I've
updated it to the latest version found on GitHub [1] and the bug went
away.

You'll also want to update the sha1 egg while you're at it.  Peter Bex
pointed out it's using the same sha1-base.c file, the fix should apply
for it as well.

Vasilij

[1]: https://raw.githubusercontent.com/clibs/sha1/master/sha1.c

reply via email to

[Prev in Thread] Current Thread [Next in Thread]