<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"var\(--ff-mono\)";}
@font-face
        {font-family:inherit;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Please consult, “length” information in rte_crypto_sym_op structure
<a href="https://doc.dpdk.org/api/structrte__crypto__sym__op.html#aebb70c2aab3407a9f05334c47131a43b">
https://doc.dpdk.org/api/structrte__crypto__sym__op.html#aebb70c2aab3407a9f05334c47131a43b</a>.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">AES-CBC (or any CBC) is a block cipher -> source length should be multiple of the block size. Since DPDK does not append padding, it is user responsibility to make input data multiple of underlying block size.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Balakrishnan K <Balakrishnan.K1@tatacommunications.com>
<br>
<b>Sent:</b> Monday, June 6, 2022 2:32 PM<br>
<b>To:</b> Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>; users@dpdk.org<br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-IN">Hi Arik,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">  I have referred the symmetric cryptodev test cases and wrote the sample.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">I can encrypt the text as given in the example.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">While trying to change the offset and the length the crypto operation failing with below errors.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">process_openssl_cipher_encrypt() line 946: Process openssl cipher encrypt failed<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">USER1: Error sending packet for encryption<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Example:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">  I tried the offset value as 8 and length as 512 encryption failed.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Tried offset value as 8 and length as 496 (512-8) encryption working fine.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Dose it mean if we change the offset to multiples of 8 same offset value needs to be subtracted from the length (512-8 = 496)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">In my case trying to encrypt the tcp payload the starting offset value is 42 and length of the payload is 82.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">So, I have set the below value.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        sym_op->cipher.data.offset = 42;  (starting point of the data to be sent for crypto process)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        sym_op->cipher.data.length = 82; (length of the data)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">encryption process not working.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Using         cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">can you help on this how set the proper offset and the length value.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Bala <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>
<br>
<b>Sent:</b> 31 May 2022 13:00<br>
<b>To:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal">Hi Bala,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It is similar situation, it is the user who needs to decide where to start encryption process.<o:p></o:p></p>
<p class="MsoNormal">Please consult:<o:p></o:p></p>
<p class="MsoNormal"><a href="https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fapi%2Fstructrte__crypto__sym__op.html&data=05%7C01%7CBalakrishnan.K1%40tatacommunications.com%7Cf67a05accad74ae8ba4b08da42d77d37%7C202104622c5e4ec8b3e20be950f292ca%7C0%7C0%7C637895790535001554%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=bO25b5ylXhvsD8EnoCbJvo9W5V%2BsIKPFwnwugemKW6k%3D&reserved=0">https://doc.dpdk.org/api/structrte__crypto__sym__op.html</a><o:p></o:p></p>
<p class="MsoNormal"><a href="https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides%2Fprog_guide%2Fcryptodev_lib.html&data=05%7C01%7CBalakrishnan.K1%40tatacommunications.com%7Cf67a05accad74ae8ba4b08da42d77d37%7C202104622c5e4ec8b3e20be950f292ca%7C0%7C0%7C637895790535001554%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=TBY5Dk0Gbh0NdGHYetubv%2FW3z4uCOhsqRhphpCvL7iQ%3D&reserved=0">https://doc.dpdk.org/guides/prog_guide/cryptodev_lib.html</a>
<o:p></o:p></p>
<p class="MsoNormal">Please look into ‘offset’ and ‘length’ fields.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">P.S. “<span lang="EN-IN">encrypting the entire packets” -> it is usually not good idea to encrypt entire packets -> packets need to know where to travel, though authentication usually is done over the entire packet.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">P.S. (2) Using asymmetric cryptography for network packet payload encryption is not usually good idea either, not to mention natural performance penalty and few additional security issues, size of the encrypted data is
 usually limited to the size = (key size – [additional options | paddings | etc])<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Arek<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>
<br>
<b>Sent:</b> Tuesday, May 31, 2022 8:14 AM<br>
<b>To:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-IN">Hi Arek,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">   How about symmetric Cryptodev encryption .<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">In l2fwd_cryptodev example I could see the packets from Rx queue is fetched and passed to encryption.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Is symmetric encryption , encrypting the entire packets or payload section?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Bala <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>
<br>
<b>Sent:</b> 30 May 2022 17:52<br>
<b>To:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:14.25pt;background:white"><span style="color:black">For the Asym Cryptodev data to be encrypted it totally opaque -> it does not hold any information about data provided by the user, except for the algorithm parameters
 of course. So for example for the RSA, data that “asym_op->rsa.message.data” points to, will be encrypted up to the size of “asym_op->rsa.message.length” (provided size is in scope of possible encryption sizes) regardless if it is TLS or IKE or anything else.</span><span style="font-size:10.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>
<br>
<b>Sent:</b> Monday, May 30, 2022 1:59 PM<br>
<b>To:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-IN">Hi </span>Arek,<o:p></o:p></p>
<p class="MsoNormal">    Thanks for your inputs.<o:p></o:p></p>
<p class="MsoNormal">I wrote the sample application to encrypt the text from a file also decrypting the same.<o:p></o:p></p>
<p class="MsoNormal">Now next step is to encrypt the incoming packets.<o:p></o:p></p>
<p class="MsoNormal">I have one basic doubt. During rte_cryptodev_enqueue_burst call with operation type as RTE_CRYPTO_ASYM_OP_ENCRYPT.<o:p></o:p></p>
<p class="MsoNormal">For the incoming packet.<o:p></o:p></p>
<p class="MsoNormal">what is being encrypted ,Is it entire packet or the payload(data section) ?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Bala <o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>
<br>
<b>Sent:</b> 25 May 2022 16:13<br>
<b>To:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal">Hi Bala,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-IN">To fill the below struct do I need to extract Publickey exponent , Private key exponent etc.<o:p></o:p></span></p>
<p class="MsoNormal">[Arek] – yes, you need to convert keys into big-endian unsigned integer.<o:p></o:p></p>
<p class="MsoNormal">In the file “test_cryptodev_rsa_test_vectors.h” there are few examples.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Arek<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>
<br>
<b>Sent:</b> Wednesday, May 25, 2022 12:08 PM<br>
<b>To:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-IN">Hi Arek,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">    I have public and private key with me which can be used for encryption/decryption.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">To fill the below struct do I need to extract Publickey exponent , Private key exponent etc.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">The reason why I am asking is, in openssl for encryption we will use key directly with the exposed API.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Example :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal" style="vertical-align:baseline"><span lang="EN-IN" style="font-size:10.0pt;font-family:inherit;border:none windowtext 1.0pt;padding:0in">RSA_private_encrypt(strlen(msg), (unsigned char *)msg, encrypted, rsa, RSA_PKCS1_PADDING);</span><span lang="EN-IN" style="font-size:10.0pt;font-family:"var\(--ff-mono\)""><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Here in dpdk the rsa struct looks different .<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Thanks in advance.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">struct rte_crypto_rsa_xform {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">rte_crypto_param n;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        /**< n - Modulus<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">         * Modulus data of RSA operation in Octet-string network<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">         * byte order format.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">         */<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        rte_crypto_param e;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        /**< e - Public key exponent<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">         * Public key exponent used for RSA public key operations in Octet-<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">         * string network byte order format.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">         */<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        enum rte_crypto_rsa_priv_key_type key_type;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        __extension__<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        union {<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">                rte_crypto_param d;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">                /**< d - Private key exponent<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">                 * Private key exponent used for RSA<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">                 * private key operations in<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">                 * Octet-string  network byte order format.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">                 */<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">                struct rte_crypto_rsa_priv_key_qt qt;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">                /**< qt - Private key in quintuple format */<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">        };<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">};<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Bala <o:p></o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Balakrishnan K <br>
<b>Sent:</b> 24 May 2022 17:42<br>
<b>To:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-IN">Hi </span>Arek,<o:p></o:p></p>
<p class="MsoNormal">  Thanks for the detailed explanation.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Bala <o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>
<br>
<b>Sent:</b> 24 May 2022 14:44<br>
<b>To:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<pre>I should use <o:p></o:p></pre>
<pre>debug_hexdump(stdout, "encrypted message", asym_op->rsa.cipher.data,<o:p></o:p></pre>
<pre>                      asym_op->rsa.cipher.length);<o:p></o:p></pre>
<pre>to check the encrypted message for the input given?<o:p></o:p></pre>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Yes, currently it works this way. The same way output for decryption will be placed in asym_op->rsa.message.data and input in asym_op->rsa.cipher.data.<o:p></o:p></p>
<p class="MsoNormal">More explanations can be found in rte_crypto_asym.h file<o:p></o:p></p>
<p class="MsoNormal"><a href="https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fapi%2Fstructrte__crypto__rsa__op__param.html&data=05%7C01%7CBalakrishnan.K1%40tatacommunications.com%7Cf67a05accad74ae8ba4b08da42d77d37%7C202104622c5e4ec8b3e20be950f292ca%7C0%7C0%7C637895790535001554%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mPkeI59HaahrnKQDuXONtJmROezh0VIdIc1JutBhjRI%3D&reserved=0">https://doc.dpdk.org/api/structrte__crypto__rsa__op__param.html</a>.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>
<br>
<b>Sent:</b> Tuesday, May 24, 2022 7:24 AM<br>
<b>To:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-IN">Hi </span>Arek,<o:p></o:p></p>
<p class="MsoNormal">   Thanks for quick response.<o:p></o:p></p>
<p class="MsoNormal">I am using resulted output vector to verify the encrypted message.<o:p></o:p></p>
<pre><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">I thought the encrypted data will be in the asym_op->rsa.message.data after rte_cryptodev_enqueue_burst and rte_cryptodev_enqueue_burst call with operation type RTE_CRYPTO_ASYM_OP_ENCRYPT.<o:p></o:p></span></pre>
<pre><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">So ,I checked the hex_dump of asym_op->rsa.message.data.<o:p></o:p></span></pre>
<pre><o:p> </o:p></pre>
<pre>Code snippet:<o:p></o:p></pre>
<pre>asym_op = result_op->asym;<o:p></o:p></pre>
<pre>debug_hexdump(stdout, "encrypted message", asym_op->rsa.message.data,<o:p></o:p></pre>
<pre>                      asym_op->rsa.message.length);<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre><span lang="EN-IN" style="font-size:9.0pt;font-family:Consolas;color:#404040">Encrypted data will be placed in </span>asym_op->rsa.cipher.data after crypto operation is my understanding is correct ?<o:p></o:p></pre>
<pre>I should use <o:p></o:p></pre>
<pre>debug_hexdump(stdout, "encrypted message", asym_op->rsa.cipher.data,<o:p></o:p></pre>
<pre>                      asym_op->rsa.cipher.length);<o:p></o:p></pre>
<pre>to check the encrypted message for the input given?<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Regards,<o:p></o:p></pre>
<pre>Bala <o:p></o:p></pre>
<pre><span lang="EN-IN" style="font-size:9.0pt;font-family:Consolas;color:#404040"><o:p> </o:p></span></pre>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Kusztal, ArkadiuszX <<a href="mailto:arkadiuszx.kusztal@intel.com">arkadiuszx.kusztal@intel.com</a>>
<br>
<b>Sent:</b> 23 May 2022 18:15<br>
<b>To:</b> Balakrishnan K <<a href="mailto:Balakrishnan.K1@tatacommunications.com">Balakrishnan.K1@tatacommunications.com</a>>;
<a href="mailto:users@dpdk.org">users@dpdk.org</a><br>
<b>Subject:</b> RE: how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-IN"><o:p> </o:p></span></p>
<div style="border:dotted #003333 1.0pt;padding:10.0pt 10.0pt 10.0pt 10.0pt">
<p style="background:#CFD3D6"><b><span style="font-size:7.5pt;color:red">CAUTION</span></b><span style="font-size:7.5pt;color:red">: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender
 and know the content is safe. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">Hi Bala,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Ciphertext will be written into asym_op->rsa.cipher.data (not message.data) by the PMD, here you are using same address for both hex dumps.<o:p></o:p></p>
<p class="MsoNormal">Although there is a bug in debug_hexdump in this function which may cause this confusion.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Plus, the test you are referring is PWCT test (Pairwise conditional test) -> it will encrypt, then decrypt.<o:p></o:p></p>
<p class="MsoNormal">Please take a look into this comment in queue_ops_rsa_enc_dec function:<o:p></o:p></p>
<p class="MsoNormal">/* Use the resulted output as decryption Input vector*<o:p></o:p></p>
<p class="MsoNormal">So above this line there is an encryption part.<o:p></o:p></p>
<p class="MsoNormal">Below is decryption.           <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Arek<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Balakrishnan K <<span lang="EN-IN"><a href="mailto:Balakrishnan.K1@tatacommunications.com"><span lang="EN-US">Balakrishnan.K1@tatacommunications.com</span></a></span>>
<br>
<b>Sent:</b> Monday, May 23, 2022 1:33 PM<br>
<b>To:</b> <span lang="EN-IN"><a href="mailto:users@dpdk.org"><span lang="EN-US">users@dpdk.org</span></a></span><br>
<b>Subject:</b> how to use crypto openssl PMD for asymmetric encryption and decryption<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi All,<o:p></o:p></p>
<p class="MsoNormal">   I am new to dpdk. Planning to use openssl crypto PMD for encrypting/decrypting  the packets.<o:p></o:p></p>
<p class="MsoNormal">Couldn’t find much documents on openssl PMD for <b>asymmetric</b> encryption/decryption.<o:p></o:p></p>
<p class="MsoNormal">Any one please point me in the right document.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have tried to run the test cases wrote for asymmetric crypto using openssl virtual PMD.<o:p></o:p></p>
<p class="MsoNormal">But the output of particular test case is same after the encryption done.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">File : app/test/test_cryptodev_asym.c<o:p></o:p></p>
<p class="MsoNormal">Test executable: ./app/test/dpdk-test<o:p></o:p></p>
<p class="MsoNormal">Test case : test_rsa_enc_dec<o:p></o:p></p>
<p class="MsoNormal">    <o:p></o:p></p>
<p class="MsoNormal"><b>Input given to encryption:              <o:p></o:p></b></p>
<p class="MsoNormal">message at [0x1894e60], len=20<o:p></o:p></p>
<p class="MsoNormal">00000000: F8 BA 1A 55 D0 2F 85 AE 96 7B B6 2F B6 CD A8 EB | ...U./...{./....<o:p></o:p></p>
<p class="MsoNormal">00000010: 7E 78 A0 50                                     | ~x.P<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>After processing the output also looks like same :<o:p></o:p></b></p>
<p class="MsoNormal">encrypted message exist at [0x1894e60], len=20<o:p></o:p></p>
<p class="MsoNormal">00000000: F8 BA 1A 55 D0 2F 85 AE 96 7B B6 2F B6 CD A8 EB | ...U./...{./....<o:p></o:p></p>
<p class="MsoNormal">00000010: 7E 78 A0 50<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Bala <o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>