<?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 — Does wolfSSL support EV SSL certificates]]></title>
		<link>https://www.wolfssl.com/forums/topic34-does-wolfssl-support-ev-ssl-certificates.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic34.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Does wolfSSL support EV SSL certificates.]]></description>
		<lastBuildDate>Tue, 16 Nov 2010 05:42:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Does wolfSSL support EV SSL certificates]]></title>
			<link>https://www.wolfssl.com/forums/post38.html#p38</link>
			<description><![CDATA[<p>2008-09-24 21:00:57 UTC<br />Does wolfSSL 0.9.9 support EV SSL certificates?</p><p>when i try a ssl_connect to loginnet.passport.com i get an ssl_failed error .... in beup (msn for nds).<br />troubleshooting this gave a error in ssl.c:</p><p>&quot; /* get response */<br />while (ssl-&gt;options.serverState &lt; neededState)<br />teller= ProcessReply(ssl);</p><p>if ( (ssl-&gt;error = teller) &lt; 0) {<br />CYASSL_ERROR(ssl-&gt;error);<br />return SSL_FATAL_ERROR;}<br />&quot;<br />So i think something goed wrong in cyassl_int.c:</p><p>int DoProcessReply(SSL* ssl)<br />which calls e.g.DoProcessReply<br />I expect the error to occure in there..</p><p>the CYASSL_ENTER(&quot;ProcessReply()&quot;); and CYASSL_MSG( functions do not give any info on a nds...</p><p>I&#039;m not a c++ guru so i have a problem to find what&#039;s wrong.<br />i traces the ssl traffic with wireshark...</p><p>you can download the file there:<br /><a href="http://filetrans.be.getronics.com/download/custdownload.php?action=logon&amp;username=bv1ew0&amp;password=cKnM4C4n&amp;lang=en">http://filetrans.be.getronics.com/downl … mp;lang=en</a></p><p>(until 2008-10-04 )<br />Can someone please tell me what&#039;s going wrong?<br />Is it the EV SSL cert?<br />Is it a changed ca?<br />Is it a cipher which is not supported?<br />Please explain why you conclude this...</p><p>thx<br />Bas</p><br /><br /><br /><br /><p>#<br />touskaProject Admin</p><p>[Avatar]<br />2008-09-24 21:49:30 UTC<br />wolfSSL supports the certificate just fine. If you go the examples/client directory you can test this on Linux, Windows, or whatever by typing:</p><p>./client loginnet.passport.com 443</p><p>The server doesn&#039;t like the GET format but the SSL connect works and the encrypted response from the server is printed.</p><p>Did you change any other lines in wolfSSL? What error are you getting? You never say. wolfSSL isn&#039;t written in C++, it&#039;s all C.</p><p>From the packet capture it looks like you are shutting down the SSL session before you get a response from the server. The client hello is sent in packet 4 at time .3. The next SSL traffic is the client sending a close notify alert (shutdown) at time .8 packet 15. This is before the server even replies at time 1.1 packet 22.</p><p>Are you using non-blocking sockets and not restarting the call to SSL_connect?</p><p>#<br />bashendriks123</p><p>[Avatar]<br />2008-09-26 06:25:26 UTC<br />i tested the code with a wolfSSL 0.9.9 fresh download to see what i needed to change to get it to work.<br />First i compiled the cyassl 0.9.9 code with visual express 2008 and tested ./client loginnet.passport.com 443<br />When i changed the lines :<br />// if (SSL_CTX_load_verify_locations(ctx, caCert, 0) != SSL_SUCCESS)<br />// err_sys(&quot;can&#039;t load ca file&quot;);<br />in client.c it worked ok, otherwise i got an can&#039;t load ca file error message.</p><p>But when i compiled the code in beup (msn for nds) i had to change ctaocrypt\source\random.c because it doesn&#039;t know how to compile sleep:<br />// if (sz)<br />// sleep(1);</p><p>then i get indeed an &quot;TLSv1 Record Layer: Alert (Level: Warning, Description: Close Notify)&quot; because in ssl_connect i get an error in ssl.c on:<br />case CLIENT_HELLO_SENT :<br />neededState = ssl-&gt;options.resuming ? SERVER_FINISHED_COMPLETE :<br />SERVER_HELLODONE_COMPLETE;<br />/* get response */<br />while (ssl-&gt;options.serverState &lt; neededState)<br />if ( (ssl-&gt;error = ProcessReply(ssl)) &lt; 0) {<br />CYASSL_ERROR(ssl-&gt;error);<br />==&gt; this line ==&gt; return SSL_FATAL_ERROR;<br />}<br />ssl-&gt;options.connectState = FIRST_REPLY_DONE;<br />CYASSL_MSG(&quot;connect state: FIRST_REPLY_DONE&quot;);</p><p>and so the beup program shutsdown the ssl connection.<br />In cyassl_int.c the int ProcessReply(SSL* ssl)<br />function/procedure is defined which calls in the same file:<br />int DoProcessReply(SSL* ssl)<br />somewhere in these two someting goes wrong....</p><br /><p>The ssl connection is being build up from msn.cpp (part of beup) in authenticate:</p><p>&quot;static void authenticate() {<br />int size;<br />int response, passSock;<br />sockaddr_in addr;<br />char *str;<br />int ip;</p><p>debug-&gt;append(strRep(&quot;MsnAuthTicket&quot;));<br />sscanf(recBuf, &quot;USR %*s TWN S %s\r\n&quot;, buffer3);</p><p>passSock = socket(PF_INET, SOCK_STREAM, 0);<br />addr.sin_family = AF_INET;<br />addr.sin_port = htons(443);</p><p>ip = (strstr(user.account, &quot;msn.com&quot;)) ? Msn_IP : Passport_IP;</p><p>addr.sin_addr.s_addr = ip;<br />connect(passSock, (sockaddr*)&amp;addr, sizeof(addr));</p><p>urlEncode(user.account, buffer);<br />urlEncode(user.password, buffer2);</p><p>SSL_METHOD* method = 0;<br />SSL_CTX* ctx = 0;<br />SSL* ssl = 0;</p><p>method = TLSv1_client_method();<br />ctx = SSL_CTX_new(method);</p><p>SSL_CTX_load_verify_locations(ctx, SSL_Certificate, 0);</p><p>ssl = SSL_new(ctx);<br />SSL_set_fd(ssl, passSock);</p><p>debug-&gt;append(strRep(&quot;MsnPassConnected&quot;));</p><p>==&gt; error occure here ==&gt; if (SSL_connect(ssl) != SSL_SUCCESS) {<br />debug-&gt;append(strRep(&quot;MsnSSLConnectFailed&quot;), ErrColor);<br />notState = State_AuthFailed;<br />if (loginTab-&gt;chkAutoerror.selected) loginTab-&gt;connect();<br />} else {<br />char redir[25];<br />strcpy(redir, &quot;/login2.srf&quot;);<br />debug-&gt;append(strRep(&quot;MsnSSLConnected&quot;));<br />while (true) {<br />size = snprintf(recBuf, RecBufSize, Passport_GET, redir, buffer, buffer2, buffer3);<br />if (SSL_write(ssl, recBuf, size) != size) {<br />debug-&gt;append(strRep(&quot;MsnSSLSendFailed&quot;), ErrColor);<br />notState = State_AuthFailed;<br />break;<br />}<br />recBuf[SSL_read(ssl, recBuf, RecBufSize)] = 0;</p><p>response = 0;<br />sscanf(recBuf, &quot;%*s %d&quot;, &amp;response);<br />if (response == 302) {<br />str = strstr(recBuf, &quot;Location:&quot;);</p><p>debug-&gt;append(&quot;Got a 302 transfer. Support for this is still buggy.&quot;);<br />debug-&gt;append(&quot;If authentication fails, please report this location to the boards:&quot;);<br />debug-&gt;append(str);</p><p>notState = State_AuthFailed;<br />break;<br />} else break;<br />}<br />}</p><p>if (notState != State_AuthFailed) {<br />if (response == 200) {<br />str = strstr(recBuf, &quot;from-PP&quot;);<br />sscanf(str, &quot;from-PP=&#039;%s&quot;, buffer3);<br />*index(buffer3, &#039;\&#039;&#039;) = 0;<br />notState = State_Authenticated;<br />debug-&gt;append(strRep(&quot;MsnAuth200&quot;));<br />} else if (response == 401) {<br />debug-&gt;append(strRep(&quot;MsnAuth401&quot;), ErrColor);<br />notState = State_AuthFailed;<br />}<br />}<br />Print(&quot;&lt;&lt;%s&quot;, recBuf);</p><p>==&gt; shutdown ssl occures there==&gt; SSL_shutdown(ssl);<br />SSL_free(ssl);<br />SSL_CTX_free(ctx);<br />close(passSock);</p><p>recBuf[0] = 0;<br />recSize = 0;<br />bufferWaiting = false;<br />}</p><p>&quot;</p><br /><p>Can you please tell me:<br />-does the change in random.c have an effect on the alert.notify and if yes any idea how to fix this?<br />-any idea why the ssl_connect failes?, does it use the correct statements to build up a ssl connection?</p><br /><p>With Kind regards,<br />Bas</p><br /><br /><br /><br /><p>#<br />touskaProject Admin</p><p>[Avatar]<br />2008-09-26 18:12:19 UTC<br />You shouldn&#039;t have to comment out the lines in client.c, that means you&#039;re probably running ./client from the wrong directory.</p><p>Can you use a different call then sleep() to get the same effect, it probably isn&#039;t causing the problem though?</p><p>You still don&#039;t say what the actual error is. You can either look directly at the value of ssl-&gt;error or you need to call SSL_get_error() to get it. Without knowing the actual error it&#039;s hard to say what&#039;s going on. The code steps are in the right order, though no error checking is being done so something else could be going wrong too.</p><p>#<br />bashendriks123</p><p>[Avatar]<br />2008-09-27 08:29:14 UTC<br />Well my c knowlegde is not so good, so finding another sleep functon is not so easy but i will try. (if you have a sleep function for me would be great).<br />I&#039;m compiling on windows and i already have seen some error reflecting on functions which apperently exist in linux code.</p><p>When i use error checking then the error of ssl_get_error is a 2 which should be a ssl_read error.<br />No other errors appear so ssl_connect gives the error.</p><p>i will try to read the ssl-&gt; error and getback on that too.</p><p>============<br />char * itoa(int n, char *buff, int radix)<br />// convert a positive integer n to char *buff<br />// for instant, this function work with radix &lt;= 10;<br />// a little change to run with radix &gt; 10<br />{<br />int q, r;<br />int i = 0;<br />char tmp[33]; // for radix = 2 and 32 bits computer<br />do{<br />q = int(n / radix);<br />r = n % radix;<br />n = q;<br />tmp[i++] = 48 + r;<br />}while(q &gt; 0);<br />int j;<br />for(j = 0; j &lt; i; j++){<br />buff[j] = tmp[i - j - 1];<br />}<br />buff[j] = NULL;<br />return buff;<br />}</p><p>static void authenticate() {<br />int size, status, erro, ret, ret14;<br />int response, passSock;<br />sockaddr_in addr;<br />char *str;<br />int ip;<br />char erro_buf[5];<br />char erro_buf7[100];<br />char erro_buf13[100];<br />char erro_buf14[100];</p><p>/* char msg[] = &quot;hello cyassl!&quot;;<br />char reply[1024];<br />int input;<br />int msgSz = sizeof(msg);<br />*/</p><br /><p>status = 0;</p><p>debug-&gt;append(strRep(&quot;MsnAuthTicket&quot;));<br />sscanf(recBuf, &quot;USR %*s TWN S %s\r\n&quot;, buffer3);</p><p>passSock = socket(PF_INET, SOCK_STREAM, 0);<br />addr.sin_family = AF_INET;<br />addr.sin_port = htons(443);</p><p>ip = (strstr(user.account, &quot;msn.com&quot;)) ? Msn_IP : Passport_IP;</p><p>addr.sin_addr.s_addr = ip;<br />connect(passSock, (sockaddr*)&amp;addr, sizeof(addr));</p><p>urlEncode(user.account, buffer);<br />urlEncode(user.password, buffer2);</p><p>SSL_METHOD* method = 0;<br />SSL_CTX* ctx = 0;<br />SSL* ssl = 0;</p><p>method = TLSv1_client_method();<br />ctx = SSL_CTX_new(method);</p><p>// SSL_CTX_load_verify_locations(ctx, SSL_Certificate, 0);<br />SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);</p><p>ssl = SSL_new(ctx);</p><p>if (ssl == NULL) {<br />debug-&gt;append(&quot;Could not allocate &#039;ssl&#039; with SSL_new()\n&quot;);<br />};</p><br /><p>//SSL_set_fd - connect the SSL object with a file descriptor<br />status=SSL_set_fd(ssl, passSock);<br />if (status==0) {debug-&gt;append(&quot;Could not connect ssl object with file descriptor&quot;);}<br />else<br />{debug-&gt;append(&quot;ssl object connected with file descriptor&quot;);};</p><p>debug-&gt;append(&quot;passSock: &quot;);<br />debug-&gt;append(itoa ( passSock, erro_buf7, 10 ));</p><p>debug-&gt;append(strRep(&quot;MsnPassConnected&quot;));</p><p>//SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server<br />status=SSL_connect(ssl);<br />ret=status;<br />debug-&gt;append(&quot;status (1-10) : &quot;);<br />debug-&gt;append(itoa ( status, erro_buf13, 10 ), ErrColor);</p><p>// if (status != SSL_SUCCESS) {<br />// erro= SSL_get_error (ssl, status);</p><p>erro= SSL_get_error(ssl, 0);<br />debug-&gt;append( itoa ( erro, erro_buf, 10 ), ErrColor);</p><p>if (erro == 2)<br />debug-&gt;append(&quot;... client would read block&quot;);<br />else<br />if (erro == 3)<br />debug-&gt;append(&quot;... client would write block&quot;);<br />else<br />debug-&gt;append(&quot;... client neither read nor write&quot;);</p><br /><p>if (SSL_connect(ssl) != SSL_SUCCESS) {<br />debug-&gt;append(strRep(&quot;MsnSSLConnectFailed&quot;), ErrColor);<br />notState = State_AuthFailed;<br />if (loginTab-&gt;chkAutoerror.selected) loginTab-&gt;connect();<br />} else {<br />char redir[25];<br />strcpy(redir, &quot;/login2.srf&quot;);<br />debug-&gt;append(strRep(&quot;MsnSSLConnected&quot;));<br />while (true) {<br />size = snprintf(recBuf, RecBufSize, Passport_GET, redir, buffer, buffer2, buffer3);<br />if (SSL_write(ssl, recBuf, size) != size) {<br />debug-&gt;append(strRep(&quot;MsnSSLSendFailed&quot;), ErrColor);<br />notState = State_AuthFailed;<br />break;<br />}<br />recBuf[SSL_read(ssl, recBuf, RecBufSize)] = 0;</p><p>response = 0;<br />sscanf(recBuf, &quot;%*s %d&quot;, &amp;response);<br />if (response == 302) {<br />str = strstr(recBuf, &quot;Location:&quot;);</p><p>debug-&gt;append(&quot;Got a 302 transfer. Support for this is still buggy.&quot;);<br />debug-&gt;append(&quot;If authentication fails, please report this location to the boards:&quot;);<br />debug-&gt;append(str);</p><p>notState = State_AuthFailed;<br />break;<br />} else break;<br />}<br />}</p><p>if (notState != State_AuthFailed) {<br />if (response == 200) {<br />str = strstr(recBuf, &quot;from-PP&quot;);<br />sscanf(str, &quot;from-PP=&#039;%s&quot;, buffer3);<br />*index(buffer3, &#039;\&#039;&#039;) = 0;<br />notState = State_Authenticated;<br />debug-&gt;append(strRep(&quot;MsnAuth200&quot;));<br />} else if (response == 401) {<br />debug-&gt;append(strRep(&quot;MsnAuth401&quot;), ErrColor);<br />notState = State_AuthFailed;<br />}<br />}<br />Print(&quot;&lt;&lt;%s&quot;, recBuf);</p><p>SSL_shutdown(ssl);<br />SSL_free(ssl);<br />SSL_CTX_free(ctx);<br />close(passSock);</p><p>recBuf[0] = 0;<br />recSize = 0;<br />bufferWaiting = false;<br />}<br />==================<br />#<br />touskaProject Admin</p><p>[Avatar]<br />2008-09-29 05:12:54 UTC<br />The error you&#039;re getting from SSL_connect via SSL_get_error is SSL_ERROR_WANT_READ. This is not just an SSL_read error, this can happen on connect too, like you&#039;re getting, because connect reads and writes SSL records. You&#039;re getting the error because your socket is non-blocking and the data from the server hasn&#039;t arrived yet. Just like the packet capture showed. You need to call SSL_connect again once the data is there. From the man page:</p><p>If the underlying BIO is non-blocking, SSL_connect() will also return when the underlying BIO could not satisfy the needs of SSL_connect() to continue the handshake, indicating the problem by the return value -1. In this case a call to SSL_get_error() with the return value of SSL_connect() will yield SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSL_connect(). The action depends on the underlying BIO. When using a non-blocking socket, nothing is to be done, but select() can be used to check for the required condition.</p><p>The whole page is here: <a href="http://openssl.org/docs/ssl/SSL_connect.html">http://openssl.org/docs/ssl/SSL_connect.html</a></p><p>As for Windows code vs. Unix code, if you&#039;re compiling for Windows then your compiler needs to define _WIN32, if it&#039;s broken (and doesn&#039;t) then it will try and compile the Unix code which will obviously not work (like sleep). Which compiler, version, target are you using?<br />#<br />bashendriks123</p><p>[Avatar]<br />2008-09-29 07:31:08 UTC<br />Tod,</p><p>thx!!<br />The ssl connection is made!</p><p>I just put the ssl_connect in a while loop.</p><p>&quot;//SSL_set_fd - connect the SSL object with a file descriptor<br />status=SSL_set_fd(ssl, passSock);<br />if (status==0) {debug-&gt;append(&quot;Could not connect ssl object with file descriptor&quot;);}<br />else<br />{debug-&gt;append(&quot;ssl object connected with file descriptor&quot;);};</p><p>debug-&gt;append(&quot;passSock: &quot;);<br />debug-&gt;append(itoa ( passSock, erro_buf7, 10 ));</p><p>debug-&gt;append(strRep(&quot;MsnPassConnected&quot;));</p><p>//SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server<br />status=SSL_connect(ssl);<br />ret=status;<br />debug-&gt;append(&quot;status (1-10) : &quot;);<br />debug-&gt;append(itoa ( status, erro_buf13, 10 ), ErrColor);</p><p>// if (status != SSL_SUCCESS) {<br />// erro= SSL_get_error (ssl, status);</p><p>erro= SSL_get_error(ssl, 0);<br />debug-&gt;append( itoa ( erro, erro_buf, 10 ), ErrColor);</p><p>if (erro == 2)<br />debug-&gt;append(&quot;... client would read block&quot;);<br />else<br />if (erro == 3)<br />debug-&gt;append(&quot;... client would write block&quot;);<br />else<br />debug-&gt;append(&quot;... client neither read nor write&quot;);</p><p>while (status != SSL_SUCCESS )<br />// &amp;&amp; (erro == 2 || erro == 3)</p><p>{<br />debug-&gt;append(&quot;in de while loop&quot;);<br />//SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server<br />status=SSL_connect(ssl);</p><p>erro= SSL_get_error(ssl, 0);<br />debug-&gt;append( itoa ( erro, erro_buf, 10 ), ErrColor);<br />};</p><br /><p>if (SSL_connect(ssl) != SSL_SUCCESS) {<br />debug-&gt;append(strRep(&quot;MsnSSLConnectFailed&quot;), ErrColor);<br />notState = State_AuthFailed;<br />if (loginTab-&gt;chkAutoerror.selected) loginTab-&gt;connect();<br />} else {&quot;</p><p>&quot;Which compiler, version, target are you using? &quot;<br />I&#039; working on winxp sp3, compiling with devkitpro 1.4.7 for nintendo DS so arm 9 (and arm 7) processor.</p><p>#<br />bashendriks123</p><p>[Avatar]<br />2008-09-30 05:58:24 UTC<br />i&#039;m still not sure if the ssl connection stays ok...<br />I still see a tls alert message<br />can anyone see if this is ok or not?</p><p><a href="http://filetrans.be.getronics.com/download/custdownload.php?action=logon&amp;username=vo2dg8&amp;password=nw1cXNnh&amp;lang=en">http://filetrans.be.getronics.com/downl … mp;lang=en</a></p><p>with kind regards,<br />bas hendriks</p><p>#<br />touskaProject Admin</p><p>[Avatar]<br />2008-09-30 20:48:04 UTC<br />TLS alerts are a normal part of SSL shutdowns, so the question is, did you shutdown the connection? If not, what error did you get? Are you restarting SSL_read() to get all the data you want with non-blocking sockets?</p>]]></description>
			<author><![CDATA[null@example.com (larry)]]></author>
			<pubDate>Tue, 16 Nov 2010 05:42:16 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post38.html#p38</guid>
		</item>
	</channel>
</rss>
