<?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 — [SOLVED] Porting wolfSSL to ERIKA Enterprise]]></title>
		<link>https://www.wolfssl.com/forums/topic790-solved-porting-wolfssl-to-erika-enterprise.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic790.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in [SOLVED] Porting wolfSSL to ERIKA Enterprise.]]></description>
		<lastBuildDate>Wed, 04 May 2016 15:49:32 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] Porting wolfSSL to ERIKA Enterprise]]></title>
			<link>https://www.wolfssl.com/forums/post2488.html#p2488</link>
			<description><![CDATA[<p>Thanks for letting me know you got this resolved.&nbsp; Let us know if anything else comes up.</p><p>Thanks,<br />Chris</p>]]></description>
			<author><![CDATA[null@example.com (chrisc)]]></author>
			<pubDate>Wed, 04 May 2016 15:49:32 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post2488.html#p2488</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Porting wolfSSL to ERIKA Enterprise]]></title>
			<link>https://www.wolfssl.com/forums/post2487.html#p2487</link>
			<description><![CDATA[<p>Hi Chris,</p><p>thanks for the reply, meanwhile I managed to find the problem that caused the error.<br />Somehow wolfSSL_get_error only returned 0 for me, which was not possible so I decided to<br />debug the ssl object and saw that the error value was at -501.<br />That meant that the cipher suites did not match, after adding some additional suites it finally worked.</p>]]></description>
			<author><![CDATA[null@example.com (hstr)]]></author>
			<pubDate>Wed, 04 May 2016 05:54:37 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post2487.html#p2487</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Porting wolfSSL to ERIKA Enterprise]]></title>
			<link>https://www.wolfssl.com/forums/post2486.html#p2486</link>
			<description><![CDATA[<p>Hi,</p><p>Do you know what error is returned from wolfSSL_get_error() in your above code?&nbsp; This will let us know the specific error code from wolfSSL.&nbsp; A Wireshark trace (.pcap) may also be helpful to debug.</p><p>Thanks!<br />Chris</p>]]></description>
			<author><![CDATA[null@example.com (chrisc)]]></author>
			<pubDate>Tue, 03 May 2016 22:46:17 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post2486.html#p2486</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] Porting wolfSSL to ERIKA Enterprise]]></title>
			<link>https://www.wolfssl.com/forums/post2485.html#p2485</link>
			<description><![CDATA[<p>Hi,</p><p>currently I am trying to port wolfSSL to a setup consisting of ERIKA Enterprise (OSEK RTOS) and a LwIP stack.<br />The following settings are selected:</p><div class="quotebox"><blockquote><p>#define WOLFSSL_LWIP</p><p>#define SIZEOF_LONG 4<br />#define SIZEOF_LONG_LONG 8</p><p>#define NO_WRITEV</p><p>#define NO_FILESYSTEM</p><p>#define SINGLE_THREADED</p><p>#define CHAR_BIT 8</p><p>#define TFM_NO_ASM</p><p>#define USER_TIME<br />//Defined in asn.c</p><p>#define USE_FAST_MATH<br />//No realloc usage</p><p>#define XMALLOC_USER<br />//Definition with lwip malloc:<br />#define XMALLOC(s, h, type)&nbsp; mem_malloc(s)<br />#define XFREE(p, h, type)&nbsp; &nbsp; mem_free(p)</p><p>#define NO_DEV_RANDOM</p></blockquote></div><p>The compilation and also the initialization work fine:</p><div class="quotebox"><blockquote><p>if(wolfSSL_Init() != SSL_SUCCESS)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; TerminateTask();<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; WOLFSSL_CTX* ctx;</p><p>&nbsp; &nbsp; if ( (ctx = wolfSSL_CTX_new(wolfTLSv1_server_method())) == NULL)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; TerminateTask();<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; if (wolfSSL_CTX_use_certificate_buffer(ctx, server_cert_der_2048, sizeof_server_cert_der_2048, SSL_FILETYPE_ASN1) != SSL_SUCCESS)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; TerminateTask();<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; if (wolfSSL_CTX_use_PrivateKey_buffer(ctx, server_key_der_2048, sizeof_server_key_der_2048, SSL_FILETYPE_ASN1) != SSL_SUCCESS)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; TerminateTask();<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; lSocket = lwip_socket(AF_INET, SOCK_STREAM, 0);<br />&nbsp; &nbsp; if (lSocket &lt; 0) return;</p><p>&nbsp; &nbsp; memset((char *)&amp;sLocalAddr, 0, sizeof(sLocalAddr));<br />&nbsp; &nbsp; sLocalAddr.sin_family = AF_INET;<br />&nbsp; &nbsp; sLocalAddr.sin_len = sizeof(sLocalAddr);<br />&nbsp; &nbsp; sLocalAddr.sin_addr.s_addr = inet_addr(SENDER_IP_ADDR);<br />&nbsp; &nbsp; sLocalAddr.sin_port = htons(SENDER_PORT_NUM);</p><p>&nbsp; &nbsp; if (lwip_bind(lSocket, (struct sockaddr *)&amp;sLocalAddr, sizeof(sLocalAddr)) &lt; 0) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lwip_close(lSocket);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TerminateTask();<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; if ( lwip_listen(lSocket, 5) != 0 ){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lwip_close(lSocket);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TerminateTask();<br />&nbsp; &nbsp; }</p></blockquote></div><p>But when a client now connects to the TCP socket (openssl with &quot;s_client -connect ip:port&quot;) there is an error at &quot;wolfSSL_write&quot;, here is the code for the connection:</p><div class="quotebox"><blockquote><p>clientfd = lwip_accept(lSocket, (struct sockaddr*)&amp;client_addr, (socklen_t)&amp;addrlen);<br />&nbsp; &nbsp; &nbsp; &nbsp; if (clientfd&gt;0)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;WOLFSSL* ssl;</p><p>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;if ( (ssl = wolfSSL_new(ctx)) == NULL)<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;{<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; TerminateTask();<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;}</p><p>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;wolfSSL_set_fd(ssl, clientfd);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char data_buffer[80];<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strcpy(data_buffer,&quot;Hello World\n&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wolfSSL_write(ssl, data_buffer, sizeof(&quot;Hello World&quot;));</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error = wolfSSL_get_error(ssl, 0);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wolfSSL_free(ssl);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lwip_close(clientfd);<br />&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; wolfSSL_CTX_free(ctx);<br />&nbsp; &nbsp; wolfSSL_Cleanup();<br />&nbsp; &nbsp; lwip_close(lSocket);</p><p>&nbsp; &nbsp; TerminateTask();</p></blockquote></div><p>Openssl returns the following error code: 10054.<br />Debuging &quot;wolfSSL_write&quot; results in the following trace:<br />wolfSSL_write -&gt; SendData -&gt; wolfSSL_negotiate -&gt; wolfSSL_accept: ACCEPT_BEGIN and then ACCEPT_FINISHED_DONE which returns a SSL_FATAL_ERROR <br />One thing that I just observed with Wireshark is that there <strong>is</strong> a &quot;Client Hello&quot; sent to the server.<br />Openssl Log:<br /><em>SSL_connect:before/connect initialization<br />SSL_connect:SSLv2/v3 write client hello A<br />SSL_connect:error in SSLv2/v3 read server hello A<br />write:errno=10054</em></p><p>Hopefully someone can help me with that problem, thank you.</p>]]></description>
			<author><![CDATA[null@example.com (hstr)]]></author>
			<pubDate>Mon, 02 May 2016 12:02:02 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post2485.html#p2485</guid>
		</item>
	</channel>
</rss>
