Opened 10 years ago

Closed 8 years ago

Last modified 4 years ago

#2630 closed enhancement (obsolete)

ruby digest patch

Reported by: do5mc Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Kamikaze trunk
Keywords: ruby digest package Cc:


It would be nice (and saves flash) to use digest algos without the ruby-openssl and libopenssl package. As far as I unterstand, the digests should be useable without the openssl stuff.

I tried the attached patch (creates new package ruby-digest), but got following error message:

root@OpenWrt:~# irb
irb(main):001:0> require 'digest/md5'
LoadError: File not found - /usr/lib/ruby/1.8/mipsel-linux/digest/
        from /usr/lib/ruby/1.8/mipsel-linux/digest/
        from (irb):1
irb(main):002:0> quit

Shared object files for digest algos are installed:

root@OpenWrt:/usr/lib/ruby/1.8/mipsel-linux/digest# ls 

Attachments (3)

001-ruby-digest.patch (1.9 KB) - added by do5mc 10 years ago.
md5.log (3.7 KB) - added by do5mc 10 years ago.
strace irb require digest/md5
002-ruby-digest.patch (2.0 KB) - added by b.candler@… 10 years ago.
Try this

Download all attachments as: .zip

Change History (9)

Changed 10 years ago by do5mc

comment:1 Changed 10 years ago by do5mc

I have made another test and used strace to see (md5.log), what happened, when loading digest/ and libopenssl is not installed (ipkg remove -force-depends libopenssl).

Changed 10 years ago by do5mc

strace irb require digest/md5

comment:2 Changed 10 years ago by b.candler@…

strace shows it's trying to load libcrypto, which is part of openssl. This is because it's linked in:

$ find ext/digest -name Makefile | xargs grep crypto
ext/digest/md5/Makefile:LIBS = $(LIBRUBYARG_SHARED) -lcrypto  -ldl -lcrypt -lm  -lc
ext/digest/sha1/Makefile:LIBS = $(LIBRUBYARG_SHARED) -lcrypto  -ldl -lcrypt -lm   -lc
ext/digest/rmd160/Makefile:LIBS = $(LIBRUBYARG_SHARED) -lcrypto  -ldl -lcrypt -lm   -lc

If you look at ext/digest/md5/extconf.rb :

if !with_config("bundled-md5") &&
    have_library("crypto") && have_header("openssl/md5.h")
  $objs << "md5ossl.#{$OBJEXT}"

  $objs << "md5.#{$OBJEXT}"

similarly in ext/digest/sha1/extconf.rb, ext/digest/rmd160/extconf.rb

So as far as I can tell, you would at least need to add the following to CONFIGURE_ARGS

        --with-bundled-md5 \
        --with-bundled-sha1 \
        --with-bundled-rmd160 \

and there might be other extconf.rb changes to prevent openssl being linked. (Alternatively, you could just build ruby inside an OpenWrt buildroot which doesn't have libopenssl present)

Note: if you achieve this, i.e. being able to use digests without openssl, the downside would be a *larger* overall flash usage for those people who already have libopenssl installed for other reasons :-( But I don't suppose it would be that much.

Changed 10 years ago by b.candler@…

Try this

comment:3 Changed 10 years ago by b.candler@…

This now appears to build correctly without -lcrypto dependency, but I haven't tested that it actually works. When building for x86:

ruby-openssl 102114

ruby-openssl  82772
ruby-digest   27613

So the overhead is about 8K.

comment:4 Changed 10 years ago by b.candler@…

... but for people who want digests without openssl, the saving is 483048 + 102114 - 27613 = 557,549 bytes :-)

comment:5 Changed 8 years ago by spudz76

  • Resolution set to obsolete
  • Status changed from new to closed
  • Version set to Kamikaze trunk

[patchteam] This seems obsolete, if it is still reproducible with recent versions please open a new ticket.

comment:6 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.