Guidance on browsing code base

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Guidance on browsing code base

Fan Zhang
Hi, all,

Happy to meet your guys by this email. I’m trying to dig into the code base and find an implementation of RSA signature. Naturally, I looked into the function `int RSA_sign` in file `crypto/rsa/rsa_sign.c`, which further calls the `RSA_private_encrypt` and `RSA_private_encrypt` calls the method `rsa_priv_enc` in `rsa->meth`.

83 int RSA_private_encrypt(int flen, const unsigned char *from,
84                         unsigned char *to, RSA *rsa, int padding)
85 {
86     return (rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
87 }

After this, I got lost. I couldn't find when `rsa->meth` is initialized. Or maybe more directly, where is the actual code implementing the `rsa_priv_enc`? Thanks in advance!

Best
Fan


Sent from my iPhone
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: Guidance on browsing code base

Benjamin Kaduk
On 10/23/2015 04:27 PM, Fan Zhang wrote:

> Hi, all,
>
> Happy to meet your guys by this email. I’m trying to dig into the code base and find an implementation of RSA signature. Naturally, I looked into the function `int RSA_sign` in file `crypto/rsa/rsa_sign.c`, which further calls the `RSA_private_encrypt` and `RSA_private_encrypt` calls the method `rsa_priv_enc` in `rsa->meth`.
>
> 83 int RSA_private_encrypt(int flen, const unsigned char *from,
> 84                         unsigned char *to, RSA *rsa, int padding)
> 85 {
> 86     return (rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
> 87 }
>
> After this, I got lost. I couldn't find when `rsa->meth` is initialized. Or maybe more directly, where is the actual code implementing the `rsa_priv_enc`? Thanks in advance!
>

*rsa->meth is of type RSA_METHOD, which is a thing to search for.

In particular, check out crypto/rsa/rsa_eay.c.

-Ben Kaduk
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: Guidance on browsing code base

Fan Zhang
Thanks that seems to be the right place to look into.

btw, what does eay stand for?

> On Oct 23, 2015, at 5:50 PM, Benjamin Kaduk <[hidden email]> wrote:
>
> On 10/23/2015 04:27 PM, Fan Zhang wrote:
>> Hi, all,
>>
>> Happy to meet your guys by this email. I’m trying to dig into the code base and find an implementation of RSA signature. Naturally, I looked into the function `int RSA_sign` in file `crypto/rsa/rsa_sign.c`, which further calls the `RSA_private_encrypt` and `RSA_private_encrypt` calls the method `rsa_priv_enc` in `rsa->meth`.
>>
>> 83 int RSA_private_encrypt(int flen, const unsigned char *from,
>> 84                         unsigned char *to, RSA *rsa, int padding)
>> 85 {
>> 86     return (rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
>> 87 }
>>
>> After this, I got lost. I couldn't find when `rsa->meth` is initialized. Or maybe more directly, where is the actual code implementing the `rsa_priv_enc`? Thanks in advance!
>>
>
> *rsa->meth is of type RSA_METHOD, which is a thing to search for.
>
> In particular, check out crypto/rsa/rsa_eay.c.
>
> -Ben Kaduk
> _______________________________________________
> openssl-dev mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev
Reply | Threaded
Open this post in threaded view
|

Re: Guidance on browsing code base

Benjamin Kaduk
EAY is Eric A. Young, the original author of SSLeay, which became OpenSSL.

https://en.wikipedia.org/wiki/SSLeay

-Ben



On 10/23/2015 09:44 PM, Fan Zhang wrote:

> Thanks that seems to be the right place to look into.
>
> btw, what does eay stand for?
>
>> On Oct 23, 2015, at 5:50 PM, Benjamin Kaduk <[hidden email]> wrote:
>>
>> On 10/23/2015 04:27 PM, Fan Zhang wrote:
>>> Hi, all,
>>>
>>> Happy to meet your guys by this email. I’m trying to dig into the code base and find an implementation of RSA signature. Naturally, I looked into the function `int RSA_sign` in file `crypto/rsa/rsa_sign.c`, which further calls the `RSA_private_encrypt` and `RSA_private_encrypt` calls the method `rsa_priv_enc` in `rsa->meth`.
>>>
>>> 83 int RSA_private_encrypt(int flen, const unsigned char *from,
>>> 84                         unsigned char *to, RSA *rsa, int padding)
>>> 85 {
>>> 86     return (rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
>>> 87 }
>>>
>>> After this, I got lost. I couldn't find when `rsa->meth` is initialized. Or maybe more directly, where is the actual code implementing the `rsa_priv_enc`? Thanks in advance!
>>>
>> *rsa->meth is of type RSA_METHOD, which is a thing to search for.
>>
>> In particular, check out crypto/rsa/rsa_eay.c.
>>
>> -Ben Kaduk
>> _______________________________________________
>> openssl-dev mailing list
>> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev