Mailing List Archive

How to compile libgcrypt.dll
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Hi --

Below are the steps necessary to compile libgcrypt v1.2.1 into a
Windows DLL:

0.) Download & install MinGW, MSYS, and msysDTK
(http://www.mingw.org/)

1.) Within an MSYS shell, compile and install libgpg-error:

$ tar xjf libgpg-error-1.0.tar.bz2
$ cd libgpg-error-1.0
$ ./configure && make && make install

2.) Download this patch into the '~/libgcrypt-1.2.1' directory
and apply it to the libgcrypt sources:
http://www.securitypunk.com/misc/libgcrypt_dll.patch

$ tar xjf libgcrypt-1.2.1.tar.bz2
$ cd libgcrypt-1.2.1
$ patch -p1 < libgcrypt_dll.patch

3.) Regenerate the 'configure' script:

$ aclocal -I .
$ automake --add-missing --copy
$ autoconf

4.) Compile and install:

$ ./configure && make && make install

5.) Download the DLL export list into the '~/libgcrypt-1.2.1'
directory and build the DLL:
http://www.securitypunk.com/misc/libgcrypt.def

$ gcc -shared -o libgcrypt.dll libgcrypt.def \
/usr/local/lib/libgcrypt.a /usr/local/lib/libgpg-error.a

6.) Optionally, you may want to strip the DLL file of debugging
symbols, as this will shrink the file size down from ~3MB to
~300KB:

$ strip libgcrypt.dll

7.) If you are going to use MSYS to continue developing with
the libgcrypt DLL, you need to remove the installed
'libgcrypt.a' file otherwise you'll get very strange linker
errors (I think this is a MinGW bug...):

$ rm /usr/local/lib/libgcrypt.a


The patch applied to the libgcrypt sources should only be used to
create the DLL. If you attempt to link libgcrypt staticly after the
patch was applied, the random number generator will fail since it is
initialized inside DllMain() (which is normally called by Windows after
the DLL is loaded). So, all of the test programs in the 'tests/'
directory will fail. This is normal.

This patch also replaces the very slow win32 entropy gatherer included
in libgcrypt with much faster CryptoAPI functions.


- Joe

P.S. To the libgcrypt team: could you please apply the 'acinclude.m4'
patch block to the official sources? Thanks!

- --
http://www.securitypunk.com/
http://www.hacktivismo.com/

http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD0E127F7
BF7E 3227 FF82 466E 7FA1 305D 02BC D51A D0E1 27F7

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFCBYayArzVGtDhJ/cRAlJBAJ9LFEDAP6WXSUo6Q+pkKXeyyn4pHgCfY8I4
wYkXnHe1DtswBm+xo0gI+bI=
=gm8w
-----END PGP SIGNATURE-----

--
This e-mail was sent anonymously. Do not reply to it.
If this e-mail contains any threatening or harassing content, please visit http://www.securitypunk.com/mailer/abuse.hax
Re: How to compile libgcrypt.dll [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

> Below are the steps necessary to compile libgcrypt v1.2.1 into a
> Windows DLL

Good work!

To create the DLL I had to append "-lintl":
$ gcc -shared -o libgcrypt.dll libgcrypt.def \
/usr/local/lib/libgcrypt.a /usr/local/lib/libgpg-error.a -lintl

I have created an import library with:
$ dlltool -D libgcrypt.dll -d libgcrypt.def -l libgcrypt.dll.a

To compile another application against libgcrypt I edited
lib/libgcrypt.la by hand and removed the reference to gpg-error from
bin/libgcrypt-config.

A binary developer package is available at
http://www.gnunet.org/download/win/libgcrypt-1.2.1.zip
Signature:
http://www.gnunet.org/download/win/libgcrypt-1.2.1.zip.asc

Thanks,

Nils Durner

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCB7jFzu0bosz8D+MRAgYGAJwORKf2xjtrVkFGTmfIc5ixLWDxNwCfdPf3
rXcHXu60EVH8rB7mS/PYMCw=
=1cLl
-----END PGP SIGNATURE-----
Re: How to compile libgcrypt.dll [ In reply to ]
On Sat, 5 Feb 2005 22:48:12 -0500 (EST), Anonymous said:

> $ gcc -shared -o libgcrypt.dll libgcrypt.def \
> /usr/local/lib/libgcrypt.a /usr/local/lib/libgpg-error.a

Please do us all a favor and don't name the DLL libgcrypt - we might
want to use this for an "official" DLL version. In particular not
with a version changed in a way this patch does.

> This patch also replaces the very slow win32 entropy gatherer included
> in libgcrypt with much faster CryptoAPI functions.

... and unknown properties.


Werner
Re: How to compile libgcrypt.dll [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



> Please do us all a favor and don't name the DLL libgcrypt - we might
> want to use this for an "official" DLL version. In particular not
> with a version changed in a way this patch does.

Agreed. The patch I provided wasn't meant for production uses; it
was just to help developers get started on the Win32 platform.


>> This patch also replaces the very slow win32 entropy gatherer included
>> in libgcrypt with much faster CryptoAPI functions.
>
>... and unknown properties.

True, but the provided entropy gatherer for win32 is too slow to be
practical. On a 1.6Ghz desktop machine under 'normal' load, 1024-bit
DSA signatures take *45 seconds* to compute. This delay is unacceptable
for my application's handshake phase which is designed to timeout after
30 seconds of inactivity. Note that the same signing operation takes
1-2 seconds on that same machine when it runs Linux.

Since it sounds like you're not a big fan of switching completely to the
CryptoAPI, would you be interested if I wrote an improved patch to add a
/configure option to include it?

- Joe

- --
http://www.securitypunk.com/
http://www.hacktivismo.com/

http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD0E127F7
BF7E 3227 FF82 466E 7FA1 305D 02BC D51A D0E1 27F7

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFCCskMArzVGtDhJ/cRAkIaAJ9M9WPaT1RP6Sd7NZ8gIOroll/j7QCgjf1Q
q7T0dHSfXOCVLc0d6FHJ/t4=
=RK9V
-----END PGP SIGNATURE-----

--
This e-mail was sent anonymously. Do not reply to it.
If this e-mail contains any threatening or harassing content, please visit http://www.securitypunk.com/mailer/abuse.hax
Re: How to compile libgcrypt.dll [ In reply to ]
On Wed, 9 Feb 2005 21:41:16 -0500 (EST), Anonymous said:

> practical. On a 1.6Ghz desktop machine under 'normal' load, 1024-bit
> DSA signatures take *45 seconds* to compute. This delay is unacceptable

I don't have these problems. The trick is to keep the random state on
disk so that random of quality GCRY_STRONG_RANDOM (which is sufficient
for the DSA's K as well as for session keys) does not require to
initialzie the pool from scratch.

Simply do a

gcry_control (GCRYCTL_SET_RANDOM_SEED_FILE, filename);

at startup to read the existing random seed and a

gcry_control (GCRYCTL_UPDATE_RANDOM_SEED_FILE);

right before you exit your process.

> Since it sounds like you're not a big fan of switching completely to the
> CryptoAPI, would you be interested if I wrote an improved patch to add a

No thanks.

Werner