Port-sparc archive

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

Re: SHA512 hash function crashing



Martin Husemann wrote:
Could you do:

  cd /usr/tests/crypto/libcrypto
  atf-run  | atf-report

and see if this fails too?

Thanks,

Martin

Sunergy# tar zxpf /usr/obj/releasedir/sparc/binary/sets/tests.tgz
Sunergy# cd /usr/tests/crypto/libcrypto
Sunergy# atf-run  | atf-report
Tests root: /usr/tests/crypto/libcrypto

t_libcrypto (1/1): 27 test cases
    bf: Passed.
    cast: Passed.
    des: Passed.
    rc2: Passed.
    rc4: Passed.
idea: Skipped: IDEA support not available; system built with MKCRYPTO_IDEA=no rc5: Skipped: RC5 support not available; system built with MKCRYPTO_RC5=no
    dsa: Passed.
    dh: Passed.
    rsa: Passed.
    ec: Passed.
    ecdh: Passed.
    ecdsa: Passed.
    x509v3: Passed.
    hmac: Passed.
    md2: Passed.
    md4: Passed.
    md5: Passed.
    ripemd: Passed.
    sha: Passed.
mdc2: Skipped: MDC2 support not available; system built with MKCRYPTO_MDC2=no
    engine: Passed.
    rand: Passed.
    bn: Failed: Test case timed out after 300 seconds
    conf: Passed.
    lhash: Passed.
    threads: Passed.

Failed test cases:
    t_libcrypto:bn

Summary for 1 test programs:
    23 passed test cases.
    1 failed test cases.
    3 skipped test cases.
Sunergy#

I'll guess that the bn test failed only because it's running on such a slow machine... Is that sha test case for SHA1, SHA2, or both? Last night, as I was thinking about
it a bit, I did this little test:

Sunergy$ cat x.c
#include <stdio.h>

#include <sys/types.h>
#include <sha2.h>

int main (int argc, char *argv[]) {
  SHA512_CTX ctx;
  uint8_t buf[27] = "abcdefghijklmnopqrstuvwxyz";
  uint8_t result[SHA512_DIGEST_LENGTH];
  int i;

  SHA512_Init (&ctx);
  SHA512_Update (&ctx, buf, sizeof(buf));
  SHA512_Final (result, &ctx);
  for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
    printf ("%2.2x", result[i]);
  }
  printf ("\n");
}
Sunergy$ gcc -g x.c
Sunergy$ gdb a.out
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc--netbsdelf"...
(gdb) run
Starting program: /home/jon/a.out

Program received signal SIGBUS, Bus error.
0x200b8ac0 in _SHA512_Final () from /usr/lib/libc.so.12
(gdb) where
#0  0x200b8ac0 in _SHA512_Final () from /usr/lib/libc.so.12
#1  0x000108ac in main (argc=1, argv=0xefffec4c) at x.c:14
(gdb)

It looks a lot like the example in the man page.  Perhaps I should have
read it a bit more closely at first and copied it, instead of writing my
own... :)   A nearly identical md5 or sha1 version works fine.


Home | Main Index | Thread Index | Old Index