unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch sha1 implementation broken on (some) big-endian architectures
@ 2013-11-24 11:57 David Bremner
  2013-11-24 12:40 ` David Bremner
  2013-11-24 16:42 ` Tomi Ollila
  0 siblings, 2 replies; 12+ messages in thread
From: David Bremner @ 2013-11-24 11:57 UTC (permalink / raw)
  To: notmuch


The following code, when linked with libnotmuch.a and libutil.a does a
passable imitation of sha1sum on amd64 (and I guess also i386) but
computes a different digest on powerpc and probably sparc and s390x.

In the long run we should maybe outsource hash computations to
e.g. librhash, but I'd like a simpler fix for 0.17, if possible

P.S. I blame Austin for adding the "missing-headers" test which found
this bug ;).

/* 8<----------------------------------------- */

#include <stdio.h>

#include "notmuch.h"
char * notmuch_sha1_of_file(const char* filename);

int
main (int argc, char **argv)
{

    char *digest = notmuch_sha1_of_file (argv[1]);

    printf("%s  %s\n",digest,argv[1]);
    return 0;
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-11-27 12:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-24 11:57 notmuch sha1 implementation broken on (some) big-endian architectures David Bremner
2013-11-24 12:40 ` David Bremner
2013-11-24 16:42 ` Tomi Ollila
2013-11-24 21:29   ` [PATCH 1/2] lib: fix byte order test in libsha1.c david
2013-11-24 21:29     ` [PATCH 2/2] NEWS: News for big endian sha1 bug fix david
2013-11-25  3:10       ` Austin Clements
2013-11-26 13:07       ` [PATCH] util: detect byte order david
2013-11-26 17:42         ` Tomi Ollila
2013-11-27  0:38           ` [PATCH v2] " david
2013-11-27  8:04             ` Tomi Ollila
2013-11-27 12:26               ` David Bremner
2013-11-25  9:43     ` [PATCH 1/2] lib: fix byte order test in libsha1.c Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).