1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Intel Corporation
7 #include <rte_common.h>
8 #include <rte_malloc.h>
9 #include <rte_cryptodev_pmd.h>
11 #include "rte_openssl_pmd_private.h"
15 static const struct rte_cryptodev_capabilities openssl_pmd_capabilities[] = {
17 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
19 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
21 .algo = RTE_CRYPTO_AUTH_MD5_HMAC,
38 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
40 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
42 .algo = RTE_CRYPTO_AUTH_MD5,
59 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
61 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
63 .algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
80 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
82 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
84 .algo = RTE_CRYPTO_AUTH_SHA1,
101 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
103 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
105 .algo = RTE_CRYPTO_AUTH_SHA224_HMAC,
122 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
124 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
126 .algo = RTE_CRYPTO_AUTH_SHA224,
143 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
145 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
147 .algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
164 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
166 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
168 .algo = RTE_CRYPTO_AUTH_SHA256,
185 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
187 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
189 .algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
206 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
208 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
210 .algo = RTE_CRYPTO_AUTH_SHA384,
227 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
229 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
231 .algo = RTE_CRYPTO_AUTH_SHA512_HMAC,
248 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
250 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
252 .algo = RTE_CRYPTO_AUTH_SHA512,
269 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
271 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
273 .algo = RTE_CRYPTO_CIPHER_AES_CBC,
289 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
291 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
293 .algo = RTE_CRYPTO_CIPHER_AES_CTR,
309 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
311 .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
313 .algo = RTE_CRYPTO_AEAD_AES_GCM,
339 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
341 .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD,
343 .algo = RTE_CRYPTO_AEAD_AES_CCM,
368 { /* AES GMAC (AUTH) */
369 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
371 .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
373 .algo = RTE_CRYPTO_AUTH_AES_GMAC,
394 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
396 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
398 .algo = RTE_CRYPTO_CIPHER_3DES_CBC,
414 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
416 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
418 .algo = RTE_CRYPTO_CIPHER_3DES_CTR,
434 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
436 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
438 .algo = RTE_CRYPTO_CIPHER_DES_CBC,
453 { /* DES DOCSIS BPI */
454 .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
456 .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
458 .algo = RTE_CRYPTO_CIPHER_DES_DOCSISBPI,
474 .op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
477 .xform_type = RTE_CRYPTO_ASYM_XFORM_RSA,
478 .op_types = ((1 << RTE_CRYPTO_ASYM_OP_SIGN) |
479 (1 << RTE_CRYPTO_ASYM_OP_VERIFY) |
480 (1 << RTE_CRYPTO_ASYM_OP_ENCRYPT) |
481 (1 << RTE_CRYPTO_ASYM_OP_DECRYPT)),
484 /* min length is based on openssl rsa keygen */
486 /* value 0 symbolizes no limit on max length */
495 .op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
498 .xform_type = RTE_CRYPTO_ASYM_XFORM_MODEX,
502 /* value 0 symbolizes no limit on min length */
504 /* value 0 symbolizes no limit on max length */
513 .op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
516 .xform_type = RTE_CRYPTO_ASYM_XFORM_MODINV,
520 /* value 0 symbolizes no limit on min length */
522 /* value 0 symbolizes no limit on max length */
531 .op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
534 .xform_type = RTE_CRYPTO_ASYM_XFORM_DH,
536 ((1<<RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE) |
537 (1 << RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE |
539 RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE))),
542 /* value 0 symbolizes no limit on min length */
544 /* value 0 symbolizes no limit on max length */
553 .op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,
556 .xform_type = RTE_CRYPTO_ASYM_XFORM_DSA,
558 ((1<<RTE_CRYPTO_ASYM_OP_SIGN) |
559 (1 << RTE_CRYPTO_ASYM_OP_VERIFY)),
562 /* value 0 symbolizes no limit on min length */
564 /* value 0 symbolizes no limit on max length */
573 RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
577 /** Configure device */
579 openssl_pmd_config(__rte_unused struct rte_cryptodev *dev,
580 __rte_unused struct rte_cryptodev_config *config)
587 openssl_pmd_start(__rte_unused struct rte_cryptodev *dev)
594 openssl_pmd_stop(__rte_unused struct rte_cryptodev *dev)
600 openssl_pmd_close(__rte_unused struct rte_cryptodev *dev)
606 /** Get device statistics */
608 openssl_pmd_stats_get(struct rte_cryptodev *dev,
609 struct rte_cryptodev_stats *stats)
613 for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
614 struct openssl_qp *qp = dev->data->queue_pairs[qp_id];
616 stats->enqueued_count += qp->stats.enqueued_count;
617 stats->dequeued_count += qp->stats.dequeued_count;
619 stats->enqueue_err_count += qp->stats.enqueue_err_count;
620 stats->dequeue_err_count += qp->stats.dequeue_err_count;
624 /** Reset device statistics */
626 openssl_pmd_stats_reset(struct rte_cryptodev *dev)
630 for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) {
631 struct openssl_qp *qp = dev->data->queue_pairs[qp_id];
633 memset(&qp->stats, 0, sizeof(qp->stats));
638 /** Get device info */
640 openssl_pmd_info_get(struct rte_cryptodev *dev,
641 struct rte_cryptodev_info *dev_info)
643 struct openssl_private *internals = dev->data->dev_private;
645 if (dev_info != NULL) {
646 dev_info->driver_id = dev->driver_id;
647 dev_info->feature_flags = dev->feature_flags;
648 dev_info->capabilities = openssl_pmd_capabilities;
649 dev_info->max_nb_queue_pairs = internals->max_nb_qpairs;
650 /* No limit of number of sessions */
651 dev_info->sym.max_nb_sessions = 0;
655 /** Release queue pair */
657 openssl_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
659 if (dev->data->queue_pairs[qp_id] != NULL) {
660 struct openssl_qp *qp = dev->data->queue_pairs[qp_id];
662 if (qp->processed_ops)
663 rte_ring_free(qp->processed_ops);
665 rte_free(dev->data->queue_pairs[qp_id]);
666 dev->data->queue_pairs[qp_id] = NULL;
671 /** set a unique name for the queue pair based on it's name, dev_id and qp_id */
673 openssl_pmd_qp_set_unique_name(struct rte_cryptodev *dev,
674 struct openssl_qp *qp)
676 unsigned int n = snprintf(qp->name, sizeof(qp->name),
677 "openssl_pmd_%u_qp_%u",
678 dev->data->dev_id, qp->id);
680 if (n >= sizeof(qp->name))
687 /** Create a ring to place processed operations on */
688 static struct rte_ring *
689 openssl_pmd_qp_create_processed_ops_ring(struct openssl_qp *qp,
690 unsigned int ring_size, int socket_id)
694 r = rte_ring_lookup(qp->name);
696 if (rte_ring_get_size(r) >= ring_size) {
698 "Reusing existing ring %s for processed ops",
704 "Unable to reuse existing ring %s for processed ops",
709 return rte_ring_create(qp->name, ring_size, socket_id,
710 RING_F_SP_ENQ | RING_F_SC_DEQ);
714 /** Setup a queue pair */
716 openssl_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
717 const struct rte_cryptodev_qp_conf *qp_conf,
720 struct openssl_qp *qp = NULL;
722 /* Free memory prior to re-allocation if needed. */
723 if (dev->data->queue_pairs[qp_id] != NULL)
724 openssl_pmd_qp_release(dev, qp_id);
726 /* Allocate the queue pair data structure. */
727 qp = rte_zmalloc_socket("OPENSSL PMD Queue Pair", sizeof(*qp),
728 RTE_CACHE_LINE_SIZE, socket_id);
733 dev->data->queue_pairs[qp_id] = qp;
735 if (openssl_pmd_qp_set_unique_name(dev, qp))
736 goto qp_setup_cleanup;
738 qp->processed_ops = openssl_pmd_qp_create_processed_ops_ring(qp,
739 qp_conf->nb_descriptors, socket_id);
740 if (qp->processed_ops == NULL)
741 goto qp_setup_cleanup;
743 qp->sess_mp = qp_conf->mp_session;
744 qp->sess_mp_priv = qp_conf->mp_session_private;
746 memset(&qp->stats, 0, sizeof(qp->stats));
757 /** Return the number of allocated queue pairs */
759 openssl_pmd_qp_count(struct rte_cryptodev *dev)
761 return dev->data->nb_queue_pairs;
764 /** Returns the size of the symmetric session structure */
766 openssl_pmd_sym_session_get_size(struct rte_cryptodev *dev __rte_unused)
768 return sizeof(struct openssl_session);
771 /** Returns the size of the asymmetric session structure */
773 openssl_pmd_asym_session_get_size(struct rte_cryptodev *dev __rte_unused)
775 return sizeof(struct openssl_asym_session);
778 /** Configure the session from a crypto xform chain */
780 openssl_pmd_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
781 struct rte_crypto_sym_xform *xform,
782 struct rte_cryptodev_sym_session *sess,
783 struct rte_mempool *mempool)
785 void *sess_private_data;
788 if (unlikely(sess == NULL)) {
789 OPENSSL_LOG(ERR, "invalid session struct");
793 if (rte_mempool_get(mempool, &sess_private_data)) {
795 "Couldn't get object from session mempool");
799 ret = openssl_set_session_parameters(sess_private_data, xform);
801 OPENSSL_LOG(ERR, "failed configure session parameters");
803 /* Return session to mempool */
804 rte_mempool_put(mempool, sess_private_data);
808 set_sym_session_private_data(sess, dev->driver_id,
814 static int openssl_set_asym_session_parameters(
815 struct openssl_asym_session *asym_session,
816 struct rte_crypto_asym_xform *xform)
820 if ((xform->xform_type != RTE_CRYPTO_ASYM_XFORM_DH) &&
821 (xform->next != NULL)) {
822 OPENSSL_LOG(ERR, "chained xfrms are not supported on %s",
823 rte_crypto_asym_xform_strings[xform->xform_type]);
827 switch (xform->xform_type) {
828 case RTE_CRYPTO_ASYM_XFORM_RSA:
833 BIGNUM *p = NULL, *q = NULL, *dmp1 = NULL;
834 BIGNUM *iqmp = NULL, *dmq1 = NULL;
836 /* copy xfrm data into rsa struct */
837 n = BN_bin2bn((const unsigned char *)xform->rsa.n.data,
838 xform->rsa.n.length, n);
839 e = BN_bin2bn((const unsigned char *)xform->rsa.e.data,
840 xform->rsa.e.length, e);
845 RSA *rsa = RSA_new();
849 if (xform->rsa.key_type == RTE_RSA_KEY_TYPE_EXP) {
851 (const unsigned char *)xform->rsa.d.data,
859 p = BN_bin2bn((const unsigned char *)
860 xform->rsa.qt.p.data,
861 xform->rsa.qt.p.length,
863 q = BN_bin2bn((const unsigned char *)
864 xform->rsa.qt.q.data,
865 xform->rsa.qt.q.length,
867 dmp1 = BN_bin2bn((const unsigned char *)
868 xform->rsa.qt.dP.data,
869 xform->rsa.qt.dP.length,
871 dmq1 = BN_bin2bn((const unsigned char *)
872 xform->rsa.qt.dQ.data,
873 xform->rsa.qt.dQ.length,
875 iqmp = BN_bin2bn((const unsigned char *)
876 xform->rsa.qt.qInv.data,
877 xform->rsa.qt.qInv.length,
880 if (!p || !q || !dmp1 || !dmq1 || !iqmp) {
884 ret = set_rsa_params(rsa, p, q);
887 "failed to set rsa params\n");
891 ret = set_rsa_crt_params(rsa, dmp1, dmq1, iqmp);
894 "failed to set crt params\n");
897 * set already populated params to NULL
898 * as its freed by call to RSA_free
905 ret = set_rsa_keys(rsa, n, e, d);
907 OPENSSL_LOG(ERR, "Failed to load rsa keys\n");
911 asym_session->u.r.rsa = rsa;
912 asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_RSA;
926 case RTE_CRYPTO_ASYM_XFORM_MODEX:
928 struct rte_crypto_modex_xform *xfrm = &(xform->modex);
930 BN_CTX *ctx = BN_CTX_new();
933 " failed to allocate resources\n");
937 BIGNUM *mod = BN_CTX_get(ctx);
938 BIGNUM *exp = BN_CTX_get(ctx);
939 if (mod == NULL || exp == NULL) {
945 mod = BN_bin2bn((const unsigned char *)
947 xfrm->modulus.length, mod);
948 exp = BN_bin2bn((const unsigned char *)
950 xfrm->exponent.length, exp);
951 asym_session->u.e.ctx = ctx;
952 asym_session->u.e.mod = mod;
953 asym_session->u.e.exp = exp;
954 asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_MODEX;
957 case RTE_CRYPTO_ASYM_XFORM_MODINV:
959 struct rte_crypto_modinv_xform *xfrm = &(xform->modinv);
961 BN_CTX *ctx = BN_CTX_new();
964 " failed to allocate resources\n");
968 BIGNUM *mod = BN_CTX_get(ctx);
975 mod = BN_bin2bn((const unsigned char *)
977 xfrm->modulus.length,
979 asym_session->u.m.ctx = ctx;
980 asym_session->u.m.modulus = mod;
981 asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_MODINV;
984 case RTE_CRYPTO_ASYM_XFORM_DH:
989 p = BN_bin2bn((const unsigned char *)
993 g = BN_bin2bn((const unsigned char *)
1003 "failed to allocate resources\n");
1006 ret = set_dh_params(dh, p, g);
1014 * public key generate, or
1015 * DH Priv key generate, or both
1016 * public and private key generate
1018 asym_session->u.dh.key_op = (1 << xform->dh.type);
1020 if (xform->dh.type ==
1021 RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE) {
1022 /* check if next is pubkey */
1023 if ((xform->next != NULL) &&
1024 (xform->next->xform_type ==
1025 RTE_CRYPTO_ASYM_XFORM_DH) &&
1026 (xform->next->dh.type ==
1027 RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE)
1030 * setup op as pub/priv key
1033 asym_session->u.dh.key_op |=
1035 RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE);
1038 asym_session->u.dh.dh_key = dh;
1039 asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_DH;
1043 OPENSSL_LOG(ERR, " failed to set dh params\n");
1048 case RTE_CRYPTO_ASYM_XFORM_DSA:
1050 BIGNUM *p = NULL, *g = NULL;
1051 BIGNUM *q = NULL, *priv_key = NULL;
1052 BIGNUM *pub_key = BN_new();
1055 p = BN_bin2bn((const unsigned char *)
1057 xform->dsa.p.length,
1060 g = BN_bin2bn((const unsigned char *)
1062 xform->dsa.g.length,
1065 q = BN_bin2bn((const unsigned char *)
1067 xform->dsa.q.length,
1072 priv_key = BN_bin2bn((const unsigned char *)
1074 xform->dsa.x.length,
1076 if (priv_key == NULL)
1079 DSA *dsa = DSA_new();
1082 " failed to allocate resources\n");
1086 ret = set_dsa_params(dsa, p, q, g);
1089 OPENSSL_LOG(ERR, "Failed to dsa params\n");
1094 * openssl 1.1.0 mandate that public key can't be
1095 * NULL in very first call. so set a dummy pub key.
1096 * to keep consistency, lets follow same approach for
1099 /* just set dummy public for very 1st call */
1100 ret = set_dsa_keys(dsa, pub_key, priv_key);
1103 OPENSSL_LOG(ERR, "Failed to set keys\n");
1106 asym_session->u.s.dsa = dsa;
1107 asym_session->xfrm_type = RTE_CRYPTO_ASYM_XFORM_DSA;
1125 /** Configure the session from a crypto xform chain */
1127 openssl_pmd_asym_session_configure(struct rte_cryptodev *dev __rte_unused,
1128 struct rte_crypto_asym_xform *xform,
1129 struct rte_cryptodev_asym_session *sess,
1130 struct rte_mempool *mempool)
1132 void *asym_sess_private_data;
1135 if (unlikely(sess == NULL)) {
1136 OPENSSL_LOG(ERR, "invalid asymmetric session struct");
1140 if (rte_mempool_get(mempool, &asym_sess_private_data)) {
1142 "Couldn't get object from session mempool");
1146 ret = openssl_set_asym_session_parameters(asym_sess_private_data,
1149 OPENSSL_LOG(ERR, "failed configure session parameters");
1151 /* Return session to mempool */
1152 rte_mempool_put(mempool, asym_sess_private_data);
1156 set_asym_session_private_data(sess, dev->driver_id,
1157 asym_sess_private_data);
1162 /** Clear the memory of session so it doesn't leave key material behind */
1164 openssl_pmd_sym_session_clear(struct rte_cryptodev *dev,
1165 struct rte_cryptodev_sym_session *sess)
1167 uint8_t index = dev->driver_id;
1168 void *sess_priv = get_sym_session_private_data(sess, index);
1170 /* Zero out the whole structure */
1172 openssl_reset_session(sess_priv);
1173 memset(sess_priv, 0, sizeof(struct openssl_session));
1174 struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
1175 set_sym_session_private_data(sess, index, NULL);
1176 rte_mempool_put(sess_mp, sess_priv);
1180 static void openssl_reset_asym_session(struct openssl_asym_session *sess)
1182 switch (sess->xfrm_type) {
1183 case RTE_CRYPTO_ASYM_XFORM_RSA:
1185 RSA_free(sess->u.r.rsa);
1187 case RTE_CRYPTO_ASYM_XFORM_MODEX:
1188 if (sess->u.e.ctx) {
1189 BN_CTX_end(sess->u.e.ctx);
1190 BN_CTX_free(sess->u.e.ctx);
1193 case RTE_CRYPTO_ASYM_XFORM_MODINV:
1194 if (sess->u.m.ctx) {
1195 BN_CTX_end(sess->u.m.ctx);
1196 BN_CTX_free(sess->u.m.ctx);
1199 case RTE_CRYPTO_ASYM_XFORM_DH:
1200 if (sess->u.dh.dh_key)
1201 DH_free(sess->u.dh.dh_key);
1203 case RTE_CRYPTO_ASYM_XFORM_DSA:
1205 DSA_free(sess->u.s.dsa);
1212 /** Clear the memory of asymmetric session
1213 * so it doesn't leave key material behind
1216 openssl_pmd_asym_session_clear(struct rte_cryptodev *dev,
1217 struct rte_cryptodev_asym_session *sess)
1219 uint8_t index = dev->driver_id;
1220 void *sess_priv = get_asym_session_private_data(sess, index);
1222 /* Zero out the whole structure */
1224 openssl_reset_asym_session(sess_priv);
1225 memset(sess_priv, 0, sizeof(struct openssl_asym_session));
1226 struct rte_mempool *sess_mp = rte_mempool_from_obj(sess_priv);
1227 set_asym_session_private_data(sess, index, NULL);
1228 rte_mempool_put(sess_mp, sess_priv);
1232 struct rte_cryptodev_ops openssl_pmd_ops = {
1233 .dev_configure = openssl_pmd_config,
1234 .dev_start = openssl_pmd_start,
1235 .dev_stop = openssl_pmd_stop,
1236 .dev_close = openssl_pmd_close,
1238 .stats_get = openssl_pmd_stats_get,
1239 .stats_reset = openssl_pmd_stats_reset,
1241 .dev_infos_get = openssl_pmd_info_get,
1243 .queue_pair_setup = openssl_pmd_qp_setup,
1244 .queue_pair_release = openssl_pmd_qp_release,
1245 .queue_pair_count = openssl_pmd_qp_count,
1247 .sym_session_get_size = openssl_pmd_sym_session_get_size,
1248 .asym_session_get_size = openssl_pmd_asym_session_get_size,
1249 .sym_session_configure = openssl_pmd_sym_session_configure,
1250 .asym_session_configure = openssl_pmd_asym_session_configure,
1251 .sym_session_clear = openssl_pmd_sym_session_clear,
1252 .asym_session_clear = openssl_pmd_asym_session_clear
1255 struct rte_cryptodev_ops *rte_openssl_pmd_ops = &openssl_pmd_ops;