From: Michal Rokos Date: 2002-02-10T00:00:41+09:00 Subject: Re: Can't use md5.rb with openssl on RedHat 7.2 Hello, Hash implementation functions in ext/digest/md5 are named: -------------------------------- void MD5_Init _((MD5_CTX *pms)); void MD5_Update _((MD5_CTX *pms, const uint8_t *data, size_t nbytes)); void MD5_Final _((uint8_t *digest, MD5_CTX *pms)); void MD5_End _((MD5_CTX *pctx, uint8_t *hexdigest)); -------------------------------- In openssl there are the same function: -------------------------------- void MD5_Init(MD5_CTX *c); void MD5_Update(MD5_CTX *c, const void *data, unsigned long len); void MD5_Final(unsigned char *md, MD5_CTX *c); -------------------------------- (The interfaces' names are given by some standard.) If you rename Ruby's ext interfaces (like MD5_Init -> MD5_Init_R) all starts work again! It's very strange, but seems to me like Ruby's ext lib functions are calling in fact openssl's functions (if they have the same names). Michal PS: To Ruby-talk guys: Can anybody say more about? PPS: The ruby-1.6.6 has the same behaviour. On Thu, Dec 13, 2001 at 01:30:29PM +0900, TAKEMURA Masahiro wrote: > I happen to meet strange phenomenon. Please show following examples > > example1: > require 'openssl' > require 'md5' > > print "#{MD5.new("abc")}\n" > ----- > result1: > 7c894eea7d5209446e74288bd514863f > ----- > example2: > require 'openssl' > require 'md5' > > > print "#{MD5.new("abc")}\n" > ----- > result2: > test.rb:5: [BUG] Segmentation fault > ruby 1.6.5 (2001-11-23) [i686-linux] > Aborted > ----- > example3: > require 'md5' > require 'openssl' > > print "#{MD5.new("abc")}\n" > ----- > result3: > 900150983cd24fb0d6963f7d28e17f72 > ----- > Difference between example1 and example2 is only number of empty lines. > In example3, change the order of reading libraries. > > Only example3 returns right answer. > Why this problem was occured. > > This problem is occured only on Redhat 7. > Not occured on FreeBSD > > > ENVIRONMENT: > > OS: RedHat Linux 7.2 (this phenomenon is occured when using 7.1) > OpenSSL 0.9.6b > ruby-1.6.5-2001.11.23 > ossl-0.0.9 compiled with gcc version 2.95.3 20010315 (release) > (I can't make with pre-installed 2.96) > > -- > Masahiro TAKEMURA : mastk@nifty.com -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michal Rokos Czech Technical University, Prague E-mail: m.rokos@sh.cvut.cz Jabber: majkl@jabber.cz, ICQ: 36118339 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-