<div dir="auto">Thank you for your reply.<div dir="auto">I'm still a bit confused though.</div><div dir="auto">In /providers/implementations/asymcipher/rsa_enc.c I find function </div><div dir="auto">rsa_decrypt() that calls RSA_private_decrypt(prsactx->rsa) </div><div dir="auto">I haven't found other implementation of this RSA_private_decrypt() apart from the one in crypto/RSA/rsa_crypt.c , where the RSA argument passed is used to call this:</div><div dir="auto">rsa->meth->rsa_priv_dec() </div><div dir="auto">I can't find where this pointer to method was set up. I can't find it in the init of the default provider's rsa_enc.c and if the app requesting this default RSA can't use the set_method() because deprecated, how is this rsa_priv_dec pointer set up?where is the set up of it?</div><div dir="auto">Thank you</div><div dir="auto"><br></div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 24 Sep 2021, 15:02 Matt Caswell, <<a href="mailto:matt@openssl.org">matt@openssl.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 24/09/2021 14:49, Antonio Santagiuliana wrote:<br>
> Hello , thank you all for the replies. Very useful.<br>
> I have seen in Openssl/crypto/RSA/rsa_local.h the definition of rsa_st <br>
> has a pointer to RSA_METHOD and I can't see this filled in in any of the <br>
> examples' set up or initializations, where is it filled in for the <br>
> default provider , for the RSA algorithm?<br>
> I can see the methods pointers are used later down in the call chain <br>
> from RSA_private_decrypt() in <br>
> providers/implementation/asymciphers/rsa_enc but I can't find where <br>
> these methods' pointers are set and I would like to understand how I <br>
> could pass a different method pointer in the parameters for a different <br>
> mod_exp operation , for example, or how I could set it on a completely <br>
> new RSA implementation mimicking the one in the default provider but <br>
> with different methods where I need them changed, minimizing the <br>
> differences with the default provider's RSA.<br>
<br>
The default RSA_METHOD structure to use can be set via <br>
RSA_set_default_method():<br>
<br>
<a href="https://www.openssl.org/docs/man3.0/man3/RSA_set_default_method.html" rel="noreferrer noreferrer" target="_blank">https://www.openssl.org/docs/man3.0/man3/RSA_set_default_method.html</a><br>
<br>
You can construct such an RSA_METHOD using the functions described here:<br>
<br>
<a href="https://www.openssl.org/docs/man3.0/man3/RSA_meth_new.html" rel="noreferrer noreferrer" target="_blank">https://www.openssl.org/docs/man3.0/man3/RSA_meth_new.html</a><br>
<br>
However all of the above is considered deprecated and legacy and may be <br>
removed from a future version of OpenSSL.<br>
<br>
Instead you are supposed to implement such things in a new provider. For <br>
example see:<br>
<br>
<a href="https://www.openssl.org/docs/man3.0/man7/provider-base.html" rel="noreferrer noreferrer" target="_blank">https://www.openssl.org/docs/man3.0/man7/provider-base.html</a><br>
<a href="https://www.openssl.org/docs/man3.0/man7/provider.html" rel="noreferrer noreferrer" target="_blank">https://www.openssl.org/docs/man3.0/man7/provider.html</a><br>
<a href="https://www.openssl.org/docs/man3.0/man7/provider-signature.html" rel="noreferrer noreferrer" target="_blank">https://www.openssl.org/docs/man3.0/man7/provider-signature.html</a><br>
<a href="https://www.openssl.org/docs/man3.0/man7/provider-keymgmt.html" rel="noreferrer noreferrer" target="_blank">https://www.openssl.org/docs/man3.0/man7/provider-keymgmt.html</a><br>
<br>
<br>
Matt<br>
<br>
<br>
> Thank you<br>
> <br>
> <br>
> On Fri, 24 Sep 2021, 12:22 Matt Caswell, <<a href="mailto:matt@openssl.org" target="_blank" rel="noreferrer">matt@openssl.org</a> <br>
> <mailto:<a href="mailto:matt@openssl.org" target="_blank" rel="noreferrer">matt@openssl.org</a>>> wrote:<br>
> <br>
> <br>
> <br>
>     On 24/09/2021 12:17, Dr Paul Dale wrote:<br>
>      > What about: apps/rsa.c, apps/rsautl.c and apps/genrsa.c<br>
>      > 3.0 doesn't use the RSA structure in the non-deprecated public API.<br>
>      ><br>
>      > You probably want the EVP_PKEY_fromdata call.<br>
> <br>
>     An example of building an RSA key from its constituent parts is<br>
>     available on the EVP_PKEY_fromdata() man page:<br>
> <br>
>     <a href="https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_fromdata.html" rel="noreferrer noreferrer" target="_blank">https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_fromdata.html</a><br>
>     <<a href="https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_fromdata.html" rel="noreferrer noreferrer" target="_blank">https://www.openssl.org/docs/man3.0/man3/EVP_PKEY_fromdata.html</a>><br>
> <br>
>     Matt<br>
> <br>
> <br>
>      ><br>
>      ><br>
>      > Pauli<br>
>      ><br>
>      ><br>
>      > On 24/9/21 8:55 pm, Antonio Santagiuliana wrote:<br>
>      >> Hello<br>
>      >> Is there any app or command in the current Openssl master<br>
>     repository<br>
>      >> that initialises and uses the new RSA provider?<br>
>      >> I would like to see how the RSA* context parameter is filled in and<br>
>      >> used, but I can't find an example using the RSA provider.<br>
>      >><br>
>      >><br>
>      >> Thank you<br>
>      >><br>
>      ><br>
> <br>
</blockquote></div>