crypto/openssl: support DES-CBC
[dpdk.git] / drivers / crypto / openssl / rte_openssl_pmd_ops.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Intel Corporation nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #include <string.h>
34
35 #include <rte_common.h>
36 #include <rte_malloc.h>
37 #include <rte_cryptodev_pmd.h>
38
39 #include "rte_openssl_pmd_private.h"
40
41
42 static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
43         {       /* MD5 HMAC */
44                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
45                 {.sym = {
46                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
47                         {.auth = {
48                                 .algo = RTE_CRYPTO_AUTH_MD5_HMAC,
49                                 .block_size = 64,
50                                 .key_size = {
51                                         .min = 1,
52                                         .max = 64,
53                                         .increment = 1
54                                 },
55                                 .digest_size = {
56                                         .min = 16,
57                                         .max = 16,
58                                         .increment = 0
59                                 },
60                                 .iv_size = { 0 }
61                         }, }
62                 }, }
63         },
64         {       /* MD5 */
65                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
66                 {.sym = {
67                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
68                         {.auth = {
69                                 .algo = RTE_CRYPTO_AUTH_MD5,
70                                 .block_size = 64,
71                                 .key_size = {
72                                         .min = 0,
73                                         .max = 0,
74                                         .increment = 0
75                                 },
76                                 .digest_size = {
77                                         .min = 16,
78                                         .max = 16,
79                                         .increment = 0
80                                 },
81                                 .iv_size = { 0 }
82                         }, }
83                 }, }
84         },
85         {       /* SHA1 HMAC */
86                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
87                 {.sym = {
88                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
89                         {.auth = {
90                                 .algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
91                                 .block_size = 64,
92                                 .key_size = {
93                                         .min = 1,
94                                         .max = 64,
95                                         .increment = 1
96                                 },
97                                 .digest_size = {
98                                         .min = 20,
99                                         .max = 20,
100                                         .increment = 0
101                                 },
102                                 .iv_size = { 0 }
103                         }, }
104                 }, }
105         },
106         {       /* SHA1 */
107                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
108                 {.sym = {
109                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
110                         {.auth = {
111                                 .algo = RTE_CRYPTO_AUTH_SHA1,
112                                 .block_size = 64,
113                                 .key_size = {
114                                         .min = 0,
115                                         .max = 0,
116                                         .increment = 0
117                                 },
118                                 .digest_size = {
119                                         .min = 20,
120                                         .max = 20,
121                                         .increment = 0
122                                 },
123                                 .iv_size = { 0 }
124                         }, }
125                 }, }
126         },
127         {       /* SHA224 HMAC */
128                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
129                 {.sym = {
130                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
131                         {.auth = {
132                                 .algo = RTE_CRYPTO_AUTH_SHA224_HMAC,
133                                 .block_size = 64,
134                                 .key_size = {
135                                         .min = 1,
136                                         .max = 64,
137                                         .increment = 1
138                                 },
139                                 .digest_size = {
140                                         .min = 28,
141                                         .max = 28,
142                                         .increment = 0
143                                 },
144                                 .iv_size = { 0 }
145                         }, }
146                 }, }
147         },
148         {       /* SHA224 */
149                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
150                 {.sym = {
151                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
152                         {.auth = {
153                                 .algo = RTE_CRYPTO_AUTH_SHA224,
154                                 .block_size = 64,
155                                 .key_size = {
156                                         .min = 0,
157                                         .max = 0,
158                                         .increment = 0
159                                 },
160                                 .digest_size = {
161                                         .min = 28,
162                                         .max = 28,
163                                         .increment = 0
164                                 },
165                                 .iv_size = { 0 }
166                         }, }
167                 }, }
168         },
169         {       /* SHA256 HMAC */
170                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
171                 {.sym = {
172                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
173                         {.auth = {
174                                 .algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
175                                 .block_size = 64,
176                                 .key_size = {
177                                         .min = 1,
178                                         .max = 64,
179                                         .increment = 1
180                                 },
181                                 .digest_size = {
182                                         .min = 32,
183                                         .max = 32,
184                                         .increment = 0
185                                 },
186                                 .iv_size = { 0 }
187                         }, }
188                 }, }
189         },
190         {       /* SHA256 */
191                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
192                 {.sym = {
193                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
194                         {.auth = {
195                                 .algo = RTE_CRYPTO_AUTH_SHA256,
196                                 .block_size = 64,
197                                 .key_size = {
198                                         .min = 0,
199                                         .max = 0,
200                                         .increment = 0
201                                 },
202                                 .digest_size = {
203                                         .min = 32,
204                                         .max = 32,
205                                         .increment = 0
206                                 },
207                                 .iv_size = { 0 }
208                         }, }
209                 }, }
210         },
211         {       /* SHA384 HMAC */
212                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
213                 {.sym = {
214                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
215                         {.auth = {
216                                 .algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
217                                 .block_size = 128,
218                                 .key_size = {
219                                         .min = 1,
220                                         .max = 128,
221                                         .increment = 1
222                                 },
223                                 .digest_size = {
224                                         .min = 48,
225                                         .max = 48,
226                                         .increment = 0
227                                 },
228                                 .iv_size = { 0 }
229                         }, }
230                 }, }
231         },
232         {       /* SHA384 */
233                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
234                 {.sym = {
235                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
236                         {.auth = {
237                                 .algo = RTE_CRYPTO_AUTH_SHA384,
238                                 .block_size = 128,
239                                 .key_size = {
240                                         .min = 0,
241                                         .max = 0,
242                                         .increment = 0
243                                 },
244                                 .digest_size = {
245                                         .min = 48,
246                                         .max = 48,
247                                         .increment = 0
248                                 },
249                                 .iv_size = { 0 }
250                         }, }
251                 }, }
252         },
253         {       /* SHA512 HMAC */
254                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
255                 {.sym = {
256                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
257                         {.auth = {
258                                 .algo = RTE_CRYPTO_AUTH_SHA512_HMAC,
259                                 .block_size = 128,
260                                 .key_size = {
261                                         .min = 1,
262                                         .max = 128,
263                                         .increment = 1
264                                 },
265                                 .digest_size = {
266                                         .min = 64,
267                                         .max = 64,
268                                         .increment = 0
269                                 },
270                                 .iv_size = { 0 }
271                         }, }
272                 }, }
273         },
274         {       /* SHA512  */
275                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
276                 {.sym = {
277                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
278                         {.auth = {
279                                 .algo = RTE_CRYPTO_AUTH_SHA512,
280                                 .block_size = 128,
281                                 .key_size = {
282                                         .min = 0,
283                                         .max = 0,
284                                         .increment = 0
285                                 },
286                                 .digest_size = {
287                                         .min = 64,
288                                         .max = 64,
289                                         .increment = 0
290                                 },
291                                 .iv_size = { 0 }
292                         }, }
293                 }, }
294         },
295         {       /* AES CBC */
296                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
297                 {.sym = {
298                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
299                         {.cipher = {
300                                 .algo = RTE_CRYPTO_CIPHER_AES_CBC,
301                                 .block_size = 16,
302                                 .key_size = {
303                                         .min = 16,
304                                         .max = 32,
305                                         .increment = 8
306                                 },
307                                 .iv_size = {
308                                         .min = 16,
309                                         .max = 16,
310                                         .increment = 0
311                                 }
312                         }, }
313                 }, }
314         },
315         {       /* AES CTR */
316                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
317                 {.sym = {
318                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
319                         {.cipher = {
320                                 .algo = RTE_CRYPTO_CIPHER_AES_CTR,
321                                 .block_size = 16,
322                                 .key_size = {
323                                         .min = 16,
324                                         .max = 32,
325                                         .increment = 8
326                                 },
327                                 .iv_size = {
328                                         .min = 16,
329                                         .max = 16,
330                                         .increment = 0
331                                 }
332                         }, }
333                 }, }
334         },
335         {       /* AES GCM */
336                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
337                 {.sym = {
338                         .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
339                         {.aead = {
340                                 .algo = RTE_CRYPTO_AEAD_AES_GCM,
341                                 .block_size = 16,
342                                 .key_size = {
343                                         .min = 16,
344                                         .max = 32,
345                                         .increment = 8
346                                 },
347                                 .digest_size = {
348                                         .min = 16,
349                                         .max = 16,
350                                         .increment = 0
351                                 },
352                                 .aad_size = {
353                                         .min = 0,
354                                         .max = 65535,
355                                         .increment = 1
356                                 },
357                                 .iv_size = {
358                                         .min = 12,
359                                         .max = 16,
360                                         .increment = 4
361                                 },
362                         }, }
363                 }, }
364         },
365         {       /* AES GMAC (AUTH) */
366                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
367                 {.sym = {
368                         .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
369                         {.auth = {
370                                 .algo = RTE_CRYPTO_AUTH_AES_GMAC,
371                                 .block_size = 16,
372                                 .key_size = {
373                                         .min = 16,
374                                         .max = 32,
375                                         .increment = 8
376                                 },
377                                 .digest_size = {
378                                         .min = 16,
379                                         .max = 16,
380                                         .increment = 0
381                                 },
382                                 .iv_size = {
383                                         .min = 12,
384                                         .max = 16,
385                                         .increment = 4
386                                 }
387                         }, }
388                 }, }
389         },
390         {       /* 3DES CBC */
391                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
392                 {.sym = {
393                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
394                         {.cipher = {
395                                 .algo = RTE_CRYPTO_CIPHER_3DES_CBC,
396                                 .block_size = 8,
397                                 .key_size = {
398                                         .min = 16,
399                                         .max = 24,
400                                         .increment = 8
401                                 },
402                                 .iv_size = {
403                                         .min = 8,
404                                         .max = 8,
405                                         .increment = 0
406                                 }
407                         }, }
408                 }, }
409         },
410         {       /* 3DES CTR */
411                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
412                 {.sym = {
413                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
414                         {.cipher = {
415                                 .algo = RTE_CRYPTO_CIPHER_3DES_CTR,
416                                 .block_size = 8,
417                                 .key_size = {
418                                         .min = 16,
419                                         .max = 24,
420                                         .increment = 8
421                                 },
422                                 .iv_size = {
423                                         .min = 8,
424                                         .max = 8,
425                                         .increment = 0
426                                 }
427                         }, }
428                 }, }
429         },
430         {       /* DES CBC */
431                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
432                 {.sym = {
433                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
434                         {.cipher = {
435                                 .algo = RTE_CRYPTO_CIPHER_DES_CBC,
436                                 .block_size = 8,
437                                 .key_size = {
438                                         .min = 8,
439                                         .max = 8,
440                                         .increment = 0
441                                 },
442                                 .iv_size = {
443                                         .min = 8,
444                                         .max = 8,
445                                         .increment = 0
446                                 }
447                         }, }
448                 }, }
449         },
450         {       /* DES DOCSIS BPI */
451                 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
452                 {.sym = {
453                         .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
454                         {.cipher = {
455                                 .algo = RTE_CRYPTO_CIPHER_DES_DOCSISBPI,
456                                 .block_size = 8,
457                                 .key_size = {
458                                         .min = 8,
459                                         .max = 8,
460                                         .increment = 0
461                                 },
462                                 .iv_size = {
463                                         .min = 8,
464                                         .max = 8,
465                                         .increment = 0
466                                 }
467                         }, }
468                 }, }
469         },
470
471         RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
472 };
473
474
475 /** Configure device */
476 static int
477 openssl_pmd_config(__rte_unused struct rte_cryptodev *dev,
478                 __rte_unused struct rte_cryptodev_config *config)
479 {
480         return 0;
481 }
482
483 /** Start device */
484 static int
485 openssl_pmd_start(__rte_unused struct rte_cryptodev *dev)
486 {
487         return 0;
488 }
489
490 /** Stop device */
491 static void
492 openssl_pmd_stop(__rte_unused struct rte_cryptodev *dev)
493 {
494 }
495
496 /** Close device */
497 static int
498 openssl_pmd_close(__rte_unused struct rte_cryptodev *dev)
499 {
500         return 0;
501 }
502
503
504 /** Get device statistics */
505 static void
506 openssl_pmd_stats_get(struct rte_cryptodev *dev,
507                 struct rte_cryptodev_stats *stats)
508 {
509         int qp_id;
510
511         for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
512                 struct openssl_qp *qp = dev->data->queue_pairs[qp_id];
513
514                 stats->enqueued_count += qp->stats.enqueued_count;
515                 stats->dequeued_count += qp->stats.dequeued_count;
516
517                 stats->enqueue_err_count += qp->stats.enqueue_err_count;
518                 stats->dequeue_err_count += qp->stats.dequeue_err_count;
519         }
520 }
521
522 /** Reset device statistics */
523 static void
524 openssl_pmd_stats_reset(struct rte_cryptodev *dev)
525 {
526         int qp_id;
527
528         for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
529                 struct openssl_qp *qp = dev->data->queue_pairs[qp_id];
530
531                 memset(&qp->stats, 0, sizeof(qp->stats));
532         }
533 }
534
535
536 /** Get device info */
537 static void
538 openssl_pmd_info_get(struct rte_cryptodev *dev,
539                 struct rte_cryptodev_info *dev_info)
540 {
541         struct openssl_private *internals = dev->data->dev_private;
542
543         if (dev_info != NULL) {
544                 dev_info->driver_id = dev->driver_id;
545                 dev_info->feature_flags = dev->feature_flags;
546                 dev_info->capabilities = openssl_pmd_capabilities;
547                 dev_info->max_nb_queue_pairs = internals->max_nb_qpairs;
548                 dev_info->sym.max_nb_sessions = internals->max_nb_sessions;
549         }
550 }
551
552 /** Release queue pair */
553 static int
554 openssl_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
555 {
556         if (dev->data->queue_pairs[qp_id] != NULL) {
557                 rte_free(dev->data->queue_pairs[qp_id]);
558                 dev->data->queue_pairs[qp_id] = NULL;
559         }
560         return 0;
561 }
562
563 /** set a unique name for the queue pair based on it's name, dev_id and qp_id */
564 static int
565 openssl_pmd_qp_set_unique_name(struct rte_cryptodev *dev,
566                 struct openssl_qp *qp)
567 {
568         unsigned int n = snprintf(qp->name, sizeof(qp->name),
569                         "openssl_pmd_%u_qp_%u",
570                         dev->data->dev_id, qp->id);
571
572         if (n > sizeof(qp->name))
573                 return -1;
574
575         return 0;
576 }
577
578
579 /** Create a ring to place processed operations on */
580 static struct rte_ring *
581 openssl_pmd_qp_create_processed_ops_ring(struct openssl_qp *qp,
582                 unsigned int ring_size, int socket_id)
583 {
584         struct rte_ring *r;
585
586         r = rte_ring_lookup(qp->name);
587         if (r) {
588                 if (rte_ring_get_size(r) >= ring_size) {
589                         OPENSSL_LOG_INFO(
590                                 "Reusing existing ring %s for processed ops",
591                                  qp->name);
592                         return r;
593                 }
594
595                 OPENSSL_LOG_ERR(
596                         "Unable to reuse existing ring %s for processed ops",
597                          qp->name);
598                 return NULL;
599         }
600
601         return rte_ring_create(qp->name, ring_size, socket_id,
602                         RING_F_SP_ENQ | RING_F_SC_DEQ);
603 }
604
605
606 /** Setup a queue pair */
607 static int
608 openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
609                 const struct rte_cryptodev_qp_conf *qp_conf,
610                 int socket_id, struct rte_mempool *session_pool)
611 {
612         struct openssl_qp *qp = NULL;
613
614         /* Free memory prior to re-allocation if needed. */
615         if (dev->data->queue_pairs[qp_id] != NULL)
616                 openssl_pmd_qp_release(dev, qp_id);
617
618         /* Allocate the queue pair data structure. */
619         qp = rte_zmalloc_socket("OPENSSL PMD Queue Pair", sizeof(*qp),
620                                         RTE_CACHE_LINE_SIZE, socket_id);
621         if (qp == NULL)
622                 return -ENOMEM;
623
624         qp->id = qp_id;
625         dev->data->queue_pairs[qp_id] = qp;
626
627         if (openssl_pmd_qp_set_unique_name(dev, qp))
628                 goto qp_setup_cleanup;
629
630         qp->processed_ops = openssl_pmd_qp_create_processed_ops_ring(qp,
631                         qp_conf->nb_descriptors, socket_id);
632         if (qp->processed_ops == NULL)
633                 goto qp_setup_cleanup;
634
635         qp->sess_mp = session_pool;
636
637         memset(&qp->stats, 0, sizeof(qp->stats));
638
639         return 0;
640
641 qp_setup_cleanup:
642         if (qp)
643                 rte_free(qp);
644
645         return -1;
646 }
647
648 /** Start queue pair */
649 static int
650 openssl_pmd_qp_start(__rte_unused struct rte_cryptodev *dev,
651                 __rte_unused uint16_t queue_pair_id)
652 {
653         return -ENOTSUP;
654 }
655
656 /** Stop queue pair */
657 static int
658 openssl_pmd_qp_stop(__rte_unused struct rte_cryptodev *dev,
659                 __rte_unused uint16_t queue_pair_id)
660 {
661         return -ENOTSUP;
662 }
663
664 /** Return the number of allocated queue pairs */
665 static uint32_t
666 openssl_pmd_qp_count(struct rte_cryptodev *dev)
667 {
668         return dev->data->nb_queue_pairs;
669 }
670
671 /** Returns the size of the session structure */
672 static unsigned
673 openssl_pmd_session_get_size(struct rte_cryptodev *dev __rte_unused)
674 {
675         return sizeof(struct openssl_session);
676 }
677
678 /** Configure the session from a crypto xform chain */
679 static int
680 openssl_pmd_session_configure(struct rte_cryptodev *dev __rte_unused,
681                 struct rte_crypto_sym_xform *xform,
682                 struct rte_cryptodev_sym_session *sess,
683                 struct rte_mempool *mempool)
684 {
685         void *sess_private_data;
686         int ret;
687
688         if (unlikely(sess == NULL)) {
689                 OPENSSL_LOG_ERR("invalid session struct");
690                 return -EINVAL;
691         }
692
693         if (rte_mempool_get(mempool, &sess_private_data)) {
694                 CDEV_LOG_ERR(
695                         "Couldn't get object from session mempool");
696                 return -ENOMEM;
697         }
698
699         ret = openssl_set_session_parameters(sess_private_data, xform);
700         if (ret != 0) {
701                 OPENSSL_LOG_ERR("failed configure session parameters");
702
703                 /* Return session to mempool */
704                 rte_mempool_put(mempool, sess_private_data);
705                 return ret;
706         }
707
708         set_session_private_data(sess, dev->driver_id,
709                         sess_private_data);
710
711         return 0;
712 }
713
714
715 /** Clear the memory of session so it doesn't leave key material behind */
716 static void
717 openssl_pmd_session_clear(struct rte_cryptodev *dev,
718                 struct rte_cryptodev_sym_session *sess)
719 {
720         uint8_t index = dev->driver_id;
721         void *sess_priv = get_session_private_data(sess, index);
722
723         /* Zero out the whole structure */
724         if (sess_priv) {
725                 openssl_reset_session(sess_priv);
726                 memset(sess_priv, 0, sizeof(struct openssl_session));
727                 struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
728                 set_session_private_data(sess, index, NULL);
729                 rte_mempool_put(sess_mp, sess_priv);
730         }
731 }
732
733 struct rte_cryptodev_ops openssl_pmd_ops = {
734                 .dev_configure          = openssl_pmd_config,
735                 .dev_start              = openssl_pmd_start,
736                 .dev_stop               = openssl_pmd_stop,
737                 .dev_close              = openssl_pmd_close,
738
739                 .stats_get              = openssl_pmd_stats_get,
740                 .stats_reset            = openssl_pmd_stats_reset,
741
742                 .dev_infos_get          = openssl_pmd_info_get,
743
744                 .queue_pair_setup       = openssl_pmd_qp_setup,
745                 .queue_pair_release     = openssl_pmd_qp_release,
746                 .queue_pair_start       = openssl_pmd_qp_start,
747                 .queue_pair_stop        = openssl_pmd_qp_stop,
748                 .queue_pair_count       = openssl_pmd_qp_count,
749
750                 .session_get_size       = openssl_pmd_session_get_size,
751                 .session_configure      = openssl_pmd_session_configure,
752                 .session_clear          = openssl_pmd_session_clear
753 };
754
755 struct rte_cryptodev_ops *rte_openssl_pmd_ops = &openssl_pmd_ops;