<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[wolfSSL - Embedded SSL Library — Excluding MD5 causes build errors in 2.9.0]]></title>
		<link>https://www.wolfssl.com/forums/topic511-excluding-md5-causes-build-errors-in-290.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic511.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Excluding MD5 causes build errors in 2.9.0.]]></description>
		<lastBuildDate>Tue, 18 Feb 2014 23:43:31 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Excluding MD5 causes build errors in 2.9.0]]></title>
			<link>https://www.wolfssl.com/forums/post1559.html#p1559</link>
			<description><![CDATA[<p>The fact it doesn&#039;t compile is a bug. That was an oversight.</p><p>That variable <em>hash</em> is used to calculate the &quot;finished&quot; hash, which is an concatenation of the MD5 and SHA-1 hashes of the messages concatenated together and then encrypted. That hash array is of length <strong>FINISHED_SZ</strong>, or <strong>SHA_DIGEST_SIZE + MD5_DIGEST_SIZE</strong>. For TLSv1.2, they decided that just the specified hash should be used, and they added the ability to specify other hashes like SHA-256 and SHA-384, which we also support. The strange looking <strong>&amp;hash[MD5_HASH_SIZE]</strong> is trying to set the pointer into the hash storage after the old MD5 portion. (Trying to do it the new way while letting the old way work.)</p><p>Unless you change the value of FINISHED_SZ, you are getting a buffer overflow with your patch.</p><p>Which configure settings are you using? I&#039;m guessing you have at the least:</p><div class="codebox"><pre><code>$ ./configure --disable-oldtls --disable-md5</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (john)]]></author>
			<pubDate>Tue, 18 Feb 2014 23:43:31 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post1559.html#p1559</guid>
		</item>
		<item>
			<title><![CDATA[Excluding MD5 causes build errors in 2.9.0]]></title>
			<link>https://www.wolfssl.com/forums/post1541.html#p1541</link>
			<description><![CDATA[<p>Hi,</p><p>I&#039;m cross compiling wolfSSL embedded SSL 2.9.0 for ARM Cortex-M3 from Linux x86_64. Since the target is rather small, I tried stripping it down as far as possible. When excluding MD5, it throws up:</p><div class="codebox"><pre><code>src/internal.c: In function &#039;DoServerKeyExchange&#039;:
src/internal.c:7921:42: error: &#039;MD5_DIGEST_SIZE&#039; undeclared (first use in this function)
                         digest   = &amp;hash[MD5_DIGEST_SIZE];</code></pre></div><p>The code in question looks highly suspicious to me</p><div class="codebox"><pre><code>                if (hashAlgo == sha_mac) {
                    #ifndef NO_SHA
                        digest   = &amp;hash[MD5_DIGEST_SIZE];
                        digestSz = SHA_DIGEST_SIZE;
                    #endif
                }</code></pre></div><p>Why is MD5_DIGEST_SIZE referred here when it&#039;s all about SHA1? This seems very odd (and could warrant at least an explanatory comment that this is indeed what is intended?).</p><p>Attached patch makes it at least compile. However, since I do not know if it was intended that way, I&#039;m unsure if it breaks things. Caveat emptor!</p><p>Please advice if this is a bug or not,<br />Thanks in advance and best regards,<br />Johannes</p><div class="codebox"><pre><code>diff -r -C 5 cyassl-2.9.0-orig/src/internal.c cyassl-2.9.0/src/internal.c
*** cyassl-2.9.0-orig/src/internal.c    2014-02-07 15:28:18.000000000 +0100
--- cyassl-2.9.0/src/internal.c    2014-02-12 12:40:18.291000016 +0100
***************
*** 7847,7868 ****
  
              if (IsAtLeastTLSv1_2(ssl)) {
                  byte   encodedSig[MAX_ENCODED_SIG_SZ];
                  word32 encSigSz;
  #ifndef NO_OLD_TLS
!                 byte*  digest = &amp;hash[MD5_DIGEST_SIZE];
                  int    typeH = SHAh;
                  int    digestSz = SHA_DIGEST_SIZE;
  #else
                  byte*  digest = hash256;
                  int    typeH =  SHA256h;
                  int    digestSz = SHA256_DIGEST_SIZE;
  #endif
  
                  if (hashAlgo == sha_mac) {
                      #ifndef NO_SHA
!                         digest   = &amp;hash[MD5_DIGEST_SIZE];
                          typeH    = SHAh;
                          digestSz = SHA_DIGEST_SIZE;
                      #endif
                  }
                  else if (hashAlgo == sha256_mac) {
--- 7847,7868 ----
  
              if (IsAtLeastTLSv1_2(ssl)) {
                  byte   encodedSig[MAX_ENCODED_SIG_SZ];
                  word32 encSigSz;
  #ifndef NO_OLD_TLS
!                 byte*  digest = &amp;hash[SHA_DIGEST_SIZE];
                  int    typeH = SHAh;
                  int    digestSz = SHA_DIGEST_SIZE;
  #else
                  byte*  digest = hash256;
                  int    typeH =  SHA256h;
                  int    digestSz = SHA256_DIGEST_SIZE;
  #endif
  
                  if (hashAlgo == sha_mac) {
                      #ifndef NO_SHA
!                         digest   = &amp;hash[SHA_DIGEST_SIZE];
                          typeH    = SHAh;
                          digestSz = SHA_DIGEST_SIZE;
                      #endif
                  }
                  else if (hashAlgo == sha256_mac) {
***************
*** 7916,7926 ****
                  return NO_PEER_KEY;
  
              if (IsAtLeastTLSv1_2(ssl)) {
                  if (hashAlgo == sha_mac) {
                      #ifndef NO_SHA
!                         digest   = &amp;hash[MD5_DIGEST_SIZE];
                          digestSz = SHA_DIGEST_SIZE;
                      #endif
                  }
                  else if (hashAlgo == sha256_mac) {
                      #ifndef NO_SHA256
--- 7916,7926 ----
                  return NO_PEER_KEY;
  
              if (IsAtLeastTLSv1_2(ssl)) {
                  if (hashAlgo == sha_mac) {
                      #ifndef NO_SHA
!                         digest   = &amp;hash[SHA_DIGEST_SIZE];
                          digestSz = SHA_DIGEST_SIZE;
                      #endif
                  }
                  else if (hashAlgo == sha256_mac) {
                      #ifndef NO_SHA256
***************
*** 8873,8883 ****
                          if (ssl-&gt;ctx-&gt;RsaSignCb)
                              doUserRsa = 1;
                      #endif /*HAVE_PK_CALLBACKS */
  
                      if (IsAtLeastTLSv1_2(ssl)) {
!                         byte* digest   = &amp;hash[MD5_DIGEST_SIZE];
                          int   typeH    = SHAh;
                          int   digestSz = SHA_DIGEST_SIZE;
  
                          if (ssl-&gt;suites-&gt;hashAlgo == sha256_mac) {
                              #ifndef NO_SHA256
--- 8873,8883 ----
                          if (ssl-&gt;ctx-&gt;RsaSignCb)
                              doUserRsa = 1;
                      #endif /*HAVE_PK_CALLBACKS */
  
                      if (IsAtLeastTLSv1_2(ssl)) {
!                         byte* digest   = &amp;hash[SHA_DIGEST_SIZE];
                          int   typeH    = SHAh;
                          int   digestSz = SHA_DIGEST_SIZE;
  
                          if (ssl-&gt;suites-&gt;hashAlgo == sha256_mac) {
                              #ifndef NO_SHA256
***************
*** 8944,8954 ****
                      #endif /*HAVE_PK_CALLBACKS */
  
                      if (IsAtLeastTLSv1_2(ssl)) {
                          if (ssl-&gt;suites-&gt;hashAlgo == sha_mac) {
                              #ifndef NO_SHA
!                                 digest   = &amp;hash[MD5_DIGEST_SIZE];
                                  digestSz = SHA_DIGEST_SIZE;
                              #endif
                          }
                          else if (ssl-&gt;suites-&gt;hashAlgo == sha256_mac) {
                              #ifndef NO_SHA256
--- 8944,8954 ----
                      #endif /*HAVE_PK_CALLBACKS */
  
                      if (IsAtLeastTLSv1_2(ssl)) {
                          if (ssl-&gt;suites-&gt;hashAlgo == sha_mac) {
                              #ifndef NO_SHA
!                                 digest   = &amp;hash[SHA_DIGEST_SIZE];
                                  digestSz = SHA_DIGEST_SIZE;
                              #endif
                          }
                          else if (ssl-&gt;suites-&gt;hashAlgo == sha256_mac) {
                              #ifndef NO_SHA256</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (brainpoolP256r1)]]></author>
			<pubDate>Wed, 12 Feb 2014 11:44:54 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post1541.html#p1541</guid>
		</item>
	</channel>
</rss>
