[hashcash] Re: Difficulty linking to hashcash

  • From: Adam Back <adam@xxxxxxxxxxxxxxx>
  • To: hashcash@xxxxxxxxxxxxx
  • Date: Tue, 11 Jan 2005 16:27:49 -0500

Yes I started working on hashcash-0.15 changes a few weeks back and
one of the things I tried was to build with openSSL.  I think since
Jonathan's fastmint code went in the openSSL compile no longer worked.

(The code makes some assumptions about SHA1 implementation internals
or something like that).  The next version should fix that problem I
added some more lower level API portability macros between openSSL and
my SHA1 code.

I think the symbol clash may be related to the changes I made, so will
check that also.  I added more macros to work around things related to
this so may have fixed.

Can certainly add a .a target also.  The windows (MINGW) build creates
a DLL which is the analogous thing for windows.

Adam

On Tue, Jan 04, 2005 at 10:33:38PM -0800, "Hal Finney" wrote:
> I am updating my rpow.net program to use the latest version of hashcash.
> I decided to let users download and build hashcash, then my program will
> link to the necessary object modules from the hashcash directory to let
> my program mint or verify hashcash.
> 
> I have two problems.  The first is that although hashcash is structured
> to allow it, the hashcash makefile does not build a library of the
> object modules.  This means that I have to explicitly list all of the
> required hashcash object files in my makefile.  It looks like this:
> 
> HCOBJS = $(HCDIR)/libhc.o $(HCDIR)/sdb.o $(HCDIR)/lock.o $(HCDIR)/libsha1.o \
>         $(HCDIR)/utct.o $(HCDIR)/random.o $(HCDIR)/sstring.o \
>         $(HCDIR)/libfastmint.o $(HCDIR)/fastmint_mmx_standard_1.o \
>         $(HCDIR)/fastmint_mmx_compact_1.o $(HCDIR)/fastmint_ansi_compact_1.o \
>         $(HCDIR)/fastmint_ansi_standard_1.o \
>         $(HCDIR)/fastmint_ansi_compact_2.o \
>         $(HCDIR)/fastmint_ansi_standard_2.o \
>         $(HCDIR)/fastmint_altivec_standard_1.o \
>         $(HCDIR)/fastmint_altivec_standard_2.o \
>         $(HCDIR)/fastmint_altivec_compact_2.o \
>         $(HCDIR)/fastmint_ansi_ultracompact_1.o $(HCDIR)/fastmint_library.o
> 
> The second problem is that I do some bignum calculations, so I also link
> to libcrypto.a, the OpenSSL crypto library which is widely available on
> Linux systems.  This causes duplicate symbol errors at link time with
> the SHA1 functions: SHA1_Init etc.  These same names are used in OpenSSL.
> 
> I tried eliminating hashcash's libsha1.o file from my link, which
> eliminated the duplicate symbol errors.  However, this means that the
> OpenSSL SHA1 code is being used instead, and I think it has a different
> SHA1_ctx definition, or some other incompatibility.  I get a bus error
> in the hashcash code during minting.
> 
> At this point my solution is that people would have to download hashcash,
> then I will have them patch it to rename the colliding SHA1 functions.
> Then they will build hashcash, and finally build my program.  I'd like
> to avoid that patching step if possible, but it would require hashcash
> to choose a different name for the SHA1 functions.  Or perhaps there is
> some other trick to fix this.
> 
> Thanks,
> 
> Hal Finney

Other related posts: