4 * Copyright(c) 2016-2017 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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
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.
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.
33 #include <rte_common.h>
34 #include <rte_hexdump.h>
35 #include <rte_cryptodev.h>
36 #include <rte_cryptodev_pmd.h>
37 #include <rte_cryptodev_vdev.h>
39 #include <rte_malloc.h>
40 #include <rte_cpuflags.h>
42 #include <openssl/hmac.h>
43 #include <openssl/evp.h>
45 #include "rte_openssl_pmd_private.h"
47 #define DES_BLOCK_SIZE 8
49 static uint8_t cryptodev_driver_id;
51 #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
52 static HMAC_CTX *HMAC_CTX_new(void)
54 HMAC_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
61 static void HMAC_CTX_free(HMAC_CTX *ctx)
64 HMAC_CTX_cleanup(ctx);
70 static int cryptodev_openssl_remove(struct rte_vdev_device *vdev);
72 /*----------------------------------------------------------------------------*/
75 * Increment counter by 1
76 * Counter is 64 bit array, big-endian
81 uint64_t *ctr64 = (uint64_t *)ctr;
83 *ctr64 = __builtin_bswap64(*ctr64);
85 *ctr64 = __builtin_bswap64(*ctr64);
89 *------------------------------------------------------------------------------
91 *------------------------------------------------------------------------------
94 /** Get xform chain order */
95 static enum openssl_chain_order
96 openssl_get_chain_order(const struct rte_crypto_sym_xform *xform)
98 enum openssl_chain_order res = OPENSSL_CHAIN_NOT_SUPPORTED;
101 if (xform->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
102 if (xform->next == NULL)
103 res = OPENSSL_CHAIN_ONLY_AUTH;
104 else if (xform->next->type ==
105 RTE_CRYPTO_SYM_XFORM_CIPHER)
106 res = OPENSSL_CHAIN_AUTH_CIPHER;
108 if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) {
109 if (xform->next == NULL)
110 res = OPENSSL_CHAIN_ONLY_CIPHER;
111 else if (xform->next->type == RTE_CRYPTO_SYM_XFORM_AUTH)
112 res = OPENSSL_CHAIN_CIPHER_AUTH;
114 if (xform->type == RTE_CRYPTO_SYM_XFORM_AEAD)
115 res = OPENSSL_CHAIN_COMBINED;
121 /** Get session cipher key from input cipher key */
123 get_cipher_key(uint8_t *input_key, int keylen, uint8_t *session_key)
125 memcpy(session_key, input_key, keylen);
128 /** Get key ede 24 bytes standard from input key */
130 get_cipher_key_ede(uint8_t *key, int keylen, uint8_t *key_ede)
134 /* Initialize keys - 24 bytes: [key1-key2-key3] */
137 memcpy(key_ede, key, 24);
141 memcpy(key_ede, key, 16);
142 memcpy(key_ede + 16, key, 8);
145 /* K1 = K2 = K3 (DES compatibility) */
146 memcpy(key_ede, key, 8);
147 memcpy(key_ede + 8, key, 8);
148 memcpy(key_ede + 16, key, 8);
151 OPENSSL_LOG_ERR("Unsupported key size");
158 /** Get adequate openssl function for input cipher algorithm */
160 get_cipher_algo(enum rte_crypto_cipher_algorithm sess_algo, size_t keylen,
161 const EVP_CIPHER **algo)
167 case RTE_CRYPTO_CIPHER_3DES_CBC:
170 *algo = EVP_des_ede_cbc();
173 *algo = EVP_des_ede3_cbc();
179 case RTE_CRYPTO_CIPHER_3DES_CTR:
181 case RTE_CRYPTO_CIPHER_AES_CBC:
184 *algo = EVP_aes_128_cbc();
187 *algo = EVP_aes_192_cbc();
190 *algo = EVP_aes_256_cbc();
196 case RTE_CRYPTO_CIPHER_AES_CTR:
199 *algo = EVP_aes_128_ctr();
202 *algo = EVP_aes_192_ctr();
205 *algo = EVP_aes_256_ctr();
222 /** Get adequate openssl function for input auth algorithm */
224 get_auth_algo(enum rte_crypto_auth_algorithm sessalgo,
231 case RTE_CRYPTO_AUTH_MD5:
232 case RTE_CRYPTO_AUTH_MD5_HMAC:
235 case RTE_CRYPTO_AUTH_SHA1:
236 case RTE_CRYPTO_AUTH_SHA1_HMAC:
239 case RTE_CRYPTO_AUTH_SHA224:
240 case RTE_CRYPTO_AUTH_SHA224_HMAC:
241 *algo = EVP_sha224();
243 case RTE_CRYPTO_AUTH_SHA256:
244 case RTE_CRYPTO_AUTH_SHA256_HMAC:
245 *algo = EVP_sha256();
247 case RTE_CRYPTO_AUTH_SHA384:
248 case RTE_CRYPTO_AUTH_SHA384_HMAC:
249 *algo = EVP_sha384();
251 case RTE_CRYPTO_AUTH_SHA512:
252 case RTE_CRYPTO_AUTH_SHA512_HMAC:
253 *algo = EVP_sha512();
266 /** Get adequate openssl function for input cipher algorithm */
268 get_aead_algo(enum rte_crypto_aead_algorithm sess_algo, size_t keylen,
269 const EVP_CIPHER **algo)
275 case RTE_CRYPTO_AEAD_AES_GCM:
278 *algo = EVP_aes_128_gcm();
281 *algo = EVP_aes_192_gcm();
284 *algo = EVP_aes_256_gcm();
301 /* Set session AEAD encryption parameters */
303 openssl_set_sess_aead_enc_param(struct openssl_session *sess,
304 enum rte_crypto_aead_algorithm algo,
305 uint8_t tag_len, uint8_t *key)
309 sess->cipher.direction = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
310 sess->auth.operation = RTE_CRYPTO_AUTH_OP_GENERATE;
312 /* Select AEAD algo */
314 case RTE_CRYPTO_AEAD_AES_GCM:
315 iv_type = EVP_CTRL_GCM_SET_IVLEN;
323 sess->cipher.mode = OPENSSL_CIPHER_LIB;
324 sess->cipher.ctx = EVP_CIPHER_CTX_new();
326 if (get_aead_algo(algo, sess->cipher.key.length,
327 &sess->cipher.evp_algo) != 0)
330 get_cipher_key(key, sess->cipher.key.length, sess->cipher.key.data);
332 sess->chain_order = OPENSSL_CHAIN_COMBINED;
334 if (EVP_EncryptInit_ex(sess->cipher.ctx, sess->cipher.evp_algo,
335 NULL, NULL, NULL) <= 0)
338 if (EVP_CIPHER_CTX_ctrl(sess->cipher.ctx, iv_type, sess->iv.length,
342 if (EVP_EncryptInit_ex(sess->cipher.ctx, NULL, NULL, key, NULL) <= 0)
348 /* Set session AEAD decryption parameters */
350 openssl_set_sess_aead_dec_param(struct openssl_session *sess,
351 enum rte_crypto_aead_algorithm algo,
352 uint8_t tag_len, uint8_t *key)
356 sess->cipher.direction = RTE_CRYPTO_CIPHER_OP_DECRYPT;
357 sess->auth.operation = RTE_CRYPTO_AUTH_OP_VERIFY;
359 /* Select AEAD algo */
361 case RTE_CRYPTO_AEAD_AES_GCM:
362 iv_type = EVP_CTRL_GCM_SET_IVLEN;
370 sess->cipher.mode = OPENSSL_CIPHER_LIB;
371 sess->cipher.ctx = EVP_CIPHER_CTX_new();
373 if (get_aead_algo(algo, sess->cipher.key.length,
374 &sess->cipher.evp_algo) != 0)
377 get_cipher_key(key, sess->cipher.key.length, sess->cipher.key.data);
379 sess->chain_order = OPENSSL_CHAIN_COMBINED;
381 if (EVP_DecryptInit_ex(sess->cipher.ctx, sess->cipher.evp_algo,
382 NULL, NULL, NULL) <= 0)
385 if (EVP_CIPHER_CTX_ctrl(sess->cipher.ctx, iv_type,
386 sess->iv.length, NULL) <= 0)
389 if (EVP_DecryptInit_ex(sess->cipher.ctx, NULL, NULL, key, NULL) <= 0)
395 /** Set session cipher parameters */
397 openssl_set_session_cipher_parameters(struct openssl_session *sess,
398 const struct rte_crypto_sym_xform *xform)
400 /* Select cipher direction */
401 sess->cipher.direction = xform->cipher.op;
402 /* Select cipher key */
403 sess->cipher.key.length = xform->cipher.key.length;
405 /* Set IV parameters */
406 sess->iv.offset = xform->cipher.iv.offset;
407 sess->iv.length = xform->cipher.iv.length;
409 /* Select cipher algo */
410 switch (xform->cipher.algo) {
411 case RTE_CRYPTO_CIPHER_3DES_CBC:
412 case RTE_CRYPTO_CIPHER_AES_CBC:
413 case RTE_CRYPTO_CIPHER_AES_CTR:
414 sess->cipher.mode = OPENSSL_CIPHER_LIB;
415 sess->cipher.algo = xform->cipher.algo;
416 sess->cipher.ctx = EVP_CIPHER_CTX_new();
418 if (get_cipher_algo(sess->cipher.algo, sess->cipher.key.length,
419 &sess->cipher.evp_algo) != 0)
422 get_cipher_key(xform->cipher.key.data, sess->cipher.key.length,
423 sess->cipher.key.data);
424 if (sess->cipher.direction == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
425 if (EVP_EncryptInit_ex(sess->cipher.ctx,
426 sess->cipher.evp_algo,
427 NULL, xform->cipher.key.data,
431 } else if (sess->cipher.direction ==
432 RTE_CRYPTO_CIPHER_OP_DECRYPT) {
433 if (EVP_DecryptInit_ex(sess->cipher.ctx,
434 sess->cipher.evp_algo,
435 NULL, xform->cipher.key.data,
443 case RTE_CRYPTO_CIPHER_3DES_CTR:
444 sess->cipher.mode = OPENSSL_CIPHER_DES3CTR;
445 sess->cipher.ctx = EVP_CIPHER_CTX_new();
447 if (get_cipher_key_ede(xform->cipher.key.data,
448 sess->cipher.key.length,
449 sess->cipher.key.data) != 0)
453 case RTE_CRYPTO_CIPHER_DES_CBC:
454 sess->cipher.algo = xform->cipher.algo;
455 sess->cipher.ctx = EVP_CIPHER_CTX_new();
456 sess->cipher.evp_algo = EVP_des_cbc();
458 get_cipher_key(xform->cipher.key.data, sess->cipher.key.length,
459 sess->cipher.key.data);
460 if (sess->cipher.direction == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
461 if (EVP_EncryptInit_ex(sess->cipher.ctx,
462 sess->cipher.evp_algo,
463 NULL, xform->cipher.key.data,
467 } else if (sess->cipher.direction ==
468 RTE_CRYPTO_CIPHER_OP_DECRYPT) {
469 if (EVP_DecryptInit_ex(sess->cipher.ctx,
470 sess->cipher.evp_algo,
471 NULL, xform->cipher.key.data,
479 case RTE_CRYPTO_CIPHER_DES_DOCSISBPI:
480 sess->cipher.algo = xform->cipher.algo;
481 sess->chain_order = OPENSSL_CHAIN_CIPHER_BPI;
482 sess->cipher.ctx = EVP_CIPHER_CTX_new();
483 sess->cipher.evp_algo = EVP_des_cbc();
485 sess->cipher.bpi_ctx = EVP_CIPHER_CTX_new();
486 /* IV will be ECB encrypted whether direction is encrypt or decrypt */
487 if (EVP_EncryptInit_ex(sess->cipher.bpi_ctx, EVP_des_ecb(),
488 NULL, xform->cipher.key.data, 0) != 1)
491 get_cipher_key(xform->cipher.key.data, sess->cipher.key.length,
492 sess->cipher.key.data);
493 if (sess->cipher.direction == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
494 if (EVP_EncryptInit_ex(sess->cipher.ctx,
495 sess->cipher.evp_algo,
496 NULL, xform->cipher.key.data,
500 } else if (sess->cipher.direction ==
501 RTE_CRYPTO_CIPHER_OP_DECRYPT) {
502 if (EVP_DecryptInit_ex(sess->cipher.ctx,
503 sess->cipher.evp_algo,
504 NULL, xform->cipher.key.data,
512 sess->cipher.algo = RTE_CRYPTO_CIPHER_NULL;
519 /* Set session auth parameters */
521 openssl_set_session_auth_parameters(struct openssl_session *sess,
522 const struct rte_crypto_sym_xform *xform)
524 /* Select auth generate/verify */
525 sess->auth.operation = xform->auth.op;
526 sess->auth.algo = xform->auth.algo;
528 sess->auth.digest_length = xform->auth.digest_length;
530 /* Select auth algo */
531 switch (xform->auth.algo) {
532 case RTE_CRYPTO_AUTH_AES_GMAC:
534 * OpenSSL requires GMAC to be a GCM operation
535 * with no cipher data length
537 sess->cipher.key.length = xform->auth.key.length;
539 /* Set IV parameters */
540 sess->iv.offset = xform->auth.iv.offset;
541 sess->iv.length = xform->auth.iv.length;
543 if (sess->auth.operation == RTE_CRYPTO_AUTH_OP_GENERATE)
544 return openssl_set_sess_aead_enc_param(sess,
545 RTE_CRYPTO_AEAD_AES_GCM,
546 xform->auth.digest_length,
547 xform->auth.key.data);
549 return openssl_set_sess_aead_dec_param(sess,
550 RTE_CRYPTO_AEAD_AES_GCM,
551 xform->auth.digest_length,
552 xform->auth.key.data);
555 case RTE_CRYPTO_AUTH_MD5:
556 case RTE_CRYPTO_AUTH_SHA1:
557 case RTE_CRYPTO_AUTH_SHA224:
558 case RTE_CRYPTO_AUTH_SHA256:
559 case RTE_CRYPTO_AUTH_SHA384:
560 case RTE_CRYPTO_AUTH_SHA512:
561 sess->auth.mode = OPENSSL_AUTH_AS_AUTH;
562 if (get_auth_algo(xform->auth.algo,
563 &sess->auth.auth.evp_algo) != 0)
565 sess->auth.auth.ctx = EVP_MD_CTX_create();
568 case RTE_CRYPTO_AUTH_MD5_HMAC:
569 case RTE_CRYPTO_AUTH_SHA1_HMAC:
570 case RTE_CRYPTO_AUTH_SHA224_HMAC:
571 case RTE_CRYPTO_AUTH_SHA256_HMAC:
572 case RTE_CRYPTO_AUTH_SHA384_HMAC:
573 case RTE_CRYPTO_AUTH_SHA512_HMAC:
574 sess->auth.mode = OPENSSL_AUTH_AS_HMAC;
575 sess->auth.hmac.ctx = HMAC_CTX_new();
576 if (get_auth_algo(xform->auth.algo,
577 &sess->auth.hmac.evp_algo) != 0)
580 if (HMAC_Init_ex(sess->auth.hmac.ctx,
581 xform->auth.key.data,
582 xform->auth.key.length,
583 sess->auth.hmac.evp_algo, NULL) != 1)
594 /* Set session AEAD parameters */
596 openssl_set_session_aead_parameters(struct openssl_session *sess,
597 const struct rte_crypto_sym_xform *xform)
599 /* Select cipher key */
600 sess->cipher.key.length = xform->aead.key.length;
602 /* Set IV parameters */
603 sess->iv.offset = xform->aead.iv.offset;
604 sess->iv.length = xform->aead.iv.length;
606 sess->auth.aad_length = xform->aead.aad_length;
607 sess->auth.digest_length = xform->aead.digest_length;
609 sess->aead_algo = xform->aead.algo;
610 /* Select cipher direction */
611 if (xform->aead.op == RTE_CRYPTO_AEAD_OP_ENCRYPT)
612 return openssl_set_sess_aead_enc_param(sess, xform->aead.algo,
613 xform->aead.digest_length, xform->aead.key.data);
615 return openssl_set_sess_aead_dec_param(sess, xform->aead.algo,
616 xform->aead.digest_length, xform->aead.key.data);
619 /** Parse crypto xform chain and set private session parameters */
621 openssl_set_session_parameters(struct openssl_session *sess,
622 const struct rte_crypto_sym_xform *xform)
624 const struct rte_crypto_sym_xform *cipher_xform = NULL;
625 const struct rte_crypto_sym_xform *auth_xform = NULL;
626 const struct rte_crypto_sym_xform *aead_xform = NULL;
629 sess->chain_order = openssl_get_chain_order(xform);
630 switch (sess->chain_order) {
631 case OPENSSL_CHAIN_ONLY_CIPHER:
632 cipher_xform = xform;
634 case OPENSSL_CHAIN_ONLY_AUTH:
637 case OPENSSL_CHAIN_CIPHER_AUTH:
638 cipher_xform = xform;
639 auth_xform = xform->next;
641 case OPENSSL_CHAIN_AUTH_CIPHER:
643 cipher_xform = xform->next;
645 case OPENSSL_CHAIN_COMBINED:
652 /* Default IV length = 0 */
655 /* cipher_xform must be check before auth_xform */
657 ret = openssl_set_session_cipher_parameters(
661 "Invalid/unsupported cipher parameters");
667 ret = openssl_set_session_auth_parameters(sess, auth_xform);
670 "Invalid/unsupported auth parameters");
676 ret = openssl_set_session_aead_parameters(sess, aead_xform);
679 "Invalid/unsupported AEAD parameters");
687 /** Reset private session parameters */
689 openssl_reset_session(struct openssl_session *sess)
691 EVP_CIPHER_CTX_free(sess->cipher.ctx);
693 if (sess->chain_order == OPENSSL_CHAIN_CIPHER_BPI)
694 EVP_CIPHER_CTX_free(sess->cipher.bpi_ctx);
696 switch (sess->auth.mode) {
697 case OPENSSL_AUTH_AS_AUTH:
698 EVP_MD_CTX_destroy(sess->auth.auth.ctx);
700 case OPENSSL_AUTH_AS_HMAC:
701 EVP_PKEY_free(sess->auth.hmac.pkey);
702 HMAC_CTX_free(sess->auth.hmac.ctx);
709 /** Provide session for operation */
710 static struct openssl_session *
711 get_session(struct openssl_qp *qp, struct rte_crypto_op *op)
713 struct openssl_session *sess = NULL;
715 if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
716 /* get existing session */
717 if (likely(op->sym->session != NULL))
718 sess = (struct openssl_session *)
719 get_session_private_data(
721 cryptodev_driver_id);
723 /* provide internal session */
725 void *_sess_private_data = NULL;
727 if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
730 if (rte_mempool_get(qp->sess_mp, (void **)&_sess_private_data))
733 sess = (struct openssl_session *)_sess_private_data;
735 if (unlikely(openssl_set_session_parameters(sess,
736 op->sym->xform) != 0)) {
737 rte_mempool_put(qp->sess_mp, _sess);
738 rte_mempool_put(qp->sess_mp, _sess_private_data);
741 op->sym->session = (struct rte_cryptodev_sym_session *)_sess;
742 set_session_private_data(op->sym->session, cryptodev_driver_id,
747 op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION;
753 *------------------------------------------------------------------------------
755 *------------------------------------------------------------------------------
758 process_openssl_encryption_update(struct rte_mbuf *mbuf_src, int offset,
759 uint8_t **dst, int srclen, EVP_CIPHER_CTX *ctx)
766 for (m = mbuf_src; m != NULL && offset > rte_pktmbuf_data_len(m);
768 offset -= rte_pktmbuf_data_len(m);
773 src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset);
775 l = rte_pktmbuf_data_len(m) - offset;
777 if (EVP_EncryptUpdate(ctx, *dst, &dstlen, src, srclen) <= 0)
783 if (EVP_EncryptUpdate(ctx, *dst, &dstlen, src, l) <= 0)
789 for (m = m->next; (m != NULL) && (n > 0); m = m->next) {
790 src = rte_pktmbuf_mtod(m, uint8_t *);
791 l = rte_pktmbuf_data_len(m) < n ? rte_pktmbuf_data_len(m) : n;
792 if (EVP_EncryptUpdate(ctx, *dst, &dstlen, src, l) <= 0)
802 process_openssl_decryption_update(struct rte_mbuf *mbuf_src, int offset,
803 uint8_t **dst, int srclen, EVP_CIPHER_CTX *ctx)
810 for (m = mbuf_src; m != NULL && offset > rte_pktmbuf_data_len(m);
812 offset -= rte_pktmbuf_data_len(m);
817 src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset);
819 l = rte_pktmbuf_data_len(m) - offset;
821 if (EVP_DecryptUpdate(ctx, *dst, &dstlen, src, srclen) <= 0)
827 if (EVP_DecryptUpdate(ctx, *dst, &dstlen, src, l) <= 0)
833 for (m = m->next; (m != NULL) && (n > 0); m = m->next) {
834 src = rte_pktmbuf_mtod(m, uint8_t *);
835 l = rte_pktmbuf_data_len(m) < n ? rte_pktmbuf_data_len(m) : n;
836 if (EVP_DecryptUpdate(ctx, *dst, &dstlen, src, l) <= 0)
845 /** Process standard openssl cipher encryption */
847 process_openssl_cipher_encrypt(struct rte_mbuf *mbuf_src, uint8_t *dst,
848 int offset, uint8_t *iv, int srclen, EVP_CIPHER_CTX *ctx)
852 if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
853 goto process_cipher_encrypt_err;
855 EVP_CIPHER_CTX_set_padding(ctx, 0);
857 if (process_openssl_encryption_update(mbuf_src, offset, &dst,
859 goto process_cipher_encrypt_err;
861 if (EVP_EncryptFinal_ex(ctx, dst, &totlen) <= 0)
862 goto process_cipher_encrypt_err;
866 process_cipher_encrypt_err:
867 OPENSSL_LOG_ERR("Process openssl cipher encrypt failed");
871 /** Process standard openssl cipher encryption */
873 process_openssl_cipher_bpi_encrypt(uint8_t *src, uint8_t *dst,
874 uint8_t *iv, int srclen,
878 uint8_t encrypted_iv[DES_BLOCK_SIZE];
881 if (EVP_EncryptUpdate(ctx, encrypted_iv, &encrypted_ivlen,
882 iv, DES_BLOCK_SIZE) <= 0)
883 goto process_cipher_encrypt_err;
885 for (i = 0; i < srclen; i++)
886 *(dst + i) = *(src + i) ^ (encrypted_iv[i]);
890 process_cipher_encrypt_err:
891 OPENSSL_LOG_ERR("Process openssl cipher bpi encrypt failed");
894 /** Process standard openssl cipher decryption */
896 process_openssl_cipher_decrypt(struct rte_mbuf *mbuf_src, uint8_t *dst,
897 int offset, uint8_t *iv, int srclen, EVP_CIPHER_CTX *ctx)
901 if (EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
902 goto process_cipher_decrypt_err;
904 EVP_CIPHER_CTX_set_padding(ctx, 0);
906 if (process_openssl_decryption_update(mbuf_src, offset, &dst,
908 goto process_cipher_decrypt_err;
910 if (EVP_DecryptFinal_ex(ctx, dst, &totlen) <= 0)
911 goto process_cipher_decrypt_err;
914 process_cipher_decrypt_err:
915 OPENSSL_LOG_ERR("Process openssl cipher decrypt failed");
919 /** Process cipher des 3 ctr encryption, decryption algorithm */
921 process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst,
922 int offset, uint8_t *iv, uint8_t *key, int srclen,
925 uint8_t ebuf[8], ctr[8];
931 for (m = mbuf_src; m != NULL && offset > rte_pktmbuf_data_len(m);
933 offset -= rte_pktmbuf_data_len(m);
936 goto process_cipher_des3ctr_err;
938 src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset);
939 l = rte_pktmbuf_data_len(m) - offset;
941 /* We use 3DES encryption also for decryption.
942 * IV is not important for 3DES ecb
944 if (EVP_EncryptInit_ex(ctx, EVP_des_ede3_ecb(), NULL, key, NULL) <= 0)
945 goto process_cipher_des3ctr_err;
949 for (n = 0; n < srclen; n++) {
951 if (EVP_EncryptUpdate(ctx,
952 (unsigned char *)&ebuf, &unused,
953 (const unsigned char *)&ctr, 8) <= 0)
954 goto process_cipher_des3ctr_err;
957 dst[n] = *(src++) ^ ebuf[n % 8];
963 src = rte_pktmbuf_mtod(m, uint8_t *);
964 l = rte_pktmbuf_data_len(m);
971 process_cipher_des3ctr_err:
972 OPENSSL_LOG_ERR("Process openssl cipher des 3 ede ctr failed");
976 /** Process auth/encription aes-gcm algorithm */
978 process_openssl_auth_encryption_gcm(struct rte_mbuf *mbuf_src, int offset,
979 int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
980 uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
982 int len = 0, unused = 0;
983 uint8_t empty[] = {};
985 if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
986 goto process_auth_encryption_gcm_err;
989 if (EVP_EncryptUpdate(ctx, NULL, &len, aad, aadlen) <= 0)
990 goto process_auth_encryption_gcm_err;
993 if (process_openssl_encryption_update(mbuf_src, offset, &dst,
995 goto process_auth_encryption_gcm_err;
997 /* Workaround open ssl bug in version less then 1.0.1f */
998 if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
999 goto process_auth_encryption_gcm_err;
1001 if (EVP_EncryptFinal_ex(ctx, dst, &len) <= 0)
1002 goto process_auth_encryption_gcm_err;
1004 if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag) <= 0)
1005 goto process_auth_encryption_gcm_err;
1009 process_auth_encryption_gcm_err:
1010 OPENSSL_LOG_ERR("Process openssl auth encryption gcm failed");
1015 process_openssl_auth_decryption_gcm(struct rte_mbuf *mbuf_src, int offset,
1016 int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
1017 uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
1019 int len = 0, unused = 0;
1020 uint8_t empty[] = {};
1022 if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, 16, tag) <= 0)
1023 goto process_auth_decryption_gcm_err;
1025 if (EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
1026 goto process_auth_decryption_gcm_err;
1029 if (EVP_DecryptUpdate(ctx, NULL, &len, aad, aadlen) <= 0)
1030 goto process_auth_decryption_gcm_err;
1033 if (process_openssl_decryption_update(mbuf_src, offset, &dst,
1035 goto process_auth_decryption_gcm_err;
1037 /* Workaround open ssl bug in version less then 1.0.1f */
1038 if (EVP_DecryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
1039 goto process_auth_decryption_gcm_err;
1041 if (EVP_DecryptFinal_ex(ctx, dst, &len) <= 0)
1042 goto process_auth_decryption_gcm_final_err;
1046 process_auth_decryption_gcm_err:
1047 OPENSSL_LOG_ERR("Process openssl auth description gcm failed");
1050 process_auth_decryption_gcm_final_err:
1054 /** Process standard openssl auth algorithms */
1056 process_openssl_auth(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset,
1057 __rte_unused uint8_t *iv, __rte_unused EVP_PKEY * pkey,
1058 int srclen, EVP_MD_CTX *ctx, const EVP_MD *algo)
1065 for (m = mbuf_src; m != NULL && offset > rte_pktmbuf_data_len(m);
1067 offset -= rte_pktmbuf_data_len(m);
1070 goto process_auth_err;
1072 if (EVP_DigestInit_ex(ctx, algo, NULL) <= 0)
1073 goto process_auth_err;
1075 src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset);
1077 l = rte_pktmbuf_data_len(m) - offset;
1079 if (EVP_DigestUpdate(ctx, (char *)src, srclen) <= 0)
1080 goto process_auth_err;
1081 goto process_auth_final;
1084 if (EVP_DigestUpdate(ctx, (char *)src, l) <= 0)
1085 goto process_auth_err;
1089 for (m = m->next; (m != NULL) && (n > 0); m = m->next) {
1090 src = rte_pktmbuf_mtod(m, uint8_t *);
1091 l = rte_pktmbuf_data_len(m) < n ? rte_pktmbuf_data_len(m) : n;
1092 if (EVP_DigestUpdate(ctx, (char *)src, l) <= 0)
1093 goto process_auth_err;
1098 if (EVP_DigestFinal_ex(ctx, dst, (unsigned int *)&dstlen) <= 0)
1099 goto process_auth_err;
1103 OPENSSL_LOG_ERR("Process openssl auth failed");
1107 /** Process standard openssl auth algorithms with hmac */
1109 process_openssl_auth_hmac(struct rte_mbuf *mbuf_src, uint8_t *dst, int offset,
1110 int srclen, HMAC_CTX *ctx)
1112 unsigned int dstlen;
1117 for (m = mbuf_src; m != NULL && offset > rte_pktmbuf_data_len(m);
1119 offset -= rte_pktmbuf_data_len(m);
1122 goto process_auth_err;
1124 src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset);
1126 l = rte_pktmbuf_data_len(m) - offset;
1128 if (HMAC_Update(ctx, (unsigned char *)src, srclen) != 1)
1129 goto process_auth_err;
1130 goto process_auth_final;
1133 if (HMAC_Update(ctx, (unsigned char *)src, l) != 1)
1134 goto process_auth_err;
1138 for (m = m->next; (m != NULL) && (n > 0); m = m->next) {
1139 src = rte_pktmbuf_mtod(m, uint8_t *);
1140 l = rte_pktmbuf_data_len(m) < n ? rte_pktmbuf_data_len(m) : n;
1141 if (HMAC_Update(ctx, (unsigned char *)src, l) != 1)
1142 goto process_auth_err;
1147 if (HMAC_Final(ctx, dst, &dstlen) != 1)
1148 goto process_auth_err;
1150 if (unlikely(HMAC_Init_ex(ctx, NULL, 0, NULL, NULL) != 1))
1151 goto process_auth_err;
1156 OPENSSL_LOG_ERR("Process openssl auth failed");
1160 /*----------------------------------------------------------------------------*/
1162 /** Process auth/cipher combined operation */
1164 process_openssl_combined_op
1165 (struct rte_crypto_op *op, struct openssl_session *sess,
1166 struct rte_mbuf *mbuf_src, struct rte_mbuf *mbuf_dst)
1169 uint8_t *dst = NULL, *iv, *tag, *aad;
1170 int srclen, aadlen, status = -1;
1174 * Segmented destination buffer is not supported for
1175 * encryption/decryption
1177 if (!rte_pktmbuf_is_contiguous(mbuf_dst)) {
1178 op->status = RTE_CRYPTO_OP_STATUS_ERROR;
1182 iv = rte_crypto_op_ctod_offset(op, uint8_t *,
1184 if (sess->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC) {
1186 offset = op->sym->auth.data.offset;
1187 aadlen = op->sym->auth.data.length;
1188 aad = rte_pktmbuf_mtod_offset(mbuf_src, uint8_t *,
1189 op->sym->auth.data.offset);
1190 tag = op->sym->auth.digest.data;
1192 tag = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *,
1195 srclen = op->sym->aead.data.length;
1196 dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *,
1197 op->sym->aead.data.offset);
1198 offset = op->sym->aead.data.offset;
1199 aad = op->sym->aead.aad.data;
1200 aadlen = sess->auth.aad_length;
1201 tag = op->sym->aead.digest.data;
1203 tag = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *,
1207 if (sess->cipher.direction == RTE_CRYPTO_CIPHER_OP_ENCRYPT)
1208 status = process_openssl_auth_encryption_gcm(
1209 mbuf_src, offset, srclen,
1211 dst, tag, sess->cipher.ctx);
1213 status = process_openssl_auth_decryption_gcm(
1214 mbuf_src, offset, srclen,
1216 dst, tag, sess->cipher.ctx);
1219 if (status == (-EFAULT) &&
1220 sess->auth.operation ==
1221 RTE_CRYPTO_AUTH_OP_VERIFY)
1222 op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
1224 op->status = RTE_CRYPTO_OP_STATUS_ERROR;
1228 /** Process cipher operation */
1230 process_openssl_cipher_op
1231 (struct rte_crypto_op *op, struct openssl_session *sess,
1232 struct rte_mbuf *mbuf_src, struct rte_mbuf *mbuf_dst)
1238 * Segmented destination buffer is not supported for
1239 * encryption/decryption
1241 if (!rte_pktmbuf_is_contiguous(mbuf_dst)) {
1242 op->status = RTE_CRYPTO_OP_STATUS_ERROR;
1246 srclen = op->sym->cipher.data.length;
1247 dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *,
1248 op->sym->cipher.data.offset);
1250 iv = rte_crypto_op_ctod_offset(op, uint8_t *,
1253 if (sess->cipher.mode == OPENSSL_CIPHER_LIB)
1254 if (sess->cipher.direction == RTE_CRYPTO_CIPHER_OP_ENCRYPT)
1255 status = process_openssl_cipher_encrypt(mbuf_src, dst,
1256 op->sym->cipher.data.offset, iv,
1257 srclen, sess->cipher.ctx);
1259 status = process_openssl_cipher_decrypt(mbuf_src, dst,
1260 op->sym->cipher.data.offset, iv,
1261 srclen, sess->cipher.ctx);
1263 status = process_openssl_cipher_des3ctr(mbuf_src, dst,
1264 op->sym->cipher.data.offset, iv,
1265 sess->cipher.key.data, srclen,
1269 op->status = RTE_CRYPTO_OP_STATUS_ERROR;
1272 /** Process cipher operation */
1274 process_openssl_docsis_bpi_op(struct rte_crypto_op *op,
1275 struct openssl_session *sess, struct rte_mbuf *mbuf_src,
1276 struct rte_mbuf *mbuf_dst)
1278 uint8_t *src, *dst, *iv;
1279 uint8_t block_size, last_block_len;
1280 int srclen, status = 0;
1282 srclen = op->sym->cipher.data.length;
1283 src = rte_pktmbuf_mtod_offset(mbuf_src, uint8_t *,
1284 op->sym->cipher.data.offset);
1285 dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *,
1286 op->sym->cipher.data.offset);
1288 iv = rte_crypto_op_ctod_offset(op, uint8_t *,
1291 block_size = DES_BLOCK_SIZE;
1293 last_block_len = srclen % block_size;
1294 if (sess->cipher.direction == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {
1295 /* Encrypt only with ECB mode XOR IV */
1296 if (srclen < block_size) {
1297 status = process_openssl_cipher_bpi_encrypt(src, dst,
1299 sess->cipher.bpi_ctx);
1301 srclen -= last_block_len;
1302 /* Encrypt with the block aligned stream with CBC mode */
1303 status = process_openssl_cipher_encrypt(mbuf_src, dst,
1304 op->sym->cipher.data.offset, iv,
1305 srclen, sess->cipher.ctx);
1306 if (last_block_len) {
1307 /* Point at last block */
1310 * IV is the last encrypted block from
1311 * the previous operation
1313 iv = dst - block_size;
1315 srclen = last_block_len;
1316 /* Encrypt the last frame with ECB mode */
1317 status |= process_openssl_cipher_bpi_encrypt(src,
1319 srclen, sess->cipher.bpi_ctx);
1323 /* Decrypt only with ECB mode (encrypt, as it is same operation) */
1324 if (srclen < block_size) {
1325 status = process_openssl_cipher_bpi_encrypt(src, dst,
1328 sess->cipher.bpi_ctx);
1330 if (last_block_len) {
1331 /* Point at last block */
1332 dst += srclen - last_block_len;
1333 src += srclen - last_block_len;
1335 * IV is the last full block
1337 iv = src - block_size;
1339 * Decrypt the last frame with ECB mode
1340 * (encrypt, as it is the same operation)
1342 status = process_openssl_cipher_bpi_encrypt(src,
1344 last_block_len, sess->cipher.bpi_ctx);
1345 /* Prepare parameters for CBC mode op */
1346 iv = rte_crypto_op_ctod_offset(op, uint8_t *,
1348 dst += last_block_len - srclen;
1349 srclen -= last_block_len;
1352 /* Decrypt with CBC mode */
1353 status |= process_openssl_cipher_decrypt(mbuf_src, dst,
1354 op->sym->cipher.data.offset, iv,
1355 srclen, sess->cipher.ctx);
1360 op->status = RTE_CRYPTO_OP_STATUS_ERROR;
1363 /** Process auth operation */
1365 process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op,
1366 struct openssl_session *sess, struct rte_mbuf *mbuf_src,
1367 struct rte_mbuf *mbuf_dst)
1372 srclen = op->sym->auth.data.length;
1374 if (sess->auth.operation == RTE_CRYPTO_AUTH_OP_VERIFY)
1375 dst = qp->temp_digest;
1377 dst = op->sym->auth.digest.data;
1379 dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *,
1380 op->sym->auth.data.offset +
1381 op->sym->auth.data.length);
1384 switch (sess->auth.mode) {
1385 case OPENSSL_AUTH_AS_AUTH:
1386 status = process_openssl_auth(mbuf_src, dst,
1387 op->sym->auth.data.offset, NULL, NULL, srclen,
1388 sess->auth.auth.ctx, sess->auth.auth.evp_algo);
1390 case OPENSSL_AUTH_AS_HMAC:
1391 status = process_openssl_auth_hmac(mbuf_src, dst,
1392 op->sym->auth.data.offset, srclen,
1393 sess->auth.hmac.ctx);
1400 if (sess->auth.operation == RTE_CRYPTO_AUTH_OP_VERIFY) {
1401 if (memcmp(dst, op->sym->auth.digest.data,
1402 sess->auth.digest_length) != 0) {
1403 op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
1408 op->status = RTE_CRYPTO_OP_STATUS_ERROR;
1411 /** Process crypto operation for mbuf */
1413 process_op(struct openssl_qp *qp, struct rte_crypto_op *op,
1414 struct openssl_session *sess)
1416 struct rte_mbuf *msrc, *mdst;
1419 msrc = op->sym->m_src;
1420 mdst = op->sym->m_dst ? op->sym->m_dst : op->sym->m_src;
1422 op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
1424 switch (sess->chain_order) {
1425 case OPENSSL_CHAIN_ONLY_CIPHER:
1426 process_openssl_cipher_op(op, sess, msrc, mdst);
1428 case OPENSSL_CHAIN_ONLY_AUTH:
1429 process_openssl_auth_op(qp, op, sess, msrc, mdst);
1431 case OPENSSL_CHAIN_CIPHER_AUTH:
1432 process_openssl_cipher_op(op, sess, msrc, mdst);
1433 process_openssl_auth_op(qp, op, sess, mdst, mdst);
1435 case OPENSSL_CHAIN_AUTH_CIPHER:
1436 process_openssl_auth_op(qp, op, sess, msrc, mdst);
1437 process_openssl_cipher_op(op, sess, msrc, mdst);
1439 case OPENSSL_CHAIN_COMBINED:
1440 process_openssl_combined_op(op, sess, msrc, mdst);
1442 case OPENSSL_CHAIN_CIPHER_BPI:
1443 process_openssl_docsis_bpi_op(op, sess, msrc, mdst);
1446 op->status = RTE_CRYPTO_OP_STATUS_ERROR;
1450 /* Free session if a session-less crypto op */
1451 if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) {
1452 openssl_reset_session(sess);
1453 memset(sess, 0, sizeof(struct openssl_session));
1454 memset(op->sym->session, 0,
1455 rte_cryptodev_get_header_session_size());
1456 rte_mempool_put(qp->sess_mp, sess);
1457 rte_mempool_put(qp->sess_mp, op->sym->session);
1458 op->sym->session = NULL;
1461 if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED)
1462 op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
1464 if (op->status != RTE_CRYPTO_OP_STATUS_ERROR)
1465 retval = rte_ring_enqueue(qp->processed_ops, (void *)op);
1473 *------------------------------------------------------------------------------
1475 *------------------------------------------------------------------------------
1478 /** Enqueue burst */
1480 openssl_pmd_enqueue_burst(void *queue_pair, struct rte_crypto_op **ops,
1483 struct openssl_session *sess;
1484 struct openssl_qp *qp = queue_pair;
1487 for (i = 0; i < nb_ops; i++) {
1488 sess = get_session(qp, ops[i]);
1489 if (unlikely(sess == NULL))
1492 retval = process_op(qp, ops[i], sess);
1493 if (unlikely(retval < 0))
1497 qp->stats.enqueued_count += i;
1501 qp->stats.enqueue_err_count++;
1505 /** Dequeue burst */
1507 openssl_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
1510 struct openssl_qp *qp = queue_pair;
1512 unsigned int nb_dequeued = 0;
1514 nb_dequeued = rte_ring_dequeue_burst(qp->processed_ops,
1515 (void **)ops, nb_ops, NULL);
1516 qp->stats.dequeued_count += nb_dequeued;
1521 /** Create OPENSSL crypto device */
1523 cryptodev_openssl_create(const char *name,
1524 struct rte_vdev_device *vdev,
1525 struct rte_crypto_vdev_init_params *init_params)
1527 struct rte_cryptodev *dev;
1528 struct openssl_private *internals;
1530 if (init_params->name[0] == '\0')
1531 snprintf(init_params->name, sizeof(init_params->name),
1534 dev = rte_cryptodev_vdev_pmd_init(init_params->name,
1535 sizeof(struct openssl_private),
1536 init_params->socket_id,
1539 OPENSSL_LOG_ERR("failed to create cryptodev vdev");
1543 dev->driver_id = cryptodev_driver_id;
1544 dev->dev_ops = rte_openssl_pmd_ops;
1546 /* register rx/tx burst functions for data path */
1547 dev->dequeue_burst = openssl_pmd_dequeue_burst;
1548 dev->enqueue_burst = openssl_pmd_enqueue_burst;
1550 dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |
1551 RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |
1552 RTE_CRYPTODEV_FF_CPU_AESNI |
1553 RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER;
1555 /* Set vector instructions mode supported */
1556 internals = dev->data->dev_private;
1558 internals->max_nb_qpairs = init_params->max_nb_queue_pairs;
1559 internals->max_nb_sessions = init_params->max_nb_sessions;
1564 OPENSSL_LOG_ERR("driver %s: cryptodev_openssl_create failed",
1567 cryptodev_openssl_remove(vdev);
1571 /** Initialise OPENSSL crypto device */
1573 cryptodev_openssl_probe(struct rte_vdev_device *vdev)
1575 struct rte_crypto_vdev_init_params init_params = {
1576 RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS,
1577 RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_SESSIONS,
1582 const char *input_args;
1584 name = rte_vdev_device_name(vdev);
1587 input_args = rte_vdev_device_args(vdev);
1589 rte_cryptodev_vdev_parse_init_params(&init_params, input_args);
1591 RTE_LOG(INFO, PMD, "Initialising %s on NUMA node %d\n", name,
1592 init_params.socket_id);
1593 if (init_params.name[0] != '\0')
1594 RTE_LOG(INFO, PMD, " User defined name = %s\n",
1596 RTE_LOG(INFO, PMD, " Max number of queue pairs = %d\n",
1597 init_params.max_nb_queue_pairs);
1598 RTE_LOG(INFO, PMD, " Max number of sessions = %d\n",
1599 init_params.max_nb_sessions);
1601 return cryptodev_openssl_create(name, vdev, &init_params);
1604 /** Uninitialise OPENSSL crypto device */
1606 cryptodev_openssl_remove(struct rte_vdev_device *vdev)
1610 name = rte_vdev_device_name(vdev);
1615 "Closing OPENSSL crypto device %s on numa socket %u\n",
1616 name, rte_socket_id());
1621 static struct rte_vdev_driver cryptodev_openssl_pmd_drv = {
1622 .probe = cryptodev_openssl_probe,
1623 .remove = cryptodev_openssl_remove
1626 static struct cryptodev_driver openssl_crypto_drv;
1628 RTE_PMD_REGISTER_VDEV(CRYPTODEV_NAME_OPENSSL_PMD,
1629 cryptodev_openssl_pmd_drv);
1630 RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_OPENSSL_PMD,
1631 "max_nb_queue_pairs=<int> "
1632 "max_nb_sessions=<int> "
1634 RTE_PMD_REGISTER_CRYPTO_DRIVER(openssl_crypto_drv, cryptodev_openssl_pmd_drv,
1635 cryptodev_driver_id);