title: Cannot "pip install cryptography" in Docker Alpine Linux 3.3 with OpenSSL 1.0.2g and Python 2.7
body: <p><strong>Solved</strong> Wow, these guys are fast... It's basically this <a href="https://github.com/pyca/cryptography/issues/2750" rel="noreferrer">https://github.com/pyca/cryptography/issues/2750</a> It turned out that a security update for openssl was released (DROWN Attack) and that update contained an unexpected function signature change which caused the incompatibility, so this was just bad luck for me.</p>
  
  <hr>
  
  <p>I need to use <code>pip install cryptography</code> in a Docker container running Alpine Linux. Actually, it's another module, <code>service_identity</code>, but the problem resides in the <code>cryptography</code> module, which is a dependency.</p>
  
  <p>I have the following Dockerfile</p>
  
  <pre><code>FROM alpine:3.3
  
  RUN apk --update add build-base libffi-dev openssl-dev python-dev py-pip
  RUN pip install cryptography
  </code></pre>
  
  <p>which fails with the following error</p>
  
  <pre><code>generating cffi module 'build/temp.linux-x86_64-2.7/_openssl.c'
  building '_openssl' extension
  creating build/temp.linux-x86_64-2.7/build
  creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
  gcc -fno-strict-aliasing -Os -fomit-frame-pointer -DNDEBUG -Os -fomit-frame-pointer -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
  build/temp.linux-x86_64-2.7/_openssl.c:726:6: error: conflicting types for 'BIO_new_mem_buf'
   BIO *BIO_new_mem_buf(void *, int);
        ^
  In file included from /usr/include/openssl/asn1.h:65:0,
                   from build/temp.linux-x86_64-2.7/_openssl.c:434:
  /usr/include/openssl/bio.h:692:6: note: previous declaration of 'BIO_new_mem_buf' was here
   BIO *BIO_new_mem_buf(const void *buf, int len);
        ^
  error: command 'gcc' failed with exit status 1
  </code></pre>
  
  <p>openssl 1.0.2g was released on 2016-03-01 (yesterday) and the alpine package already got updated to that version. Can it be related to this?</p>
  
  <p>How can I resolve this issue? Maybe some environment variables which I can set?</p>
  
  <p><strong>Update</strong> I've been checking the GitHub Repo for openssl, and in fact <code>BIO *BIO_new_mem_buf(void *buf, int len)</code> of <code>openssl/bio.h</code> got changed to <code>BIO *BIO_new_mem_buf(const void *buf, int len)</code> during the 1.0.2f to 1.0.2g transition (search for "BIO_new_mem_buf" in <a href="https://github.com/openssl/openssl/compare/OpenSSL_1_0_2f...OpenSSL_1_0_2g" rel="noreferrer">https://github.com/openssl/openssl/compare/OpenSSL_1_0_2f...OpenSSL_1_0_2g</a>). I don't know where this <code>openssl/asn1.h</code> is coming from, which is importing an outdated version of <code>openssl/bio.h</code>, as it does not look like the one in the openssl repo. Any ideas?</p>
  
  <p>Ok, I see some are already working on this:
  <a href="https://github.com/pyca/cryptography/issues/2750" rel="noreferrer">https://github.com/pyca/cryptography/issues/2750</a></p>