title: OpenSSL “error: storage size of ‘ctx’ isn’t known”
body: <p>I'm using Ubuntu 19.04 and (supposedly) OpenSSL 1.1.1b, however whilst using <code>EVP_MD_CTX</code> I am getting this issue when compiling code that should otherwise work. I toyed around with OpenSSL (trying to update manually on 18.04) however did uninstall/reinstall successfully (to my knowledge) as it now displays the version mentioned.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;openssl/evp.h&gt;
  
  main(int argc, char *argv[])
  {
  EVP_MD_CTX mdctx;
  const EVP_MD *md;
  char mess1[] = "Test Message\n";
  char mess2[] = "Hello World\n";
  unsigned char md_value[EVP_MAX_MD_SIZE];
  int md_len, i;
  
  OpenSSL_add_all_digests();
  
  md = EVP_get_digestbyname(argv[1]);
  
  EVP_MD_CTX_init(&amp;mdctx);
  EVP_DigestInit_ex(&amp;mdctx, md, NULL);
  EVP_DigestUpdate(&amp;mdctx, mess1, strlen(mess1));
  EVP_DigestUpdate(&amp;mdctx, mess2, strlen(mess2));
  EVP_DigestFinal_ex(&amp;mdctx, md_value, &amp;md_len);
  EVP_MD_CTX_cleanup(&amp;mdctx);
  
  printf("Digest is: ");
  for(i = 0; i &lt; md_len; i++) printf("%02x", md_value[i]);
  printf("\n");
  }
  </code></pre>
  
  <p>I understand similar questions to this have been asked, however upon attempting the fixes stated as answers I've not been able to remedy mine.</p>
  
  <p>The exact error is:</p>
  
  <pre><code>test2.c:6:12: error: storage size of ‘mdctx’ isn’t known
   EVP_MD_CTX mdctx;
  </code></pre>