The 'openssl <some_digest>' command produces incorrect results when
linked dynamically against the (newly created) libssl.so.0.9.6,
libcrypto.so.0.9.6.  It seems to ignore the selected hash algorithm
and displays the md5 hash instead. 

$ ./openssl version
OpenSSL 0.9.6g [engine] 9 Aug 2002
$ ldd ./openssl
        libssl.so.0.9.6 => /usr/lib/libssl.so.0.9.6 (0x40017000)
        libcrypto.so.0.9.6 => /usr/lib/libcrypto.so.0.9.6 (0x400ce000)
        libc.so.6 => /lib/libc.so.6 (0x40191000)
        libdl.so.2 => /lib/libdl.so.2 (0x40274000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
$ echo abc|./openssl md5
0bee89b07a248e27c83fc3d5951213c1
$ echo abc|./openssl sha1
0bee89b07a248e27c83fc3d5951213c1
$ echo abc|./openssl md2
0bee89b07a248e27c83fc3d5951213c1



When linked to the newly created libssl.a, libcrypto.a, however,
the results seem correct.

$ ./openssl version
OpenSSL 0.9.6g [engine] 9 Aug 2002
$ ldd ./openssl
        libc.so.6 => /lib/libc.so.6 (0x40017000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
$ echo abc|./openssl md5
0bee89b07a248e27c83fc3d5951213c1
$ echo abc|./openssl sha1
03cfd743661f07975fa2f1220c5194cbaff48451
$ echo abc|./openssl md2
03e6b5ea837cde8acb18e612e0fe6f12



I suspect that the problem lies with the part of the program that
collects the arguments and options.  Eg.  the statically linked
executable works as expected with the following arguments:

$ echo abc|./openssl dgst -sha1
03cfd743661f07975fa2f1220c5194cbaff48451


The dynamically linked executable fails to parse the arguments and
gives an error:

$ echo abc|./openssl dgst -sha1
unknown option '-sha1'
options are
-c              to output the digest with separating colons
-d              to output debug info
-hex            output as hex dump
-binary         output in binary form
-sign   file    sign digest using private key in file
-verify file    verify a signature using public key in file
-prverify file  verify a signature using private key in file
-signature file signature to verify
-binary         output in binary form
-engine e       use engine e, possibly a hardware device.
-md5 to use the md5 message digest algorithm (default)
-md4 to use the md4 message digest algorithm
-md2 to use the md2 message digest algorithm
-sha1 to use the sha1 message digest algorithm
-sha to use the sha message digest algorithm
-mdc2 to use the mdc2 message digest algorithm
-ripemd160 to use the ripemd160 message digest algorithm




This bug is not specific to version 0.9.6g and must have been
introduced in version 0.9.6e, or perhaps earlier.



OpenSSL self-test report:
-------------------------
OpenSSL version:  0.9.6g
Last change:      [In 0.9.6g-engine release:]...
Options:          no-hw
OS (uname):       Linux unknown 2.4.18 #1 Sat Jul 13 00:00:00 GMT 2002 i686 unknown
OS (config):      i686-whatever-linux2
Target (default): linux-elf
Target:           linux-elf
Compiler:         gcc version 2.95.2 19991024 (release)

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to