<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>On 2021-04-15 12:57, Michal Moravec wrote:<br>
</p>
<blockquote type="cite"
cite="mid:A546662F-317E-4902-A63B-918EE33C953A@logicworks.cz">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div class="" style="word-wrap:break-word;
line-break:after-white-space">
<div class="">Follow-up on my previous email:</div>
<div class=""><br class="">
</div>
<div class="">I modified my proof-of-problem program to load
PKCS7 file into PKCS7 and convert it to CMS_ContentInfo using
the BIO (See convert.c in the attachment). It is similar to
this:</div>
<div class=""><br class="">
</div>
<div class="">
<blockquote type="cite" class="">
<div class="">handle_encrypted_content(SCEP *handle,
SCEP_DATA *data, PKCS7 *p7env, X509 *dec_cert, EVP_PKEY
*dec_key) {</div>
<div class="">...</div>
<div class="">CMS_ContentInfo *cmsMessage = NULL;</div>
<div class="">BIO *convert = NULL;</div>
<div class="">conversion = BIO_new(BIO_s_mem());</div>
<div class="">PEM_write_bio_PKCS7(conversion, p7env);</div>
<div class="">cmsEnv = PEM_read_bio_CMS(conversion, NULL,
NULL, NULL);</div>
<div class="">CMS_decrypt(cmsEnv, dec_key, dec_cert, NULL,
decData, 0);</div>
</blockquote>
</div>
<div class=""><br class="">
</div>
<div class="">convert.c works well with my test data and
CMS_decrypt successfully decrypts the CMS_ContentInfo.</div>
<div class=""><br class="">
</div>
<div class="">When I put this code into practice = using it in
the actual library -> <a
href="https://github.com/EtneteraLogicworks/libscep/commit/d94a24b28fcf3a1c1f0dc5e48e274627eed2b3f6"
class="" moz-do-not-send="true">https://github.com/EtneteraLogicworks/libscep/commit/d94a24b28fcf3a1c1f0dc5e48e274627eed2b3f6</a></div>
<div class="">Calling CMS_decrypt results in segfault inside
libcrypto library:</div>
<div class="">
</div>
<div class="">
</div>
<blockquote type="cite" class="">
<div class="">
<div class="">Apr 15 12:08:36 scepdev kernel: openxpkid
(main[759]: segfault at ffffffffac6d8cd0 ip
00007f6b4d3040a0 sp 00007ffde9477738 error 5 in
libcrypto.so.1.1[7f6b4d29c000+19e000]</div>
</div>
<span id="x_x-apple-selection:end"></span></blockquote>
<div class=""><br class="">
</div>
<div class="">I have no idea how to debug this :-( Way out of my
league here.</div>
<div class=""><br class="">
</div>
</div>
<div style="word-wrap:break-word; line-break:after-white-space">
<meta content="text/html; charset=us-ascii">
</div>
<div class="" style="word-wrap:break-word;
line-break:after-white-space">
<div class=""><br class="">
</div>
</div>
</blockquote>
<tt>Try linking libcrypto.so.1.1 with debug symbols included (not <br>
stripped). This should make the error message point to the <br>
function, maybe even show the call stack.</tt><tt><br>
</tt><br>
<pre class="moz-signature" cols="72">Enjoy
Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S. <a class="moz-txt-link-freetext" href="https://www.wisemo.com">https://www.wisemo.com</a>
Transformervej 29, 2860 Søborg, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded</pre>
</body>
</html>