unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: notmuch sha1 implementation broken on (some) big-endian architectures
Date: Sun, 24 Nov 2013 07:57:22 -0400	[thread overview]
Message-ID: <87eh666mhp.fsf@zancas.localnet> (raw)


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;
}

             reply	other threads:[~2013-11-24 11:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-24 11:57 David Bremner [this message]
2013-11-24 12:40 ` notmuch sha1 implementation broken on (some) big-endian architectures 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eh666mhp.fsf@zancas.localnet \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).