On 2019年04月10日 14:53, Yu, Mingli wrote:
On 2019年04月10日 14:37, Yu, Mingli wrote:
On 2019年04月10日 14:25, Niels Möller wrote:
"Yu, Mingli" mingli.yu@windriver.com writes:
It's 3.4.1 and I did use it as below: # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
That's the latest version.
Can you get a backtrace? (start "gdb nettle-pbkdf2", at the gdb prompt
I don't know how to use nettle-pbkdf2 actually and it didn't return when I run as below: # nettle-pbkdf2 -i 1 -l 16 salt
Sorry, it wants to read the input password on stdin. Try echo foo > /tmp/foo, and then start it in gdb as
run nettle-pbkdf2 -i 1 -l 16 salt < /tmp/foo
# echo -n passwd|nettle-pbkdf2 -i 1 -l 16 salt [77641.250170] nettle-pbkdf2[806]: segfault at ffffffffcb811260 ip 00007f4c115fd998 sp 00007ffc5a7f38d0 error 5 in libnettle.so.6.5[7f4c115eb] [77641.250574] Code: e8 6d db fe ff 44 01 6d 68 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 49 89 dc e9 68 ff f Segmentation fault
# echo -n passwd > /tmp/passwd # gdb nettle-pbkdf2 GNU gdb (GDB) 8.2.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-wrs-linux". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.
For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from nettle-pbkdf2...(no debugging symbols found)...done. (gdb) run nettle-pbkdf2 -i 1 -l 16 salt < /tmp/passwd Starting program: /usr/bin/nettle-pbkdf2 nettle-pbkdf2 -i 1 -l 16 salt < /tmp/passwd Usage: nettle-pbkdf2 [OPTIONS] SALT Options: --help Show this help. -V, --version Show version information. -i, --iterations=COUNT Desired iteration count (default 10000). -l, --length=LENGTH Desired output length (octets, default 16) --raw Raw binary output. --hex-salt Use hex encoding for the salt. [Inferior 1 (process 793) exited with code 01] (gdb) quit
It's weird, this time I get the backstace with gdb as below:
(gdb) run -i 1 -l 16 salt < /tmp/passwd Starting program: /usr/bin/nettle-pbkdf2 -i 1 -l 16 salt < /tmp/passwd
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7fad998 in nettle_sha256_update () from /usr/lib64/libnettle.so.6 (gdb) bt #0 0x00007ffff7fad998 in nettle_sha256_update () from /usr/lib64/libnettle.so.6 #1 0x00007ffff7fa9bb6 in nettle_pbkdf2 () from /usr/lib64/libnettle.so.6 #2 0x00007ffff7fa9dd3 in nettle_pbkdf2_hmac_sha256 () from /usr/lib64/libnettle.so.6 #3 0x000055555555544c in ?? () #4 0x00007ffff7dfdb6b in __libc_start_main (main=0x5555555551a0, argc=6, argv=0x7fffffffebc8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffebb8) at ../csu/libc-start.c:308 #5 0x00005555555555ba in ?? ()
(gdb) r -i 1 -l 16 salt < /tmp/passwd Starting program: /usr/bin/nettle-pbkdf2 -i 1 -l 16 salt < /tmp/passwd
Program received signal SIGSEGV, Segmentation fault. nettle_sha256_update (ctx=0x7fffffffe5c0, length=<optimized out>, data=0x55559260 <error: Cannot access memory at address 0x55559260>) at ../nettle-3.4.1/sha256.c:99 99 ../nettle-3.4.1/sha256.c: No such file or directory. (gdb) bt #0 nettle_sha256_update (ctx=0x7fffffffe5c0, length=<optimized out>, data=0x55559260 <error: Cannot access memory at address 0x55559260>) at ../nettle-3.4.1/sha256.c:99 #1 0x00007ffff7fa9bb6 in nettle_pbkdf2 (mac_ctx=mac_ctx@entry=0x7fffffffe4e0, update=0x7ffff7fa7cb0 <nettle_hmac_sha256_update>, digest=0x7ffff7fa7cc0 <nettle_hmac_sha256_digest>, digest_size=digest_size@entry=32, iterations=iterations@entry=1, salt_length=salt_length@entry=4, salt=0x55559260 <error: Cannot access memory at address 0x55559260>, length=16, dst=0x55555555a290 "") at ../nettle-3.4.1/pbkdf2.c:78 #2 0x00007ffff7fa9dd3 in nettle_pbkdf2_hmac_sha256 ( key_length=<optimized out>, key=<optimized out>, iterations=1, salt_length=4, salt=0x55559260 <error: Cannot access memory at address 0x55559260>, length=16, dst=0x55555555a290 "") at ../nettle-3.4.1/pbkdf2-hmac-sha256.c:51 #3 0x000055555555544c in main (argc=<optimized out>, argv=<optimized out>) at ../../nettle-3.4.1/tools/nettle-pbkdf2.c:167
Seems it breaks here in sha256_update function of sha256.c MD_UPDATE (ctx, length, data, COMPRESS, ctx->count++);
# cat /tmp/passwd passwd
What kind of machine, operating system, and compiler are you using? Since the testsuite passes on the test systems (including x86_64 and
I work on x86_64 and use gcc for compiler.
cross-compile setup for arm and mips), I imagine it's something somewhat unusual.
Regards, /Niels
nettle-bugs mailing list nettle-bugs@lists.lysator.liu.se http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs
nettle-bugs mailing list nettle-bugs@lists.lysator.liu.se http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs