There seems to be a regression bug from an earlier version of M2Crypto. For solving this please follow following step:
Note: Please install it in virtualenv
then, run following command:
1> tar -xzf M2Crypto-0.21.1.tar.gz
2> cd M2Crypto-0.21.1/SWIG
3> nano _ssl.i.patch and paste following code(ctrl+shift+v):
--- SWIG/_ssl.i 2011-01-15 20:10:06.000000000 +0100
+++ SWIG/_ssl.i 2012-06-17 17:39:05.292769292 +0200
@@ -48,8 +48,10 @@
%rename(ssl_get_alert_desc_v) SSL_alert_desc_string_long;
extern const char *SSL_alert_desc_string_long(int);
+#ifndef OPENSSL_NO_SSL2
%rename(sslv2_method) SSLv2_method;
extern SSL_METHOD *SSLv2_method(void);
+#endif
%rename(sslv3_method) SSLv3_method;
extern SSL_METHOD *SSLv3_method(void);
%rename(sslv23_method) SSLv23_method;
4> patch _ssl.i _ssl.i.patch
5> python setup.py build
6> python setup.py install