<?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 — Baremetal Application - RsaUnPad error, bad formatting]]></title>
		<link>https://www.wolfssl.com/forums/topic1219-baremetal-application-rsaunpad-error-bad-formatting.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic1219.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Baremetal Application - RsaUnPad error, bad formatting.]]></description>
		<lastBuildDate>Thu, 12 Jul 2018 23:09:46 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post4037.html#p4037</link>
			<description><![CDATA[<p>Hello Ramon,</p><p>After re-reading through the first post:<br />Please check that the correct private key is being loaded for the client, matching the certificate loaded.</p><br /><p>For building tests:<br />For building the examples it may be best to either use user_setttings.h or compile them separately. A user_settings.h file is one created by the user to hold settings such as the macros WOLFSSL_USER_IO and NO_WRITEV. What I suspect is happening here is that the -D macros set during &quot;make&quot; are not getting pulled into the examples when they are compiled with autotools/libtools. You can create a static wolfSSL library with adding &quot;--enable-static&quot; to the configure line. This gets placed into the directory wolfssl-root/src/.libs/ which could then be linked to when building wolfcrypt/test/test.c.</p><p>Regards,<br />Jacob</p>]]></description>
			<author><![CDATA[null@example.com (Jacob)]]></author>
			<pubDate>Thu, 12 Jul 2018 23:09:46 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post4037.html#p4037</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3998.html#p3998</link>
			<description><![CDATA[<p>Hi Jacob,</p><p>I&#039;m sorry to insist, if I remove &quot;--disable-crypttests&quot; I get these errors even with the macros NO_FILESYSTEM&nbsp; and USE_CERT_BUFFERS_2048:</p><br /><br /><div class="codebox"><pre><code>/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r&#039;:
sbrkr.c:(.text+0x1c): undefined reference to `_sbrk&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r&#039;:
writer.c:(.text+0x24): undefined reference to `_write&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r&#039;:
closer.c:(.text+0x1c): undefined reference to `_close&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r&#039;:
fstatr.c:(.text+0x20): undefined reference to `_fstat&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r&#039;:
isattyr.c:(.text+0x1c): undefined reference to `_isatty&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r&#039;:
lseekr.c:(.text+0x24): undefined reference to `_lseek&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r&#039;:
readr.c:(.text+0x24): undefined reference to `_read&#039;
collect2: error: ld returned 1 exit status
make[1]: *** [wolfcrypt/test/testwolfcrypt] Error 1</code></pre></div><p>I&#039;m using the following commands:</p><p>./configure --host=arm-xilinx-eabi --enable-debug --enable-static --disable-shared --enable-singlethreaded --disable-examples --disable-filesystem&nbsp; --enable-ecc --enable-curve25519=small --enable-tls13 --enable-fastmath &quot;CC=/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/arm-xilinx-eabi-gcc&quot; </p><p>make CFLAGS=&quot;-DNO_FILESYSTEM=1 -DWOLFSSL_USER_IO=1 -DNO_WRITEV=1 -DNO_MAIN_DRIVER=1 -DNO_DEV_RANDOM=1 -DTIME_OVERRIDES=1&nbsp; -DHAVE_ECC=1 -DHAVE_CHACHA -DHAVE_POLY1305 -DHAVE_CURVE25519 -DWOLFSSL_LOG_PRINTF=1 -DDEBUG_WOLFSSL=1 -DSINGLE_THREADED=1 -DWOLFSSL_USER_IO -DFP_MAX_BITS=8192 -DUSE_CERT_BUFFERS_2048&quot; TARGET_CFLAGS_ARCH=&#039;-mfloat-abi=softfp&#039;&nbsp; CC=&quot;/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/arm-xilinx-eabi-gcc&quot; </p><p>It looks that the library is still having dependences related to file system despite of the macros.</p><p>Thanks for your time,</p><p>Ramón.</p>]]></description>
			<author><![CDATA[null@example.com (RGnzlzRz)]]></author>
			<pubDate>Mon, 04 Jun 2018 08:02:42 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3998.html#p3998</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3997.html#p3997</link>
			<description><![CDATA[<p>To avoid using a file system, the macro NO_FILESYSTEM can be used in conjuncture with USE_CERT_BUFFERS_1024. This will make the RSA tests use buffers instead of a file system.</p><p>Any difference in build options has the potential to cause issues.</p><p>Regards,<br />Jacob</p>]]></description>
			<author><![CDATA[null@example.com (Jacob)]]></author>
			<pubDate>Thu, 31 May 2018 20:44:26 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3997.html#p3997</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3995.html#p3995</link>
			<description><![CDATA[<p>Hi Jacob,</p><p>I have options.h included in first place.</p><p>I have the following options.h:<br /></p><div class="codebox"><pre><code>/* wolfssl options.h
 * generated from configure options
 *
 * Copyright (C) 2006-2015 wolfSSL Inc.
 *
 * This file is part of wolfSSL. (formerly known as CyaSSL)
 *
 */

#ifndef WOLFSSL_OPTIONS_H
#define WOLFSSL_OPTIONS_H


#ifdef __cplusplus
extern &quot;C&quot; {
#endif

#undef  HAVE_FFDHE_2048
#define HAVE_FFDHE_2048

#undef  WOLFSSL_TLS13
#define WOLFSSL_TLS13

#undef  HAVE_TLS_EXTENSIONS
#define HAVE_TLS_EXTENSIONS

#undef  HAVE_SUPPORTED_CURVES
#define HAVE_SUPPORTED_CURVES

#undef  SINGLE_THREADED
#define SINGLE_THREADED

#undef  HAVE_THREAD_LS
#define HAVE_THREAD_LS

#undef  TFM_TIMING_RESISTANT
#define TFM_TIMING_RESISTANT

#undef  ECC_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT

#undef  WC_RSA_BLINDING
#define WC_RSA_BLINDING

#undef  HAVE_AESGCM
#define HAVE_AESGCM

#undef  HAVE_HKDF
#define HAVE_HKDF

#undef  NO_DSA
#define NO_DSA

#undef  HAVE_ECC
#define HAVE_ECC

#undef  TFM_ECC256
#define TFM_ECC256

#undef  CURVE25519_SMALL
#define CURVE25519_SMALL

#undef  HAVE_CURVE25519
#define HAVE_CURVE25519

#undef  WC_RSA_PSS
#define WC_RSA_PSS

#undef  NO_RC4
#define NO_RC4

#undef  NO_HC128
#define NO_HC128

#undef  NO_RABBIT
#define NO_RABBIT

#undef  HAVE_POLY1305
#define HAVE_POLY1305

#undef  HAVE_ONE_TIME_AUTH
#define HAVE_ONE_TIME_AUTH

#undef  HAVE_CHACHA
#define HAVE_CHACHA

#undef  HAVE_HASHDRBG
#define HAVE_HASHDRBG

#undef  NO_FILESYSTEM
#define NO_FILESYSTEM

#undef  HAVE_EXTENDED_MASTER
#define HAVE_EXTENDED_MASTER

#undef  NO_PSK
#define NO_PSK

#undef  NO_MD4
#define NO_MD4

#undef  NO_PWDBASED
#define NO_PWDBASED

#undef  USE_FAST_MATH
#define USE_FAST_MATH

#undef  WC_NO_ASYNC_THREADING
#define WC_NO_ASYNC_THREADING

#undef  NO_DES3
#define NO_DES3


#ifdef __cplusplus
}
#endif


#endif /* WOLFSSL_OPTIONS_H */</code></pre></div><p>However in order to compile succesfully I need to add -DNO_WRITEV=1 to de compile options, and also when compiling the application. Could this be the problem?</p><p>I&#039;ll try to run the tests I&#039;m thinking about copying only the RSA test and removing the parts that depend on the file system or trying to compile the full test with Xilinx Memory File System.</p>]]></description>
			<author><![CDATA[null@example.com (RGnzlzRz)]]></author>
			<pubDate>Thu, 31 May 2018 13:30:52 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3995.html#p3995</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3991.html#p3991</link>
			<description><![CDATA[<p>Hi RGnzlzRz,</p><p>The next thing to check would be that the application running the RSA operations is being compiled with the exact same settings as wolfSSL. When using autotools (./configure) a file called wolfssl/options.h is created after the library is compiled. This file should be included first before any other wolfSSL header files. i.e.</p><p>#include &lt;wolfssl/options.h&gt;<br />#include &lt;wolfssl/wolfcrypt/rsa.h&gt;<br />...</p><p>If having the exact same options (macros) set with the application as when compiling the library does not resolve the issue, then we would need to run the tests from wolfcrypt/test/test.c to verify that the default unit tests for RSA pass on the system. It is a good idea to run these tests in any case.</p><p>Regards,<br />Jacob</p>]]></description>
			<author><![CDATA[null@example.com (Jacob)]]></author>
			<pubDate>Tue, 29 May 2018 15:32:45 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3991.html#p3991</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3990.html#p3990</link>
			<description><![CDATA[<p>Hi,</p><p>I&#039;ve been trying to figure out what is going wrong, and definitely something inside wc_RsaFunctionSync() doesn&#039;t work. In the end the RSA integer operations don&#039;t end with an appropriate result.</p><p>Regards,<br />RGnzlzRz</p>]]></description>
			<author><![CDATA[null@example.com (RGnzlzRz)]]></author>
			<pubDate>Tue, 29 May 2018 13:12:56 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3990.html#p3990</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3986.html#p3986</link>
			<description><![CDATA[<p>Hi, Jacob</p><p>I wrote this as a quick way to get a random source:</p><div class="codebox"><pre><code>int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
    {
    int i=0;
    
    srand(0);
    for(i=0;i&lt;sz;i++){
    output[i]=rand()%0xFF;
    }
        return 0;
    }</code></pre></div><p>I&#039;ve disabled -DWOLFSSL_STATIC_MEMORY=1 and -DBUILD_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256=1 and it seems to make no difference.</p><p>RGnzlzRz</p>]]></description>
			<author><![CDATA[null@example.com (RGnzlzRz)]]></author>
			<pubDate>Thu, 24 May 2018 06:52:07 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3986.html#p3986</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3985.html#p3985</link>
			<description><![CDATA[<p>Hi RGnzlzRz,</p><p>Thank you for sending across the build options. There is a couple of things that stand out to me with them.</p><p>1) Please remove -DBUILD_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256=1 . This macro should only be set by internal code if it finds that the required algorithms RSA, CHACHA, POLY1305, and ECC are available at build time.</p><p>2) The macro -DWOLFSSL_STATIC_MEMORY=1 will be setting the static memory feature which can make the use case more complicated. To begin with and to make sure the default build works please remove this to test.</p><p>3) With having -DNO_DEV_RANDOM=1&nbsp; it could be an issue with random number generation. Please add a source of entropy to the project. A good place for information about it would be to view the documentation on porting wolfSSL here <a href="https://www.wolfssl.com/docs/porting-guide/">https://www.wolfssl.com/docs/porting-guide/</a></p><p>Regards,<br />Jacob</p>]]></description>
			<author><![CDATA[null@example.com (Jacob)]]></author>
			<pubDate>Wed, 23 May 2018 23:04:41 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3985.html#p3985</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3982.html#p3982</link>
			<description><![CDATA[<p>I&#039;ve not been able to run the tests, but I&#039;ve traced the intermediate results in both PC and embedded platform.</p><p>It seems that the function that is giving different results with the same input is mp_to_unsigned_bin() in rsa.c line 1317. The result of this operation is later processed by RsaUnPad().</p><p>In PC the result starts this way:0x0,0x1,0xff,0xff... which seems to have the correct format.<br />In the embedded platform, however is: 0x0c,0xaf,0xaf,0xd9... which sets inmediatly the invalid flag to 1 because it dones&#039;t start with 0x0 and moreover doesn&#039;t lead to a correct size because it is not padded with 0xff.</p><p>It seems to be a difference in the variable tmp, but I can&#039;t figure out what makes this happen.</p>]]></description>
			<author><![CDATA[null@example.com (RGnzlzRz)]]></author>
			<pubDate>Wed, 23 May 2018 14:08:47 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3982.html#p3982</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3974.html#p3974</link>
			<description><![CDATA[<p>Thanks,</p><p>I&#039;ll try to run the test in the device to see the results, I think I disabled&nbsp; them because I was getting compilation errors, due to not having file system, I think. If I enable the tests I get:</p><div class="codebox"><pre><code>/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r&#039;:
sbrkr.c:(.text+0x1c): undefined reference to `_sbrk&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r&#039;:
writer.c:(.text+0x24): undefined reference to `_write&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r&#039;:
closer.c:(.text+0x1c): undefined reference to `_close&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r&#039;:
fstatr.c:(.text+0x20): undefined reference to `_fstat&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r&#039;:
isattyr.c:(.text+0x1c): undefined reference to `_isatty&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r&#039;:
lseekr.c:(.text+0x24): undefined reference to `_lseek&#039;
/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/../lib/gcc/arm-xilinx-eabi/4.8.3/../../../../arm-xilinx-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r&#039;:
readr.c:(.text+0x24): undefined reference to `_read&#039;
collect2: error: ld returned 1 exit status
make[1]: *** [wolfcrypt/test/testwolfcrypt] Error 1</code></pre></div><p>I&#039;m compiling using these options:</p><div class="codebox"><pre><code>./configure --host=arm-xilinx-eabi --enable-debug --enable-static --disable-shared --enable-singlethreaded --disable-examples --disable-filesystem --disable-crypttests --enable-ecc --enable-curve25519=small --enable-tls13 --enable-fastmath &quot;CC=/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/arm-xilinx-eabi-gcc&quot;
 
make CFLAGS=&quot;-DNO_FILESYSTEM=1 -DWOLFSSL_USER_IO=1 -DNO_WRITEV=1 -DNO_MAIN_DRIVER=1 -DNO_DEV_RANDOM=1 -DTIME_OVERRIDES=1 -DBUILD_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256=1 -DHAVE_ECC=1 -DHAVE_CHACHA -DHAVE_POLY1305 -DHAVE_CURVE25519 -DWOLFSSL_LOG_PRINTF=1 -DDEBUG_WOLFSSL=1 -DSINGLE_THREADED=1 -DWOLFSSL_USER_IO -DFP_MAX_BITS=8192&quot; TARGET_CFLAGS_ARCH=&#039;-mfloat-abi=softfp&#039;  CC=&quot;/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/arm-xilinx-eabi-gcc&quot;

make install CFLAGS=&quot;-DNO_FILESYSTEM=1 -DWOLFSSL_USER_IO=1 -DWOLFSSL_LOG_PRINTF=1 -DDEBUG_WOLFSSL=1 -DNO_WRITEV=1 -DNO_MAIN_DRIVER=1 -DWOLFSSL_STATIC_MEMORY=1 -DNO_DEV_RANDOM=1 -DTIME_OVERRIDES=1 -DBUILD_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256=1 -DHAVE_ECC=1 -DHAVE_CHACHA -DHAVE_POLY1305 -DHAVE_CURVE25519 -DWOLFSSL_LOG_PRINTF=1 -DDEBUG_WOLFSSL=1 -DSINGLE_THREADED=1 -DWOLFSSL_USER_IO -DFP_MAX_BITS=8192&quot; TARGET_CFLAGS_ARCH=&#039;-mfloat-abi=softfp&#039;  CC=&quot;/opt/Xilinx/SDK/2014.4/gnu/arm/lin/bin/arm-xilinx-eabi-gcc&quot;</code></pre></div><p>I already noticed an issue with the stack while debugging errors in RSA and increased it from 8 KB to 128 KB. Further increasing it doesn&#039;t seem to solve this problem, I already tried with 0xF0000, which should be 983040 bytes.<br />The key is 2048 bit.</p><p>Thank you,</p><p>RGnzlzRz</p>]]></description>
			<author><![CDATA[null@example.com (RGnzlzRz)]]></author>
			<pubDate>Fri, 18 May 2018 06:15:24 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3974.html#p3974</guid>
		</item>
		<item>
			<title><![CDATA[Re: Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3969.html#p3969</link>
			<description><![CDATA[<p>Hi RGnzlzRz,</p><p>Many times in embedded, and on resource constrained devices, issues with RSA operations are due to the amount of stack available. A good test for eliminating if memory availability is an issue, is to run the wolfCrypt tests. This test app is located in wolfssl-root/wolfcrypt/test/ directory.</p><p>Can you tell us some about the projects use case and the size of the RSA key in the certificate.</p><p>Regards,<br />Jacob</p>]]></description>
			<author><![CDATA[null@example.com (Jacob)]]></author>
			<pubDate>Thu, 17 May 2018 22:32:12 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3969.html#p3969</guid>
		</item>
		<item>
			<title><![CDATA[Baremetal Application - RsaUnPad error, bad formatting]]></title>
			<link>https://www.wolfssl.com/forums/post3967.html#p3967</link>
			<description><![CDATA[<p>Hi,</p><p>I&#039;m having problems verifying client RSA certificates in a bare metal server on an embedded platform. I have a PC client that verifies properly the certificate, to discard possible errors we have set the client to use the same certificate as the server, and we have verified in Wireshark that sent certificates are the same in both ends, so certificate should not be the issue.</p><p>Doing some debugging I&#039;ve observed that the error is generated in RsaUnPad(), in the first block.</p><p><em>if (pkcsBlock[0] != 0x0) { /* skip past zero */<br />&nbsp; &nbsp; &nbsp; &nbsp; invalid = 1;<br />&nbsp; &nbsp; }</em><br />This statement already sets invalid to 1.</p><p><em>&nbsp; &nbsp;if (padValue == RSA_BLOCK_TYPE_1) {<br />&nbsp; &nbsp; &nbsp; &nbsp; while (i&lt;pkcsBlockLen &amp;&amp; pkcsBlock[i++] == 0xFF) {/* Null body */}<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; else {<br />&nbsp; &nbsp; &nbsp; &nbsp; while (i&lt;pkcsBlockLen &amp;&amp; pkcsBlock[i++]) {/* Null body */}<br />&nbsp; &nbsp; }</em></p><p><em>&nbsp; &nbsp; if (!(i==pkcsBlockLen || pkcsBlock[i-1]==0)) {<br />&nbsp; &nbsp; &nbsp; &nbsp; WOLFSSL_MSG(&quot;RsaUnPad error, bad formatting&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; return RSA_PAD_E;<br />&nbsp; &nbsp; }</em></p><p>With this I get i=2, while debugging in PC I obtained &quot;i&quot; around 500 (near the block size) if I recall correctly. Therefore I think that the block passed to the function is corrupted.</p><p>I&#039;ve tried to trace where the error is but I&#039;m getting lost among the calls and parameter changes.</p><p>In ProcessPeerCerts() the actual correct certificate is in the variable &quot;input&quot; so initially the correct certificate is read, somewhere in the middle it must be corrupted.</p><p>I&#039;m using wolfssl 3.13.0.<br />log:</p><p><em>received record layer msg<br />wolfSSL Entering DoHandShakeMsg()<br />wolfSSL Entering DoHandShakeMsgType<br />processing certificate<br />wolfSSL Entering ProcessPeerCerts<br />Loading peer&#039;s cert chain<br />&nbsp; &nbsp; &nbsp; &nbsp; Put another cert into chain<br />Verifying Peer&#039;s cert<br />wolfSSL Entering GetExplicitVersion<br />wolfSSL Entering GetSerialNumber<br />Got Cert Header<br />wolfSSL Entering GetAlgoId<br />wolfSSL Entering GetObjectId()<br />Got Algo ID<br />Getting Cert Name<br />Getting Cert Name<br />Got Subject Name<br />wolfSSL Entering GetAlgoId<br />wolfSSL Entering GetObjectId()<br />Got Key<br />Parsed Past Key<br />wolfSSL Entering DecodeCertExtensions<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering DecodeAuthInfo<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering DecodeAuthKeyId<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering DecodeBasicCaConstraint<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering DecodeCrlDist<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering DecodeExtKeyUsage<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering DecodeKeyUsage<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering DecodeSubjKeyId<br />wolfSSL Entering GetObjectId()<br />wolfSSL Entering DecodeAltNames<br />&nbsp; &nbsp; &nbsp; &nbsp; Unsupported name type, skipping<br />wolfSSL Entering GetAlgoId<br />wolfSSL Entering GetObjectId()<br />About to verify certificate signature<br />wolfSSL Entering ConfirmSignature<br />RsaUnPad error, bad formatting<br />wolfSSL Leaving ConfirmSignature, return -155<br />Confirm signature failed<br />Failed to verify Peer&#039;s cert<br />&nbsp; &nbsp; &nbsp; &nbsp; No callback override available, fatal<br />wolfSSL Leaving ProcessPeerCerts, return -155<br />wolfSSL Leaving DoHandShakeMsgType(), return -155<br />wolfSSL Leaving DoHandShakeMsg(), return -155<br />wolfSSL error occurred, error = -155<br /></em></p><p>I&#039;d appreciate some help, maybe this data is helpful to fix my problem. Tell me if more there is more useful information that I can add.</p>]]></description>
			<author><![CDATA[null@example.com (RGnzlzRz)]]></author>
			<pubDate>Wed, 16 May 2018 14:11:26 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post3967.html#p3967</guid>
		</item>
	</channel>
</rss>
