473,772 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

More M2Crypto build problems

Trying to build M2Crypto on a dedicated server running Red Hat Fedora Core 6.
I'm trying to do this right, without manual patching.

The error message I'm getting during build is:

python setup.py build
....
swig -python -I/usr/include -o SWIG/_m2crypto_wrap. c SWIG/_m2crypto.i
/usr/include/openssl/opensslconf.h:2 7: Error: CPP #error ""This openssl-devel
package does not work your architecture?"" . Use the -cpperraswarn option to
continue swig processing.
error: command 'swig' failed with exit status 1

We went through this before, but last time, the versions of OpenSSL and
of SWIG on the system were old, and I was running on a shared server
and couldn't update it. Eventually, M2Crypto was hammered
into working, but it was ugly. It was necessary to patch "setup.py" as
follows:

107,108d106
< target_cpu_str = '-D__i386__' # PATCH - assume Intel target. OpenSSL build
needs this.
<
116c114
< swig_opts = [swig_opts_str,t arget_cpu_str]
---
swig_opts = [swig_opts_str]
The problem is that the include file in OpenSSL assumes that some
system ID, like __i386__, is defined, which GCC does, but SWIG
does not. It might be considered a bug in SWIG.

This time, everything on the dedicated server has been updated with Yum,
so it ought to just work.

Yum says:
>
Installed Packages
openssl.i686 0.9.8a-5.4 installed
openssl-devel.i386 0.9.8a-5.4 installed
python.i386 2.4.3-9.FC5 installed
swig.i386 1.3.31-0.fc5 installed
Available Packages
openssl.i386 0.9.8a-5.4 updates
All of those are later than the ones required for M2Crypto, so the system
should be current.
>
But it doesn't.

Also reported as a SWIG bug, as #1676049.

John Nagle
Mar 7 '07 #1
2 5153
Still more M2Crypto build problems:

In M2Crypto's file "SWIG/_ec.i", there's this:

#if OPENSSL_VERSION _NUMBER < 0x0090800fL || defined(OPENSSL _NO_EC)
#undef OPENSSL_NO_EC
%constant OPENSSL_NO_EC = 1;
#else
%constant OPENSSL_NO_EC = 0;

%{
#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/x509.h>
#include <openssl/ecdsa.h>
#include <openssl/ecdh.h>
%}

There's the assumption here that versions of OpenSSL greater than 0.9.08???
contain elliptical curve cryptography support. There's
also the assumption that "ecdsa.h" is present; it is included
unconditionally , and definitions from it are used later.

Unfortunately, the ones that ship with Fedora Core 5 and 6 do not have it:

http://threebit.net/mail-archive/fed.../msg14507.html

Updating with "yum" doesn't help. Apparently there are patent problems
with the algorithm, and Red Hat pulled that code. See

http://en.wikipedia.org/wiki/ECC_patents

I'm trying to get M2Crypto to build without elliptical cryptography, but
it's not working

John Nagle

"Python. Embrace the pain".
Mar 7 '07 #2
Now I understand what's wrong. It's an incompatibility between
SWIG, OpenSSL, and M2Crypto.

OpenSSL was built with OPENSSL_NO_EC defined. That's actually
defined via "opensslconf.h" , which includes, based on whether
__i386__ is defined, the file "opensslcon f-i386.h". OpenSSL
didn't always work that way; the per-platform include file
thing is new.

