title: Using OpenSSL in FIPS mode with .NET
body: <p>I've build OpenSSL FIPS container version 2.0.1, then built OpenSSL 1.0.1c using that container (according to the instructions in <em>User Guide for the OpenSSL FIPS Object Module v2.0</em>):</p>
  
  <pre><code>SET FIPSDIR=C:\OpenSSL\FIPS
  
  cd C:\OpenSSL\openssl-fips-2.0.1
  ms\do_fips
  
  cd C:\OpenSSL\openssl-1.0.1c
  ms\do_nasm
  nmake -f ms\ntdll.mak
  </code></pre>
  
  <p>I've got these imports in my .NET application (which is obviously using the libeay32.dll from above):</p>
  
  <pre><code>[DllImport("libeay32", CallingConvention = CallingConvention.Cdecl)]
  public extern static void ERR_load_crypto_strings();
  
  [DllImport("libeay32", CallingConvention = CallingConvention.Cdecl)]
  public extern static int ERR_print_errors_fp(SafeHandle file);
  
  [DllImport("libeay32", CallingConvention = CallingConvention.Cdecl)]
  public extern static int FIPS_mode_set(int onoff);
  </code></pre>
  
  <p>The problem is, that when I call <code>FIPS_mode_set(1)</code>, it is returning <code>0</code>, which indicates that FIPS mode could not be enabled.</p>
  
  <p>To try and find out why the problem is, I'm doing this:</p>
  
  <pre><code>ERR_load_crypto_strings();
  
  using (FileStream fs = new FileStream...)
  {
    ERR_print_errors_fp(fs.SafeFileHandle);
  }
  </code></pre>
  
  <p>Which gives me this error message:</p>
  
  <p><code>OPENSSL_Uplink(0FAF1000,08): no OPENSSL_Applink</code></p>
  
  <p>I've tried searching for answers, but have come up empty - any suggestions would be much appreciated!</p>
  
  <h2>** <strong>UPDATE</strong> **</h2>
  
  <p>I tried building it using the same steps from a Visual Studio 2008 commandline instead of a Visual Studio 2010 commandline (which I had previously used) - and it worked!</p>
  
  <p>But I have no clue why it won't work with Visual Studio 2010, and I don't want to keep Visual Studio 2008 hanging around forever - any idea how I can get it to build OK with Visual Studio 2010?</p>