[Python-Dev] windows 2.5 build: use OpenSSL for hashlib [bug 1535502]

Gregory P. Smith greg at electricrain.com
Mon Aug 7 18:50:27 CEST 2006


On Mon, Aug 07, 2006 at 03:16:22PM +0200, "Martin v. L?wis" wrote:
> Gregory P. Smith schrieb:
> > Whoever knows how the windows build process works and controls the
> > python 2.5 windows release builds could you please make sure the
> > hashlib module gets built + linked with OpenSSL rather than falling
> > back to its much slower builtin implementations.
> 
> If the project files are changed in that direction, then my build will
> pick that up automatically. I can't promise to change the files myself.
> 
> I'm somewhat worried about yet another size increase in pythonxy.dll
> (actually, I'm personally not worried, but I anticipate complaints about
>  such a change).
> 
> What should happen to the existing sha* modules?

Actually, this change will either:

 (a) leave pythonxy.dll the same size.
   OR
 (b) *reduce* the size of pythonxy.dll.
 
hashlib's OpenSSL implementation on windows comes in the form of a
300k _hashlib.pyd library.  Build that and pythonxy.dll won't change.
If you want to reduce the pythonxy.dll size you can remove _md5, _sha,
_sha256 and _sha512 from the builtins list so long as _hashlib.pyd is
built.

There is OpenSSL library code duplication between the _hashlib (300k)
and _ssl (650k) modules the way things are linked today (static).  If
you wanted absolute smallest distro size and code reuse we'd need to
change things to use an OpenSSL.dll.  I'm not proposing that (though
it is a good idea).

> I believe that the performance of the OpenSSL routines depends on
> the way OpenSSL was built, e.g. whether the assembler implementations
> are used or not. Somebody would have to check, but I doubt they are.

That'd be unfortunate as that negatively impacts the socket _ssl
module as well.  OpenSSL should always be built with the assembler
implementations.



More information about the Python-Dev mailing list