M2Crypto uses SWIG. (Usually a mistake, but..) SWIG takes
in various definition files, and generates about 24,000 lines of
C code. (This is just glue code; it's not really doing much.)
One of the the definition files is "_ec.i", which has:

%include <openssl/opensslconf.h>
#if OPENSSL_VERSION _NUMBER < 0x0090800fL || defined(OPENSSL _NO_EC)
#undef OPENSSL_NO_EC
%constant OPENSSL_NO_EC = 1;
#else
%constant OPENSSL_NO_EC = 0;

%{
#include <openssl/bn.h>
.... stuff to handle elliptical curve encryption

This looks reasonable. The "%include" brings in the file for
SWIG processing. But, under SWIG's rules, that does NOT bring
in files included from within the file being included.
(Otherwise, SWIG would generate Python interfaces for everything
in them.)

So "OPENSSL_NO _EC" is undefined, which results in compiling the
code for "EC", the elliptical curve stuff removed from Fedora
5 and 6 for patent reasons.

A workaround is to put:

#define OPENSSL_NO_EC

at the beginning of "_ec.i". This turns off elliptical curve
crypto support. M2Crypto will then build.

There's probably a correct way to do this, and get SWIG to properly
obtain the value from the OpenSSL include file, but I don't know
SWIG well enough to do it.

John Nagle
Mar 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
7188
by: Carl Waldbieser | last post by:
I tried to adapt the instructions for building the M2Crypto module (http://sandbox.rulemaker.net/ngps/m2/INSTALL.html) to build a version compatible with Python2.3, but I've had some mixed results. I actually got everything to build and install, but when I try to import M2Crypto-- well, here is a sample session: >>> import M2Crypto Traceback (most recent call last): File "<interactive input>", line 1, in ? File...
5
2270
by: jsmilan | last post by:
Hi, all; I'm strictly an amateur developer who has dabbled in a half dozen languages on eight or nine systems over 20 years or so. I have never devoted the time or energy to thoroughly learn any one of them, so I have become a true JOATAMON (Jack Of All Trades And Master Of None). I apologize in advance for any truly newb sounding questions. I did Google for this in several places first (Zope.org, Gentoo forums, and Google UseNet...
2
1522
by: Elbert Lev | last post by:
People! Have somebody build M2Crypto for 2.4 on windows? If yes, please tell if there are any problems.
0
1098
by: Thomas G. Apostolou | last post by:
Hello all. i am trying to make some win32 binaries of M2Crypto 0.15 What I use is: Python 2.3.3 openssl-0.9.7i swigwin 1.3.27
2
1900
by: John Nagle | last post by:
A list of small problems and bugs in the current M2Crypto: I need to look at SSL certificates in some detail, so this is all about the access functions for certificates. Bugs: 1. Off by one error at "X509.get_ext_count()". Reports eight extensions on a certificate that only has seven. get_ext_at works for extensions 0..6, then returns an undefined for the nonexistent #7.
8
2981
by: John Nagle | last post by:
I've been running M2Crypto successfully using Python 2.4 on Windows 2000, and now I'm trying to get it to work on Python 2.3.4 on Linux. Attempting to initialize a context results in Traceback (most recent call last): File "/www/htdocs/sitetruth.com/cgi/ratingdetails.cgi", line 46, in ? DetailsPageBuilder.detailspage(kdbfile,ktemplatefile,url) # check and display domain or URL as web page File "./sitetruth/DetailsPageBuilder.py", line...
10
3588
by: John Nagle | last post by:
Here are three network-related exceptions. These were caught by "except" with no exception type, because none of the more specific exceptions matched. This is what a traceback produced: 1. File "D:\Python24\lib\socket.py", line 295, in read data = self._sock.recv(recv_size) timeout: timed out
5
7699
by: John Nagle | last post by:
I thought I had all the timeout problems with urllib worked around, but no. socket.setdefaulttimeout is useful, but not always effective. I'm setting that to 15 seconds. If the host end won't open the connection within 15 seconds, urllib times out. But if the host end opens the connection, then never sends anything, urllib waits for many minutes before timing out. Any idea how to deal with this? And don't just say "use urllib2"...
7
4243
by: John Nagle | last post by:
Back in March, I posted this: That was for M2Crypto 0.17. It's still broken in M2Crypto 0.18. And there's no RPM or Windows binary. Nobody actually uses this stuff, do they?
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7461
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.